diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 00000000..24d19638
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,76 @@
+{ "extends": ["eslint-config-airbnb", "prettier"],
+ "env": {
+ "browser": true,
+ "node": true,
+ "jest": true
+ },
+ "parser": "@typescript-eslint/parser",
+ "rules": {
+ "camelcase": 0,
+ "strict": 0,
+ "react/no-multi-comp": 0,
+ "import/default": 0,
+ "import/no-duplicates": 0,
+ "import/named": 0,
+ "import/namespace": 0,
+ "import/no-unresolved": 0,
+ "import/no-named-as-default": 2,
+ "import/prefer-default-export": 0,
+ "comma-dangle": 0, // not sure why airbnb turned this on. gross!
+ "indent": [2, 2, {"SwitchCase": 1}],
+ "no-console": 0,
+ "no-alert": 0,
+ "no-shadow": 2,
+ "arrow-body-style": 0,
+ "react/prop-types": 0,
+ "react/jsx-filename-extension": 0,
+ "react/prefer-stateless-function": 0,
+ "jsx-a11y/anchor-is-valid": 0,
+ "jsx-a11y/tabindex-no-positive": 0,
+ "no-mixed-operators": 0,
+ "no-plusplus": 0,
+ "no-underscore-dangle": 0,
+ "prettier/prettier": "error",
+ "jsx-a11y/no-autofocus": 0,
+ "jsx-a11y/label-has-for": 0,
+ "prefer-destructuring": 0,
+ "react-hooks/rules-of-hooks": "error",
+ "react-hooks/exhaustive-deps": "warn",
+ "react/jsx-wrap-multilines": ["error", {"declaration": false, "assignment": false}],
+ "react/jsx-one-expression-per-line": 0,
+ "@typescript-eslint/no-unused-vars": 1,
+ "import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*_test.ts"]}],
+ "lines-between-class-members": 0,
+ "react/jsx-fragments": 0,
+ "jsx-a11y/label-has-associated-control": 0,
+ "no-empty": 0,
+ "import/extensions": 0,
+ "react/require-default-props": 0,
+ "react/default-props-match-prop-types": 0
+ },
+ "plugins": [
+ "react", "react-hooks", "import", "prettier", "@typescript-eslint"
+ ],
+ "globals": {
+ "__DEVELOPMENT__": true,
+ "__PRODUCTION__": true,
+ "__DISABLE_SSR__": true,
+ "__DEVTOOLS__": true,
+ "__DOMAIN__": true,
+ "__BASE_URL__": true,
+ "__BASE_NAME__": true,
+ "__STRIPE_PUBLIC_KEY__": true,
+ "__ROOT_URL__": true,
+ "__CDN_URL__": true,
+ "__STANDALONE__": true,
+ "socket": true,
+ "webpackIsomorphicTools": true,
+ "StripeCheckout": true,
+
+ "browser": true,
+ "chrome": true,
+ __WEB_URL__: true,
+ __API_ENDPOINT__: true,
+ __VERSION__: true
+ }
+}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
deleted file mode 100644
index ac44b4f3..00000000
--- a/.github/workflows/ci.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-name: CI
-on:
- push:
- branches:
- - master
- pull_request:
- branches:
- - master
-
-jobs:
- build:
- runs-on: ubuntu-22.04
-
- steps:
- - uses: actions/checkout@v5
- - uses: actions/setup-go@v6
- with:
- go-version: '>=1.25.0'
-
- - name: Install dependencies
- run: |
- make install
-
- - name: Test cli
- run: |
- make test-cli
-
- - name: Test app
- run: |
- make test-api
-
- - name: Test e2e
- run: |
- make test-e2e
diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml
deleted file mode 100644
index 81a2ea5e..00000000
--- a/.github/workflows/release-cli.yml
+++ /dev/null
@@ -1,77 +0,0 @@
-name: Release CLI
-
-on:
- push:
- tags:
- - 'cli-v*'
-
-jobs:
- release:
- runs-on: ubuntu-22.04
- permissions:
- contents: write
-
- steps:
- - uses: actions/checkout@v5
- with:
- fetch-depth: 0
- - uses: actions/setup-go@v6
- with:
- go-version: '>=1.25.0'
-
- - name: Extract version from tag
- id: version
- run: |
- TAG=${GITHUB_REF#refs/tags/cli-v}
- echo "version=$TAG" >> $GITHUB_OUTPUT
- echo "Releasing version: $TAG"
-
- - name: Install dependencies
- run: make install
-
- - name: Run CLI tests
- run: make test-cli
-
- - name: Run E2E tests
- run: make test-e2e
-
- - name: Build CLI
- run: make version=${{ steps.version.outputs.version }} build-cli
-
- - name: Generate changelog
- run: |
- VERSION="${{ steps.version.outputs.version }}"
- TAG="cli-v${VERSION}"
-
- # Find previous CLI tag
- PREV_TAG=$(git tag --sort=-version:refname | grep "^cli-" | grep -v "^${TAG}$" | head -n 1)
-
- if [ -z "$PREV_TAG" ]; then
- echo "Error: No previous CLI tag found"
- echo "This appears to be the first release."
- exit 1
- fi
-
- ./scripts/generate-changelog.sh cli "$TAG" "$PREV_TAG" > /tmp/changelog.txt
- cat /tmp/changelog.txt
-
- - name: Create GitHub release
- env:
- GH_TOKEN: ${{ github.token }}
- run: |
- VERSION="${{ steps.version.outputs.version }}"
- TAG="cli-v${VERSION}"
-
- # Determine if prerelease (version not matching major.minor.patch)
- FLAGS=""
- if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- FLAGS="--prerelease"
- fi
-
- gh release create "$TAG" \
- build/cli/*.tar.gz \
- build/cli/*_checksums.txt \
- $FLAGS \
- --title="$TAG" \
- --notes-file=/tmp/changelog.txt \
- --draft
diff --git a/.github/workflows/release-server.yml b/.github/workflows/release-server.yml
deleted file mode 100644
index a5f52933..00000000
--- a/.github/workflows/release-server.yml
+++ /dev/null
@@ -1,109 +0,0 @@
-name: Release Server
-
-on:
- push:
- tags:
- - 'server-v*'
-
-jobs:
- release:
- runs-on: ubuntu-22.04
- permissions:
- contents: write
-
- steps:
- - uses: actions/checkout@v5
- with:
- fetch-depth: 0
- - uses: actions/setup-go@v6
- with:
- go-version: '>=1.25.0'
- - uses: actions/setup-node@v4
- with:
- node-version: '20'
-
- - name: Extract version from tag
- id: version
- run: |
- TAG=${GITHUB_REF#refs/tags/server-v}
- echo "version=$TAG" >> $GITHUB_OUTPUT
- echo "Releasing version: $TAG"
-
- - name: Install dependencies
- run: make install
-
- - name: Run tests
- run: make test
-
- - name: Build server
- run: make version=${{ steps.version.outputs.version }} build-server
-
- - name: Generate changelog
- run: |
- VERSION="${{ steps.version.outputs.version }}"
- TAG="server-v${VERSION}"
-
- # Find previous server tag
- PREV_TAG=$(git tag --sort=-version:refname | grep "^server-" | grep -v "^${TAG}$" | head -n 1)
-
- if [ -z "$PREV_TAG" ]; then
- echo "Error: No previous server tag found"
- echo "This appears to be the first release."
- exit 1
- fi
-
- ./scripts/generate-changelog.sh server "$TAG" "$PREV_TAG" > /tmp/changelog.txt
- cat /tmp/changelog.txt
-
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v3
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
- - name: Prepare Docker build context
- run: |
- VERSION="${{ steps.version.outputs.version }}"
- cp build/server/dnote_server_${VERSION}_linux_amd64.tar.gz host/docker/
- cp build/server/dnote_server_${VERSION}_linux_arm64.tar.gz host/docker/
- cp build/server/dnote_server_${VERSION}_linux_arm.tar.gz host/docker/
- cp build/server/dnote_server_${VERSION}_linux_386.tar.gz host/docker/
-
- - name: Login to Docker Hub
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_TOKEN }}
-
- - name: Build and push Docker image
- uses: docker/build-push-action@v6
- with:
- context: ./host/docker
- push: true
- platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386
- tags: |
- dnote/dnote:${{ steps.version.outputs.version }}
- dnote/dnote:latest
- build-args: |
- version=${{ steps.version.outputs.version }}
-
- - name: Create GitHub release
- env:
- GH_TOKEN: ${{ github.token }}
- run: |
- VERSION="${{ steps.version.outputs.version }}"
- TAG="server-v${VERSION}"
-
- # Determine if prerelease (version not matching major.minor.patch)
- FLAGS=""
- if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- FLAGS="--prerelease"
- fi
-
- gh release create "$TAG" \
- build/server/*.tar.gz \
- build/server/*_checksums.txt \
- $FLAGS \
- --title="$TAG" \
- --notes-file=/tmp/changelog.txt \
- --draft
diff --git a/.gitignore b/.gitignore
index 2847e75d..323a70e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,3 @@
.vagrant
*.log
node_modules
-/test
-tmp
-*.db
-/server
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 00000000..5d36fb8c
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,6 @@
+{
+ "singleQuote": true,
+ "trailingComma": "none",
+ "arrowParens": "avoid",
+}
+
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..529b7bae
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,32 @@
+language: go
+dist: xenial
+
+go:
+ - 1.13
+
+env:
+ - NODE_VERSION=10.15.0
+
+before_install:
+ - sudo apt-get update
+ - sudo apt-get --yes remove postgresql\*
+ - sudo apt-get install -y postgresql-11 postgresql-client-11
+ - sudo cp /etc/postgresql/{9.6,11}/main/pg_hba.conf
+ - sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/11/main/postgresql.conf
+ - sudo service postgresql restart 11
+
+before_script:
+ - nvm install "$NODE_VERSION"
+ - nvm use "$NODE_VERSION"
+ - node --version
+ - psql -c "CREATE DATABASE dnote_test;" -U postgres
+
+install:
+ - make install
+
+script:
+ - make lint
+ - make test-cli
+ - make test-api
+ - make test-web
+ - make test-jslib
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..060d176d
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,243 @@
+# CHANAGELOG
+
+All notable changes to the projects under this repository will be documented in this file.
+
+* [Server](#server)
+* [CLI](#cli)
+* [Browser Extensions](#browser-extensions)
+
+## Server
+
+The following log documents the history of the server project.
+
+### Unreleased
+
+None
+
+### 1.0.4 2020-05-23
+
+#### Removed
+
+- Simplify the bundle by removing unnecessary payment logic
+
+#### Fixed
+
+- Fix timestamp in the note content view
+- Invalidate existing sessions when password is changed
+
+### 1.0.3 2020-05-03
+
+#### Fixed
+
+- Fix timeline grouping notes by added time rather than updated time.
+
+#### Changed
+
+- Sort notes by last activity to make it easier to see the most recently accessed information.
+
+### 1.0.2 2020-05-03
+
+#### Changed
+
+* Support arm64.
+
+### 1.0.1 - 2020-03-29
+
+- Fix fresh install running migrations against tables that no longer exists.
+
+### 1.0.0 - 2020-03-22
+
+#### Fixed
+
+- Fix unsubscribe link from the inactive reminder (#433)
+
+#### Removed
+
+- Remove the deprecated features related to digests and repetition rules (#432)
+- Remove the migration for the deprecated, encrypted Dnote (#433)
+
+#### Changed
+
+- Please set `OnPremise` environment to `true` in order to automatically use the Pro version.
+
+### 0.5.0 - 2020-02-06
+
+#### Changed
+
+- **Deprecated** the digest and digest emails (#397)
+- **Deprecated** the repetition rules (#397)
+
+#### Fixed
+
+- Fix refocusing to the end of the textarea input (#405)
+
+### 0.4.0 - 2020-01-09
+
+#### Added
+
+- A web-based digest (#380)
+
+#### Fixed
+
+- Send inactive reminders with a correct email type (#385)
+- Wrap words in note content (#389)
+
+### 0.3.4 - 2019-12-24
+
+#### Added
+
+- Remind when the knowledge base stops growing (#375)
+- Alert when a password is changed (#375)
+
+#### Fixed
+
+- Implement syntax highlighting for code blocks ($377)
+
+### 0.3.3 - 2019-12-17
+
+#### Added
+
+- Send welcome email with login instructions upon reigstering (#352)
+- Add an option to disable registration (#365)
+
+#### Changed
+
+- Send emails from the domain that hosts the application for on premise installations (#355)
+- For on premise installations, automatically upgrade user accounts (#361)
+
+### 0.3.2 - 2019-11-20
+
+#### Fixed
+
+- Fix server crash upon landing on a note page (#324).
+- Allow to synchronize a large number of records (#321)
+
+### 0.3.1 - 2019-11-12
+
+#### Fixed
+
+- Fix static files not being embedded in the binary. (#309)
+- Fix mobile menu not covering the whole screen. (#308)
+
+### 0.3.0 - 2019-11-12
+
+#### Added
+
+- Share notes (#300)
+- Allow to recover from a missed repetition processing (#305)
+
+### 0.2.1 - 2019-11-04
+
+#### Upgrade Guide
+
+* Please define the follwoing new environment variables:
+
+ - `WebURL`: the URL to your Dnote server, without the trailing slash. (e.g. `https://my-server.com`) (Please see #290)
+ - `SmtpPort`: the SMTP port. (e.g. `465`) optional - required *if you want to configure email*
+
+#### Added
+
+- Display version number in the settings (#293)
+- Allow unsecure database connection in production (#276)
+
+#### Fixed
+
+- Allow to customize the app URL in the emails (#290)
+- Allow to customize the SMTP port (#292)
+
+### 0.2.0 - 2019-10-28
+
+#### Added
+
+- Specify spaced repetition rule (#280)
+
+#### Changed
+
+- Treat a linebreak as a new line in the preview (#261)
+- Allow to have multiple editor states for adding and editing notes (#260)
+
+#### Fixed
+
+- Fix jumping focus on editor (#265)
+
+### 0.1.1 - 2019-09-30
+
+#### Fixed
+
+- Fix asset loading (#257)
+
+
+### 0.1.0 - 2019-09-30
+
+#### Added
+
+- Full-text search (#254)
+- Password recovery (#254)
+- Embedded notes in the digest emails (#254)
+
+#### Removed
+
+- **Breaking Change**: End-to-end encryption was removed. Existing users need to go to `/classic` and follow the automated migration steps. (#254)
+- **Breaking Change**: `v1` and `v2` API endpoints were removed, and `v3` API was added as a replacement.
+
+#### Migration guide
+
+- In your application, navigate to `/classic` and follow the automated migration steps.
+
+
+## CLI
+
+The following log documentes the history of the CLI project
+
+### Unreleased
+
+None
+
+### 0.11.1 - 2020-04-25
+
+#### Fixed
+
+- Fix upgrade URL (#453)
+
+#### Changed
+
+- Display hostname of the self-hosted instance while logging in (#454)
+- Display helpful error if endpoint is misconfigured (#455)
+
+### 0.11.0 - 2020-02-05
+
+#### Added
+
+- Allow to pass credentials through flags while logging in (#403)
+
+### 0.10.0 - 2019-09-30
+
+#### Removed
+
+- **Breaking Change**: End-to-end encryption was removed. Previous versions will no longer be able to interact with the web API, because `v1` and `v2` endpoints were replaced by a new `v3` endpoint to remove encryption.
+
+#### Migration guide
+
+- If you are using Dnote Pro, change the value of `apiEndpoint` in `~/.dnote/dnoterc` to `https://api.getdnote.com`.
+
+## Browser Extensions
+
+The following log documentes the history of the browser extensions project
+
+### [Unreleased]
+
+N/A
+
+### 2.0.0 - 2019-10-29
+
+- Allow to customize API and web URLs (#285)
+
+### 1.1.1 - 2019-10-02
+
+- Fix failing requests (#263)
+
+### 1.1.0 - 2019-09-30
+
+#### Removed
+
+- **Breaking Change**: End-to-end encryption was removed. Previous versions will no longer be able to interact with the web API, because `v1` and `v2` endpoints were replaced by a new `v3` endpoint to remove encryption.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b0fa33eb..a027c90f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,61 +8,95 @@ Dnote is an open source project.
## Setting up
-The CLI and server are single single binary files with SQLite embedded - no databases to install, no containers to run, no VMs required.
+Dnote uses [Vagrant](https://github.com/hashicorp/vagrant) to provision a consistent development environment.
-**Prerequisites**
+*Prerequisites*
-* Go 1.25+ ([Download](https://go.dev/dl/))
-* Node.js 18+ ([Download](https://nodejs.org/) - only needed for building frontend assets)
+* Vagrant ([Download](https://www.vagrantup.com/downloads.html))
+* VirtualBox ([Download](https://www.virtualbox.org/))
-**Quick Start**
+Run the following command from the project root. It starts the virtual machine and bootstraps the project.
-1. Clone the repository
-2. Install dependencies:
- ```bash
- make install
- ```
-3. Start developing! Run tests:
- ```bash
- make test
- ```
- Or start the dev server:
- ```bash
- make dev-server
- ```
+```
+vagrant up
+```
-That's it. You're ready to contribute.
+*Workflow*
+
+* You can make changes to the source code from the host machine.
+* Any commands need to be run inside the virtual machine. You can connect to it by running `vagrant ssh`.
+* If you want to run tests in a WATCH mode, please do so from the host machine. We cannot watch file changes due to the limitation of file system used in a virtual machine.
## Server
-```bash
-# Start dev server (runs on localhost:3001)
-make dev-server
+The server consists of the frontend web application and a web server.
-# Run tests
+### Development
+
+* Run `make dev-server` to start a local server.
+* You can access the server on `localhost:3000` on your machine.
+
+### Test
+
+```bash
+# Run tests for the frontend web application
+make test-web
+
+# Run in watch mode
+WATCH=true make test-web
+
+# Run tests for API
make test-api
-# Run tests in watch mode
+# Run in watch mode
WATCH=true make test-api
```
+
## Command Line Interface
-```bash
-# Run tests
-make test-cli
+### Build
-# Build dev version (places in your PATH)
+You can build either a development version or a production version:
+
+```
+# Build a development version for your platform and place it in your `PATH`.
make debug=true build-cli
-# Build production version for all platforms
+# Build a production version for all platforms
make version=v0.1.0 build-cli
-# Build for a specific platform
+# Build a production version for a specific platform
# Note: You cannot cross-compile using this method because Dnote uses CGO
# and requires the OS specific headers.
GOOS=[insert OS] GOARCH=[insert arch] make version=v0.1.0 build-cli
+```
-# Debug mode
+### Test
+
+* Run all tests for the command line interface:
+
+```
+make test-cli
+```
+
+### Debug
+
+Run Dnote with `DNOTE_DEBUG=1` to print debugging statements. For instance:
+
+```
DNOTE_DEBUG=1 dnote sync
```
+
+### Release
+
+* Run `make version=v0.1.0 release-cli` to achieve the following:
+ * Build for all target platforms, create a git tag, push all tags to the repository
+ * Create a release on GitHub and [Dnote Homebrew tap](https://github.com/dnote/homebrew-dnote).
+
+**Note**
+
+- If a release is not stable,
+ - disable the homebrew release by commenting out relevant code in the release script.
+ - mark release as pre-release on GitHub release
+
diff --git a/LICENSE b/LICENSE
index 6b0b1270..0c667b35 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,203 +1,8 @@
+Source code in this repository is variously licensed under the GNU Affero General Public
+License v3.0 (GNU AGPLv3), and GNU General Public License v3.0 (GNU GPLv3). A copy of each
+license can be found in the licenses directory. The Source code for the cli is licensed under
+GNU GPLv3. The source code for the server and the web is licensed under GNU AGPLv3. Unless
+otherwise noted, source code in a given file is licensed under the GNU AGPLv3.
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
-
+Unless otherwise noted at the beginning of the file, the copyright belongs to
+Monomax Software Pty Ltd.
diff --git a/Makefile b/Makefile
index c38819c0..c7a3eccd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
+PACKR2 := $(shell command -v packr2 2> /dev/null)
NPM := $(shell command -v npm 2> /dev/null)
-GH := $(shell command -v gh 2> /dev/null)
+HUB := $(shell command -v hub 2> /dev/null)
currentDir = $(shell pwd)
serverOutputDir = ${currentDir}/build/server
@@ -11,6 +12,11 @@ install: install-go install-js
.PHONY: install
install-go:
+ifndef PACKR2
+ @echo "==> installing packr2"
+ @go get -u github.com/gobuffalo/packr/v2/packr2
+endif
+
@echo "==> installing go dependencies"
@go mod download
.PHONY: install-go
@@ -23,17 +29,35 @@ endif
@echo "==> installing js dependencies"
ifeq ($(CI), true)
- @(cd ${currentDir}/pkg/server/assets && npm ci --cache $(NPM_CACHE_DIR) --prefer-offline --unsafe-perm=true)
+ @(cd ${currentDir} && npm ci --cache $(NPM_CACHE_DIR) --prefer-offline --unsafe-perm=true)
+ @(cd ${currentDir}/web && npm ci --cache $(NPM_CACHE_DIR) --prefer-offline --unsafe-perm=true)
+ @(cd ${currentDir}/browser && npm ci --cache $(NPM_CACHE_DIR) --prefer-offline --unsafe-perm=true)
+ @(cd ${currentDir}/jslib && npm ci --cache $(NPM_CACHE_DIR) --prefer-offline --unsafe-perm=true)
else
- @(cd ${currentDir}/pkg/server/assets && npm install)
+ @(cd ${currentDir} && npm install)
+ @(cd ${currentDir}/web && npm install)
+ @(cd ${currentDir}/browser && npm install)
+ @(cd ${currentDir}/jslib && npm install)
endif
.PHONY: install-js
+lint:
+ @(cd ${currentDir}/web && npm run lint)
+ @(cd ${currentDir}/jslib && npm run lint)
+ @(cd ${currentDir}/browser && npm run lint)
+.PHONY: lint
+
+lint-fix:
+ @(cd ${currentDir}/web && npm run lint:fix)
+ @(cd ${currentDir}/jslib && npm run lint:fix)
+ @(cd ${currentDir}/browser && npm run lint:fix)
+.PHONY: lint
+
## test
-test: test-cli test-api test-e2e
+test: test-cli test-api test-web test-jslib
.PHONY: test
-test-cli: generate-cli-schema
+test-cli:
@echo "==> running CLI test"
@(${currentDir}/scripts/cli/test.sh)
.PHONY: test-cli
@@ -43,47 +67,57 @@ test-api:
@(${currentDir}/scripts/server/test-local.sh)
.PHONY: test-api
-test-e2e:
- @echo "==> running E2E test"
- @(${currentDir}/scripts/e2e/test.sh)
-.PHONY: test-e2e
+test-web:
+ @echo "==> running web test"
+
+ifeq ($(WATCH), true)
+ @(cd ${currentDir}/web && npm run test:watch)
+else
+ @(cd ${currentDir}/web && npm run test)
+endif
+.PHONY: test-web
+
+test-jslib:
+ @echo "==> running jslib test"
+
+ifeq ($(WATCH), true)
+ @(cd ${currentDir}/jslib && npm run test:watch)
+else
+ @(cd ${currentDir}/jslib && npm run test)
+endif
+.PHONY: test-jslib
+
+test-selfhost:
+ @echo "==> running a smoke test for self-hosting"
+
+ @${currentDir}/host/smoketest/run_test.sh ${tarballPath}
+.PHONY: test-jslib
# development
dev-server:
@echo "==> running dev environment"
- @VERSION=master ${currentDir}/scripts/server/dev.sh
+ @VERSION=master ${currentDir}/scripts/web/dev.sh
.PHONY: dev-server
-build-server:
+## build
+build-web:
+ifndef version
+ $(error version is required. Usage: make version=0.1.0 build-web)
+endif
+ @echo "==> building web"
+ @VERSION=${version} ${currentDir}/scripts/web/build-prod.sh
+.PHONY: build-web
+
+build-server: build-web
ifndef version
$(error version is required. Usage: make version=0.1.0 build-server)
endif
- @echo "==> building server assets"
- @(cd "${currentDir}/pkg/server/assets/" && ./styles/build.sh)
- @(cd "${currentDir}/pkg/server/assets/" && ./js/build.sh)
-
@echo "==> building server"
@${currentDir}/scripts/server/build.sh $(version)
.PHONY: build-server
-build-server-docker: build-server
-ifndef version
- $(error version is required. Usage: make version=0.1.0 [platform=linux/amd64] build-server-docker)
-endif
-
- @echo "==> building Docker image"
- @(cd ${currentDir}/host/docker && ./build.sh $(version) $(platform))
-.PHONY: build-server-docker
-
-generate-cli-schema:
- @echo "==> generating CLI database schema"
- @mkdir -p pkg/cli/database
- @touch pkg/cli/database/schema.sql
- @go run -tags fts5 ./pkg/cli/database/schema
-.PHONY: generate-cli-schema
-
-build-cli: generate-cli-schema
+build-cli:
ifeq ($(debug), true)
@echo "==> building cli in dev mode"
@${currentDir}/scripts/cli/dev.sh
@@ -98,7 +132,61 @@ endif
endif
.PHONY: build-cli
+## release
+release-cli: clean build-cli
+ifndef version
+ $(error version is required. Usage: make version=0.1.0 release-cli)
+endif
+ifndef HUB
+ $(error please install hub)
+endif
+
+ if [ ! -d ${cliHomebrewDir} ]; then \
+ @echo "homebrew-dnote not found locally. did you clone it?"; \
+ @exit 1; \
+ fi
+
+ @echo "==> releasing cli"
+ @${currentDir}/scripts/release.sh cli $(version) ${cliOutputDir}
+
+ @echo "===> releading on Homebrew"
+ @(cd "${cliHomebrewDir}" && \
+ ./release.sh "$(version)" "${cliOutputDir}/dnote_$(version)_darwin_amd64.tar.gz")
+.PHONY: release-cli
+
+release-server:
+ifndef version
+ $(error version is required. Usage: make version=0.1.0 release-server)
+endif
+ifndef HUB
+ $(error please install hub)
+endif
+
+ @echo "==> releasing server"
+ @${currentDir}/scripts/release.sh server $(version) ${serverOutputDir}
+
+ @echo "==> building and releasing docker image"
+ @(cd ${currentDir}/host/docker && ./build.sh $(version))
+ @(cd ${currentDir}/host/docker && ./release.sh $(version))
+.PHONY: release-server
+
+# migrations
+create-migration:
+ifndef filename
+ $(error filename is required. Usage: make filename=your-filename create-migration)
+endif
+
+ @(cd ${currentDir}/pkg/server/database && ./scripts/create-migration.sh $(filename))
+.PHONY: create-migration
+
clean:
@git clean -f
@rm -rf build
+ @rm -rf web/public
.PHONY: clean
+
+clean-dep:
+ @rm -rf ${currentDir}/web/node_modules
+ @rm -rf ${currentDir}/jslib/node_modules
+ @rm -rf ${currentDir}/browser/node_modules
+.PHONY: clean-dep
diff --git a/README.md b/README.md
index 7ab0063f..a53da6a1 100644
--- a/README.md
+++ b/README.md
@@ -1,64 +1,41 @@

=========================
-
+[](https://travis-ci.org/dnote/dnote)
-Dnote is a simple command line notebook. Single binary, no dependencies. Since 2017.
+Dnote is a simple command line notebook for programmers.
-Your notes are stored in **one SQLite file** - portable, searchable, and completely under your control. Optional sync between devices via a self-hosted server with REST API access.
+It **keeps you focused** by providing a way of effortlessly capturing and retrieving information **without leaving your terminal**. It also offers a seamless **multi-device sync** and a **web interface**.
-```sh
-# Add a note (or omit -c to launch your editor)
-dnote add linux -c "Check disk usage with df -h"
-
-# View notes in a book
-dnote view linux
-
-# Full-text search
-dnote find "disk usage"
-
-# Sync notes
-dnote sync
-```
+
## Installation
-```bash
-# Linux, macOS, FreeBSD, Windows
-curl -s https://www.getdnote.com/install | sh
+On macOS, you can install using Homebrew:
-# macOS with Homebrew
+```sh
+brew tap dnote/dnote
brew install dnote
```
-Or [download binary](https://github.com/dnote/dnote/releases).
+On Linux or macOS, you can use the installation script:
-## Server (Optional)
+ curl -s https://www.getdnote.com/install | sh
-Server is a binary with SQLite embedded. No database setup is required.
+Otherwise, you can download the binary for your platform manually from the [releases page](https://github.com/dnote/dnote/releases).
-If using docker, create a compose.yml:
+## Server
-```yaml
-services:
- dnote:
- image: dnote/dnote:latest
- container_name: dnote
- ports:
- - 3001:3001
- volumes:
- - ./dnote_data:/data
- restart: unless-stopped
-```
+The quickest way to experience the Dnote server is to use [Dnote Cloud](https://app.getdnote.com).
-Then run:
-
-```bash
-docker-compose up -d
-```
-
-Or see the [guide](https://www.getdnote.com/docs/server/manual) for binary installation.
+Or you can install it on your server by [using Docker](https://github.com/dnote/dnote/blob/master/host/docker/README.md), or [using a binary](https://github.com/dnote/dnote/blob/master/SELF_HOSTING.md).
## Documentation
-See the [Dnote doc](https://www.getdnote.com/docs).
+Please see [Dnote wiki](https://github.com/dnote/dnote/wiki) for the documentation.
+
+## See Also
+
+- [Homepage](https://www.getdnote.com)
+- [Forum](https://forum.getdnote.com)
+- [I Wrote Down Everything I Learned While Programming for a Month](https://www.getdnote.com/blog/writing-everything-i-learn-coding-for-a-month/)
diff --git a/SELF_HOSTING.md b/SELF_HOSTING.md
index e67df891..072a85cb 100644
--- a/SELF_HOSTING.md
+++ b/SELF_HOSTING.md
@@ -1,43 +1,183 @@
-# Self-Hosting Dnote Server
+# Installing Dnote Server
-Please see the [doc](https://www.getdnote.com/docs/server) for more.
+This guide documents the steps for installing the Dnote server on your own machine. If you prefer Docker, please see [the Docker guide](https://github.com/dnote/dnote/blob/master/host/docker/README.md).
-## Docker Installation
+## Overview
-1. Install [Docker](https://docs.docker.com/install/).
-2. Install Docker [Compose plugin](https://docs.docker.com/compose/install/linux/).
-3. Create a `compose.yml` file with the following content:
+Dnote server comes as a single binary file that you can simply download and run. It uses Postgres as the database.
-```yaml
-services:
- dnote:
- image: dnote/dnote:latest
- container_name: dnote
- ports:
- - 3001:3001
- volumes:
- - ./dnote_data:/data
- restart: unless-stopped
-```
+## Installation
-4. Run the following to download the image and start the container
-
-```
-docker compose up -d
-```
-
-Visit http://localhost:3001 in your browser to see Dnote running.
-
-## Manual Installation
-
-Download from [releases](https://github.com/dnote/dnote/releases), extract, and run:
+1. Install Postgres 11+.
+2. Create a `dnote` database by running `createdb dnote`
+3. Download the official Dnote server release from the [release page](https://github.com/dnote/dnote/releases).
+4. Extract the archive and move the `dnote-server` executable to `/usr/local/bin`.
```bash
tar -xzf dnote-server-$version-$os.tar.gz
mv ./dnote-server /usr/local/bin
-dnote-server start --baseUrl=https://your.server
```
-You're up and running. Database: `~/.local/share/dnote/server.db` (customize with `--dbPath`). Run `dnote-server start --help` for options.
+4. Run Dnote
-Set `apiEndpoint: https://your.server/api` in `~/.config/dnote/dnoterc` to connect your CLI to the server.
+```bash
+GO_ENV=PRODUCTION \
+OnPremise=true \
+DBHost=localhost \
+DBPort=5432 \
+DBName=dnote \
+DBUser=$user \
+DBPassword=$password \
+WebURL=$webURL \
+SmtpHost=$SmtpHost \
+SmtpPort=$SmtpPort \
+SmtpUsername=$SmtpUsername \
+SmtpPassword=$SmtpPassword \
+DisableRegistration=false
+ dnote-server start
+```
+
+Replace `$user`, `$password` with the credentials of the Postgres user that owns the `dnote` database.
+
+Replace `$webURL` with the full URL to your server, without a trailing slash (e.g. `https://your.server`).
+
+Replace `$SmtpHost`, `SmtpPort`, `$SmtpUsername`, `$SmtpPassword` with actual values, if you would like to receive spaced repetition through email.
+
+Replace `DisableRegistration` to `true` if you would like to disable user registrations.
+
+By default, dnote server will run on the port 3000.
+
+## Configuration
+
+By now, Dnote is fully functional in your machine. The API, frontend app, and the background tasks are all in the single binary. Let's take a few more steps to configure Dnote.
+
+### Configure Nginx
+
+To make it accessible from the Internet, you need to configure Nginx.
+
+1. Install nginx.
+2. Create a new file in `/etc/nginx/sites-enabled/dnote` with the following contents:
+
+```
+server {
+ server_name my-dnote-server.com;
+
+ location / {
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $remote_addr;
+ proxy_set_header Host $host;
+ proxy_pass http://127.0.0.1:3000;
+ }
+}
+```
+3. Replace `my-dnote-server.com` with the URL for your server.
+4. Reload the nginx configuration by running the following:
+
+```
+sudo service nginx reload
+```
+
+### Configure Apache2
+
+1. Install Apache2 and install/enable mod_proxy.
+2. Create a new file in `/etc/apache2/sites-available/dnote.conf` with the following contents:
+
+```
+
+ ServerName notes.example.com
+
+ ProxyRequests Off
+ ProxyPreserveHost On
+ ProxyPass / http://127.0.0.1:3000/ keepalive=On
+ ProxyPassReverse / http://127.0.0.1:3000/
+ RequestHeader set X-Forwarded-HTTPS "0"
+
+```
+
+3. Enable the dnote site and restart the Apache2 service by running the following:
+
+```
+a2ensite dnote
+sudo service apache2 restart
+```
+
+Now you can access the Dnote frontend application on `/`, and the API on `/api`.
+
+### Configure TLS by using LetsEncrypt
+
+It is recommended to use HTTPS. Obtain a certificate using LetsEncrypt and configure TLS in Nginx.
+
+In the future versions of the Dnote Server, HTTPS will be required at all times.
+
+### Run Dnote As a Daemon
+
+We can use `systemd` to run Dnote in the background as a Daemon, and automatically start it on system reboot.
+
+1. Create a new file at `/etc/systemd/system/dnote.service` with the following content:
+
+```
+[Unit]
+Description=Starts the dnote server
+Requires=network.target
+After=network.target
+
+[Service]
+Type=simple
+User=$user
+Restart=always
+RestartSec=3
+WorkingDirectory=/home/$user
+ExecStart=/usr/local/bin/dnote-server start
+Environment=GO_ENV=PRODUCTION
+Environment=OnPremise=true
+Environment=DBHost=localhost
+Environment=DBPort=5432
+Environment=DBName=dnote
+Environment=DBUser=$DBUser
+Environment=DBPassword=$DBPassword
+Environment=DBSkipSSL=true
+Environment=WebURL=$WebURL
+Environment=SmtpHost=
+Environment=SmtpPort=
+Environment=SmtpUsername=
+Environment=SmtpPassword=
+
+[Install]
+WantedBy=multi-user.target
+```
+
+Replace `$user`, `$WebURL`, `$DBUser`, and `$DBPassword` with the actual values.
+
+Optionally, if you would like to send spaced repetitions throught email, populate `SmtpHost`, `SmtpPort`, `SmtpUsername`, and `SmtpPassword`.
+
+2. Reload the change by running `sudo systemctl daemon-reload`.
+3. Enable the Daemon by running `sudo systemctl enable dnote`.`
+4. Start the Daemon by running `sudo systemctl start dnote`
+
+### Configure clients
+
+Let's configure Dnote clients to connect to the self-hosted web API endpoint.
+
+#### CLI
+
+We need to modify the configuration file for the CLI. It should have been generated at `~/.dnote/dnoterc` upon running the CLI for the first time.
+
+The following is an example configuration:
+
+```yaml
+editor: nvim
+apiEndpoint: https://api.getdnote.com
+```
+
+Simply change the value for `apiEndpoint` to a full URL to the self-hosted instance, followed by '/api', and save the configuration file.
+
+e.g.
+
+```yaml
+editor: nvim
+apiEndpoint: my-dnote-server.com/api
+```
+
+#### Browser extension
+
+Navigate into the 'Settings' tab and set the values for 'API URL', and 'Web URL'.
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 00000000..65dd3db1
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,20 @@
+# -*- mode: ruby -*-
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "ubuntu/bionic64"
+ config.vm.synced_folder '.', '/go/src/github.com/dnote/dnote'
+ config.vm.network "forwarded_port", guest: 3000, host: 3000
+ config.vm.network "forwarded_port", guest: 8080, host: 8080
+ config.vm.network "forwarded_port", guest: 5432, host: 5433
+
+ config.vm.provision 'shell', path: './scripts/vagrant/install_utils.sh'
+ config.vm.provision 'shell', path: './scripts/vagrant/install_go.sh', privileged: false
+ config.vm.provision 'shell', path: './scripts/vagrant/install_node.sh', privileged: false
+ config.vm.provision 'shell', path: './scripts/vagrant/install_postgres.sh', privileged: false
+ config.vm.provision 'shell', path: './scripts/vagrant/bootstrap.sh', privileged: false
+
+ config.vm.provider "virtualbox" do |v|
+ v.memory = 4000
+ v.cpus = 2
+ end
+end
diff --git a/assets/cli.gif b/assets/cli.gif
new file mode 100644
index 00000000..8925e131
Binary files /dev/null and b/assets/cli.gif differ
diff --git a/assets/devices.png b/assets/devices.png
new file mode 100644
index 00000000..5d40ee10
Binary files /dev/null and b/assets/devices.png differ
diff --git a/browser/.gitignore b/browser/.gitignore
new file mode 100644
index 00000000..b6da8558
--- /dev/null
+++ b/browser/.gitignore
@@ -0,0 +1,5 @@
+/dist
+/package
+/node_modules
+.DS_Store
+extension.tar.gz
diff --git a/browser/CONTRIBUTING.md b/browser/CONTRIBUTING.md
new file mode 100644
index 00000000..6c8f2355
--- /dev/null
+++ b/browser/CONTRIBUTING.md
@@ -0,0 +1,18 @@
+# Contributing
+
+Use the following commands to set up, build, and release.
+
+## Set up
+
+* `npm install` to install dependencies.
+
+## Developing locally
+
+* `npm run watch:firefox`
+* `npm run watch:chrome`
+
+## Releasing
+
+* Set a new version in `package.json`
+* Run `./scripts/build_prod.sh`
+ * A gulp task `manifest` will copy the version from `package.json` to `manifest.json`
diff --git a/browser/NOTE_TO_REVIEWER.md b/browser/NOTE_TO_REVIEWER.md
new file mode 100644
index 00000000..ada384f5
--- /dev/null
+++ b/browser/NOTE_TO_REVIEWER.md
@@ -0,0 +1,18 @@
+# Note to reviewer
+
+This document contains instructions about how to reproduce the final build of this extension.
+
+All releases are tagged and pushed to [the GitHub repository](https://github.com/dnote/dnote).
+
+## Steps
+
+To reproduce the obfuscated code for Firefox, please follow the steps below.
+
+1. Run `npm install` to install dependencies
+2. Run `./scripts/build_prod.sh` to build for Firefox and Chrome.
+
+The obfuscated code will be under `/dist/firefox` and `/dist/chrome`.
+
+## Further questions
+
+Please contact sung@dnote.io
diff --git a/browser/README.md b/browser/README.md
new file mode 100644
index 00000000..3dece9af
--- /dev/null
+++ b/browser/README.md
@@ -0,0 +1,28 @@
+# Dnote Browser Extension
+
+Dnote browser extension for Chrome and Firefox. Capture new information without opening a new tab or leaving your browser.
+
+
+
+## Installation
+
+1. Install the extension
+
+* Firefox - https://addons.mozilla.org/addon/dnote
+* Chrome - https://chrome.google.com/webstore/detail/dnote/mcfbfmihbijfaambfbbfcdcfibcjcahi
+
+2. Login with your API key from https://dnote.io
+
+## Overview
+
+We learn many things while reading technical articles, or browsing StackOverflow. Unless we write them down we forget most of them exponentially.
+
+This extension integrates seamlessly with [Dnote CLI](https://github.com/dnote/dnote/cli) and requires [Dnote Cloud](https://www.getdnote.com/pricing) account.
+
+## Hotkeys
+
+Write new notes without even moving your hands to the mouse.
+
+* **Ctrl + d** - Open the extension (**Ctrl + Shift + v** on Firefox on Linux).
+* **Shift + Enter** - Save the current note
+* **b** - Open the saved note in the browser
diff --git a/browser/assets/demo.gif b/browser/assets/demo.gif
new file mode 100644
index 00000000..b122a441
Binary files /dev/null and b/browser/assets/demo.gif differ
diff --git a/browser/gulpfile.js b/browser/gulpfile.js
new file mode 100644
index 00000000..ae3d262e
--- /dev/null
+++ b/browser/gulpfile.js
@@ -0,0 +1,100 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+const gulp = require('gulp');
+const del = require('del');
+const replace = require('gulp-replace');
+const gulpif = require('gulp-if');
+const imagemin = require('gulp-imagemin');
+const livereload = require('gulp-livereload');
+const zip = require('gulp-zip');
+
+const target = process.env.TARGET;
+
+gulp.task('manifest', () => {
+ const pkg = require('./package.json');
+
+ return gulp
+ .src(`manifests/${target}/manifest.json`)
+ .pipe(replace('__VERSION__', pkg.version))
+ .pipe(gulp.dest(`dist/${target}`));
+});
+
+gulp.task('styles', () => {
+ return gulp.src('src/styles/*.css').pipe(gulp.dest(`dist/${target}/styles`));
+});
+
+gulp.task(
+ 'html',
+ gulp.series('styles', () => {
+ return gulp.src('src/*.html').pipe(gulp.dest(`dist/${target}`));
+ })
+);
+
+gulp.task('images', () => {
+ return gulp
+ .src('src/images/**/*')
+ .pipe(
+ gulpif(
+ gulpif.isFile,
+ imagemin({
+ progressive: true,
+ interlaced: true,
+ svgoPlugins: [{ cleanupIDs: false }]
+ })
+ )
+ )
+ .pipe(gulp.dest(`dist/${target}/images`));
+});
+
+gulp.task(
+ 'clean',
+ del.bind(null, ['.tmp', `dist/${target}`, `package/${target}`])
+);
+
+gulp.task(
+ 'watch',
+ gulp.series('manifest', 'html', 'styles', 'images', () => {
+ livereload.listen();
+
+ gulp
+ .watch([
+ 'src/*.html',
+ 'src/scripts/**/*',
+ 'src/images/**/*',
+ 'src/styles/**/*'
+ ])
+ .on('change', livereload.reload);
+
+ gulp.watch('src/*.html', gulp.parallel('html'));
+ gulp.watch('manifests/**/*.json', gulp.parallel('manifest'));
+ })
+);
+
+gulp.task('package', function() {
+ const manifest = require(`./dist/${target}/manifest.json`);
+
+ return gulp
+ .src(`dist/${target}/**`)
+ .pipe(zip('dnote-' + manifest.version + '.zip'))
+ .pipe(gulp.dest(`package/${target}`));
+});
+
+gulp.task('build', gulp.series('manifest', gulp.parallel('html', 'images')));
+
+gulp.task('default', gulp.series('clean', 'build'));
diff --git a/browser/manifests/chrome/manifest.json b/browser/manifests/chrome/manifest.json
new file mode 100644
index 00000000..4b95c5dc
--- /dev/null
+++ b/browser/manifests/chrome/manifest.json
@@ -0,0 +1,31 @@
+{
+ "name": "Dnote",
+ "version": "__VERSION__",
+ "description": "Capture your microlessons without leaving the browser.",
+ "icons": {
+ "16": "images/iconx16.png",
+ "48": "images/iconx48.png",
+ "128": "images/iconx128.png"
+ },
+ "manifest_version": 2,
+ "browser_action": {
+ "default_icon": {
+ "16": "images/iconx16.png",
+ "32": "images/iconx32.png"
+ },
+ "default_popup": "popup.html"
+ },
+ "background": {
+ "scripts": []
+ },
+ "content_scripts": [],
+ "permissions": ["storage"],
+ "commands": {
+ "_execute_browser_action": {
+ "suggested_key": {
+ "default": "Ctrl+D",
+ "mac": "MacCtrl+D"
+ }
+ }
+ }
+}
diff --git a/browser/manifests/firefox/manifest.json b/browser/manifests/firefox/manifest.json
new file mode 100644
index 00000000..8175011f
--- /dev/null
+++ b/browser/manifests/firefox/manifest.json
@@ -0,0 +1,38 @@
+{
+ "name": "Dnote",
+ "version": "__VERSION__",
+ "description": "Capture your microlessons without leaving the browser.",
+ "applications": {
+ "gecko": {
+ "id": "sung@dnote.io",
+ "strict_min_version": "42.0"
+ }
+ },
+ "icons": {
+ "16": "images/iconx16.png",
+ "48": "images/iconx48.png",
+ "128": "images/iconx128.png"
+ },
+ "manifest_version": 2,
+ "browser_action": {
+ "default_icon": {
+ "16": "images/iconx16.png",
+ "32": "images/iconx32.png"
+ },
+ "default_popup": "popup.html"
+ },
+ "background": {
+ "scripts": []
+ },
+ "content_scripts": [],
+ "permissions": ["storage"],
+ "commands": {
+ "_execute_browser_action": {
+ "suggested_key": {
+ "default": "Ctrl+D",
+ "linux": "Ctrl+Shift+V",
+ "mac": "MacCtrl+D"
+ }
+ }
+ }
+}
diff --git a/browser/package-lock.json b/browser/package-lock.json
new file mode 100644
index 00000000..aa2336b1
--- /dev/null
+++ b/browser/package-lock.json
@@ -0,0 +1,10633 @@
+{
+ "name": "dnote-extension",
+ "version": "2.0.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/compat-data": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.12.7.tgz",
+ "integrity": "sha512-YaxPMGs/XIWtYqrdEOZOCPsVWfEoriXopnsz3/i7apYPXQ3698UFhS6dVT1KN5qOsWmVgw/FOrmQgpRaZayGsw==",
+ "dev": true
+ },
+ "@babel/core": {
+ "version": "7.12.9",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.9.tgz",
+ "integrity": "sha512-gTXYh3M5wb7FRXQy+FErKFAv90BnlOuNn1QkCK2lREoPAjrQCO49+HVSrFoe5uakFAF5eenS75KbO2vQiLrTMQ==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.12.5",
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helpers": "^7.12.5",
+ "@babel/parser": "^7.12.7",
+ "@babel/template": "^7.12.7",
+ "@babel/traverse": "^7.12.9",
+ "@babel/types": "^7.12.7",
+ "convert-source-map": "^1.7.0",
+ "debug": "^4.1.0",
+ "gensync": "^1.0.0-beta.1",
+ "json5": "^2.1.2",
+ "lodash": "^4.17.19",
+ "resolve": "^1.3.2",
+ "semver": "^5.4.1",
+ "source-map": "^0.5.0"
+ },
+ "dependencies": {
+ "convert-source-map": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
+ "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.1.1"
+ }
+ },
+ "debug": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
+ "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
+ "dev": true,
+ "requires": {
+ "ms": "2.1.2"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/generator": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz",
+ "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.5",
+ "jsesc": "^2.5.1",
+ "source-map": "^0.5.0"
+ }
+ },
+ "@babel/helper-annotate-as-pure": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz",
+ "integrity": "sha512-XQlqKQP4vXFB7BN8fEEerrmYvHp3fK/rBkRFz9jaJbzK0B1DSfej9Kc7ZzE8Z/OnId1jpJdNAZ3BFQjWG68rcA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-builder-binary-assignment-operator-visitor": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.4.tgz",
+ "integrity": "sha512-L0zGlFrGWZK4PbT8AszSfLTM5sDU1+Az/En9VrdT8/LmEiJt4zXt+Jve9DCAnQcbqDhCI+29y/L93mrDzddCcg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-explode-assignable-expression": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-compilation-targets": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.12.5.tgz",
+ "integrity": "sha512-+qH6NrscMolUlzOYngSBMIOQpKUGPPsc61Bu5W10mg84LxZ7cmvnBHzARKbDoFxVvqqAbj6Tg6N7bSrWSPXMyw==",
+ "dev": true,
+ "requires": {
+ "@babel/compat-data": "^7.12.5",
+ "@babel/helper-validator-option": "^7.12.1",
+ "browserslist": "^4.14.5",
+ "semver": "^5.5.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/helper-create-class-features-plugin": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.1.tgz",
+ "integrity": "sha512-hkL++rWeta/OVOBTRJc9a5Azh5mt5WgZUGAKMD8JM141YsE08K//bp1unBBieO6rUKkIPyUE0USQ30jAy3Sk1w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-member-expression-to-functions": "^7.12.1",
+ "@babel/helper-optimise-call-expression": "^7.10.4",
+ "@babel/helper-replace-supers": "^7.12.1",
+ "@babel/helper-split-export-declaration": "^7.10.4"
+ }
+ },
+ "@babel/helper-create-regexp-features-plugin": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.12.7.tgz",
+ "integrity": "sha512-idnutvQPdpbduutvi3JVfEgcVIHooQnhvhx0Nk9isOINOIGYkZea1Pk2JlJRiUnMefrlvr0vkByATBY/mB4vjQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.10.4",
+ "regexpu-core": "^4.7.1"
+ }
+ },
+ "@babel/helper-define-map": {
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz",
+ "integrity": "sha512-fMw4kgFB720aQFXSVaXr79pjjcW5puTCM16+rECJ/plGS+zByelE8l9nCpV1GibxTnFVmUuYG9U8wYfQHdzOEQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/types": "^7.10.5",
+ "lodash": "^4.17.19"
+ }
+ },
+ "@babel/helper-explode-assignable-expression": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.12.1.tgz",
+ "integrity": "sha512-dmUwH8XmlrUpVqgtZ737tK88v07l840z9j3OEhCLwKTkjlvKpfqXVIZ0wpK3aeOxspwGrf/5AP5qLx4rO3w5rA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.1"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-hoist-variables": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.10.4.tgz",
+ "integrity": "sha512-wljroF5PgCk2juF69kanHVs6vrLwIPNp6DLD+Lrl3hoQ3PpPPikaDRNFA+0t81NOoMt2DL6WW/mdU8k4k6ZzuA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-member-expression-to-functions": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.7.tgz",
+ "integrity": "sha512-DCsuPyeWxeHgh1Dus7APn7iza42i/qXqiFPWyBDdOFtvS581JQePsc1F/nD+fHrcswhLlRc2UpYS1NwERxZhHw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/helper-module-imports": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz",
+ "integrity": "sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA==",
+ "requires": {
+ "@babel/types": "^7.12.5"
+ }
+ },
+ "@babel/helper-module-transforms": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz",
+ "integrity": "sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-imports": "^7.12.1",
+ "@babel/helper-replace-supers": "^7.12.1",
+ "@babel/helper-simple-access": "^7.12.1",
+ "@babel/helper-split-export-declaration": "^7.11.0",
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/traverse": "^7.12.1",
+ "@babel/types": "^7.12.1",
+ "lodash": "^4.17.19"
+ }
+ },
+ "@babel/helper-optimise-call-expression": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.7.tgz",
+ "integrity": "sha512-I5xc9oSJ2h59OwyUqjv95HRyzxj53DAubUERgQMrpcCEYQyToeHA+NEcUEsVWB4j53RDeskeBJ0SgRAYHDBckw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ },
+ "@babel/helper-remap-async-to-generator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.12.1.tgz",
+ "integrity": "sha512-9d0KQCRM8clMPcDwo8SevNs+/9a8yWVVmaE80FGJcEP8N1qToREmWEGnBn8BUlJhYRFz6fqxeRL1sl5Ogsed7A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.10.4",
+ "@babel/helper-wrap-function": "^7.10.4",
+ "@babel/types": "^7.12.1"
+ }
+ },
+ "@babel/helper-replace-supers": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz",
+ "integrity": "sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-member-expression-to-functions": "^7.12.1",
+ "@babel/helper-optimise-call-expression": "^7.10.4",
+ "@babel/traverse": "^7.12.5",
+ "@babel/types": "^7.12.5"
+ }
+ },
+ "@babel/helper-simple-access": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz",
+ "integrity": "sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.1"
+ }
+ },
+ "@babel/helper-skip-transparent-expression-wrappers": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.12.1.tgz",
+ "integrity": "sha512-Mf5AUuhG1/OCChOJ/HcADmvcHM42WJockombn8ATJG3OnyiSxBK/Mm5x78BQWvmtXZKHgbjdGL2kin/HOLlZGA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.1"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
+ "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.11.0"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw=="
+ },
+ "@babel/helper-validator-option": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.1.tgz",
+ "integrity": "sha512-YpJabsXlJVWP0USHjnC/AQDTLlZERbON577YUVO/wLpqyj6HAtVYnWaQaN0iUN+1/tWn3c+uKKXjRut5115Y2A==",
+ "dev": true
+ },
+ "@babel/helper-wrap-function": {
+ "version": "7.12.3",
+ "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.12.3.tgz",
+ "integrity": "sha512-Cvb8IuJDln3rs6tzjW3Y8UeelAOdnpB8xtQ4sme2MSZ9wOxrbThporC0y/EtE16VAtoyEfLM404Xr1e0OOp+ow==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/traverse": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helpers": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.12.5.tgz",
+ "integrity": "sha512-lgKGMQlKqA8meJqKsW6rUnc4MdUk35Ln0ATDqdM1a/UpARODdI4j5Y5lVfUScnSNkJcdCRAaWkspykNoFg9sJA==",
+ "dev": true,
+ "requires": {
+ "@babel/template": "^7.10.4",
+ "@babel/traverse": "^7.12.5",
+ "@babel/types": "^7.12.5"
+ }
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==",
+ "dev": true
+ },
+ "@babel/plugin-proposal-async-generator-functions": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.1.tgz",
+ "integrity": "sha512-d+/o30tJxFxrA1lhzJqiUcEJdI6jKlNregCv5bASeGf2Q4MXmnwH7viDo7nhx1/ohf09oaH8j1GVYG/e3Yqk6A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-remap-async-to-generator": "^7.12.1",
+ "@babel/plugin-syntax-async-generators": "^7.8.0"
+ }
+ },
+ "@babel/plugin-proposal-class-properties": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.1.tgz",
+ "integrity": "sha512-cKp3dlQsFsEs5CWKnN7BnSHOd0EOW8EKpEjkoz1pO2E5KzIDNV9Ros1b0CnmbVgAGXJubOYVBOGCT1OmJwOI7w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-class-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-proposal-dynamic-import": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.12.1.tgz",
+ "integrity": "sha512-a4rhUSZFuq5W8/OO8H7BL5zspjnc1FLd9hlOxIK/f7qG4a0qsqk8uvF/ywgBA8/OmjsapjpvaEOYItfGG1qIvQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-dynamic-import": "^7.8.0"
+ }
+ },
+ "@babel/plugin-proposal-export-namespace-from": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.12.1.tgz",
+ "integrity": "sha512-6CThGf0irEkzujYS5LQcjBx8j/4aQGiVv7J9+2f7pGfxqyKh3WnmVJYW3hdrQjyksErMGBPQrCnHfOtna+WLbw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-export-namespace-from": "^7.8.3"
+ }
+ },
+ "@babel/plugin-proposal-json-strings": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.12.1.tgz",
+ "integrity": "sha512-GoLDUi6U9ZLzlSda2Df++VSqDJg3CG+dR0+iWsv6XRw1rEq+zwt4DirM9yrxW6XWaTpmai1cWJLMfM8qQJf+yw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-json-strings": "^7.8.0"
+ }
+ },
+ "@babel/plugin-proposal-logical-assignment-operators": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.12.1.tgz",
+ "integrity": "sha512-k8ZmVv0JU+4gcUGeCDZOGd0lCIamU/sMtIiX3UWnUc5yzgq6YUGyEolNYD+MLYKfSzgECPcqetVcJP9Afe/aCA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4"
+ }
+ },
+ "@babel/plugin-proposal-nullish-coalescing-operator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.12.1.tgz",
+ "integrity": "sha512-nZY0ESiaQDI1y96+jk6VxMOaL4LPo/QDHBqL+SF3/vl6dHkTwHlOI8L4ZwuRBHgakRBw5zsVylel7QPbbGuYgg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0"
+ }
+ },
+ "@babel/plugin-proposal-numeric-separator": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.12.7.tgz",
+ "integrity": "sha512-8c+uy0qmnRTeukiGsjLGy6uVs/TFjJchGXUeBqlG4VWYOdJWkhhVPdQ3uHwbmalfJwv2JsV0qffXP4asRfL2SQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-numeric-separator": "^7.10.4"
+ }
+ },
+ "@babel/plugin-proposal-object-rest-spread": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.12.1.tgz",
+ "integrity": "sha512-s6SowJIjzlhx8o7lsFx5zmY4At6CTtDvgNQDdPzkBQucle58A6b/TTeEBYtyDgmcXjUTM+vE8YOGHZzzbc/ioA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-object-rest-spread": "^7.8.0",
+ "@babel/plugin-transform-parameters": "^7.12.1"
+ }
+ },
+ "@babel/plugin-proposal-optional-catch-binding": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.12.1.tgz",
+ "integrity": "sha512-hFvIjgprh9mMw5v42sJWLI1lzU5L2sznP805zeT6rySVRA0Y18StRhDqhSxlap0oVgItRsB6WSROp4YnJTJz0g==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-optional-catch-binding": "^7.8.0"
+ }
+ },
+ "@babel/plugin-proposal-optional-chaining": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.12.7.tgz",
+ "integrity": "sha512-4ovylXZ0PWmwoOvhU2vhnzVNnm88/Sm9nx7V8BPgMvAzn5zDou3/Awy0EjglyubVHasJj+XCEkr/r1X3P5elCA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1",
+ "@babel/plugin-syntax-optional-chaining": "^7.8.0"
+ }
+ },
+ "@babel/plugin-proposal-private-methods": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.1.tgz",
+ "integrity": "sha512-mwZ1phvH7/NHK6Kf8LP7MYDogGV+DKB1mryFOEwx5EBNQrosvIczzZFTUmWaeujd5xT6G1ELYWUz3CutMhjE1w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-class-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-proposal-unicode-property-regex": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.12.1.tgz",
+ "integrity": "sha512-MYq+l+PvHuw/rKUz1at/vb6nCnQ2gmJBNaM62z0OgH7B2W1D9pvkpYtlti9bGtizNIU1K3zm4bZF9F91efVY0w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-syntax-async-generators": {
+ "version": "7.8.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz",
+ "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-class-properties": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.1.tgz",
+ "integrity": "sha512-U40A76x5gTwmESz+qiqssqmeEsKvcSyvtgktrm0uzcARAmM9I1jR221f6Oq+GmHrcD+LvZDag1UTOTe2fL3TeA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-syntax-dynamic-import": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz",
+ "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-export-namespace-from": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz",
+ "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.3"
+ }
+ },
+ "@babel/plugin-syntax-json-strings": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz",
+ "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-logical-assignment-operators": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz",
+ "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-syntax-nullish-coalescing-operator": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz",
+ "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-numeric-separator": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz",
+ "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-syntax-object-rest-spread": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz",
+ "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-optional-catch-binding": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz",
+ "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-optional-chaining": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz",
+ "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-top-level-await": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.1.tgz",
+ "integrity": "sha512-i7ooMZFS+a/Om0crxZodrTzNEPJHZrlMVGMTEpFAj6rYY/bKCddB0Dk/YxfPuYXOopuhKk/e1jV6h+WUU9XN3A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-arrow-functions": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.12.1.tgz",
+ "integrity": "sha512-5QB50qyN44fzzz4/qxDPQMBCTHgxg3n0xRBLJUmBlLoU/sFvxVWGZF/ZUfMVDQuJUKXaBhbupxIzIfZ6Fwk/0A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-async-to-generator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.12.1.tgz",
+ "integrity": "sha512-SDtqoEcarK1DFlRJ1hHRY5HvJUj5kX4qmtpMAm2QnhOlyuMC4TMdCRgW6WXpv93rZeYNeLP22y8Aq2dbcDRM1A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-imports": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-remap-async-to-generator": "^7.12.1"
+ }
+ },
+ "@babel/plugin-transform-block-scoped-functions": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.12.1.tgz",
+ "integrity": "sha512-5OpxfuYnSgPalRpo8EWGPzIYf0lHBWORCkj5M0oLBwHdlux9Ri36QqGW3/LR13RSVOAoUUMzoPI/jpE4ABcHoA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-block-scoping": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.1.tgz",
+ "integrity": "sha512-zJyAC9sZdE60r1nVQHblcfCj29Dh2Y0DOvlMkcqSo0ckqjiCwNiUezUKw+RjOCwGfpLRwnAeQ2XlLpsnGkvv9w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-classes": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.12.1.tgz",
+ "integrity": "sha512-/74xkA7bVdzQTBeSUhLLJgYIcxw/dpEpCdRDiHgPJ3Mv6uC11UhjpOhl72CgqbBCmt1qtssCyB2xnJm1+PFjog==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.10.4",
+ "@babel/helper-define-map": "^7.10.4",
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-optimise-call-expression": "^7.10.4",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-replace-supers": "^7.12.1",
+ "@babel/helper-split-export-declaration": "^7.10.4",
+ "globals": "^11.1.0"
+ }
+ },
+ "@babel/plugin-transform-computed-properties": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.12.1.tgz",
+ "integrity": "sha512-vVUOYpPWB7BkgUWPo4C44mUQHpTZXakEqFjbv8rQMg7TC6S6ZhGZ3otQcRH6u7+adSlE5i0sp63eMC/XGffrzg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-destructuring": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.12.1.tgz",
+ "integrity": "sha512-fRMYFKuzi/rSiYb2uRLiUENJOKq4Gnl+6qOv5f8z0TZXg3llUwUhsNNwrwaT/6dUhJTzNpBr+CUvEWBtfNY1cw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-dotall-regex": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.12.1.tgz",
+ "integrity": "sha512-B2pXeRKoLszfEW7J4Hg9LoFaWEbr/kzo3teWHmtFCszjRNa/b40f9mfeqZsIDLLt/FjwQ6pz/Gdlwy85xNckBA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-duplicate-keys": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.12.1.tgz",
+ "integrity": "sha512-iRght0T0HztAb/CazveUpUQrZY+aGKKaWXMJ4uf9YJtqxSUe09j3wteztCUDRHs+SRAL7yMuFqUsLoAKKzgXjw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-exponentiation-operator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.12.1.tgz",
+ "integrity": "sha512-7tqwy2bv48q+c1EHbXK0Zx3KXd2RVQp6OC7PbwFNt/dPTAV3Lu5sWtWuAj8owr5wqtWnqHfl2/mJlUmqkChKug==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-builder-binary-assignment-operator-visitor": "^7.10.4",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-for-of": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.12.1.tgz",
+ "integrity": "sha512-Zaeq10naAsuHo7heQvyV0ptj4dlZJwZgNAtBYBnu5nNKJoW62m0zKcIEyVECrUKErkUkg6ajMy4ZfnVZciSBhg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-function-name": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.12.1.tgz",
+ "integrity": "sha512-JF3UgJUILoFrFMEnOJLJkRHSk6LUSXLmEFsA23aR2O5CSLUxbeUX1IZ1YQ7Sn0aXb601Ncwjx73a+FVqgcljVw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-literals": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.12.1.tgz",
+ "integrity": "sha512-+PxVGA+2Ag6uGgL0A5f+9rklOnnMccwEBzwYFL3EUaKuiyVnUipyXncFcfjSkbimLrODoqki1U9XxZzTvfN7IQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-member-expression-literals": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.12.1.tgz",
+ "integrity": "sha512-1sxePl6z9ad0gFMB9KqmYofk34flq62aqMt9NqliS/7hPEpURUCMbyHXrMPlo282iY7nAvUB1aQd5mg79UD9Jg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-modules-amd": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.12.1.tgz",
+ "integrity": "sha512-tDW8hMkzad5oDtzsB70HIQQRBiTKrhfgwC/KkJeGsaNFTdWhKNt/BiE8c5yj19XiGyrxpbkOfH87qkNg1YGlOQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "babel-plugin-dynamic-import-node": "^2.3.3"
+ }
+ },
+ "@babel/plugin-transform-modules-commonjs": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.12.1.tgz",
+ "integrity": "sha512-dY789wq6l0uLY8py9c1B48V8mVL5gZh/+PQ5ZPrylPYsnAvnEMjqsUXkuoDVPeVK+0VyGar+D08107LzDQ6pag==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-simple-access": "^7.12.1",
+ "babel-plugin-dynamic-import-node": "^2.3.3"
+ }
+ },
+ "@babel/plugin-transform-modules-systemjs": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.12.1.tgz",
+ "integrity": "sha512-Hn7cVvOavVh8yvW6fLwveFqSnd7rbQN3zJvoPNyNaQSvgfKmDBO9U1YL9+PCXGRlZD9tNdWTy5ACKqMuzyn32Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-hoist-variables": "^7.10.4",
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "babel-plugin-dynamic-import-node": "^2.3.3"
+ }
+ },
+ "@babel/plugin-transform-modules-umd": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.12.1.tgz",
+ "integrity": "sha512-aEIubCS0KHKM0zUos5fIoQm+AZUMt1ZvMpqz0/H5qAQ7vWylr9+PLYurT+Ic7ID/bKLd4q8hDovaG3Zch2uz5Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-named-capturing-groups-regex": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.12.1.tgz",
+ "integrity": "sha512-tB43uQ62RHcoDp9v2Nsf+dSM8sbNodbEicbQNA53zHz8pWUhsgHSJCGpt7daXxRydjb0KnfmB+ChXOv3oADp1Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.12.1"
+ }
+ },
+ "@babel/plugin-transform-new-target": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.12.1.tgz",
+ "integrity": "sha512-+eW/VLcUL5L9IvJH7rT1sT0CzkdUTvPrXC2PXTn/7z7tXLBuKvezYbGdxD5WMRoyvyaujOq2fWoKl869heKjhw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-object-super": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.12.1.tgz",
+ "integrity": "sha512-AvypiGJH9hsquNUn+RXVcBdeE3KHPZexWRdimhuV59cSoOt5kFBmqlByorAeUlGG2CJWd0U+4ZtNKga/TB0cAw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-replace-supers": "^7.12.1"
+ }
+ },
+ "@babel/plugin-transform-parameters": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.12.1.tgz",
+ "integrity": "sha512-xq9C5EQhdPK23ZeCdMxl8bbRnAgHFrw5EOC3KJUsSylZqdkCaFEXxGSBuTSObOpiiHHNyb82es8M1QYgfQGfNg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-property-literals": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.12.1.tgz",
+ "integrity": "sha512-6MTCR/mZ1MQS+AwZLplX4cEySjCpnIF26ToWo942nqn8hXSm7McaHQNeGx/pt7suI1TWOWMfa/NgBhiqSnX0cQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-regenerator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.12.1.tgz",
+ "integrity": "sha512-gYrHqs5itw6i4PflFX3OdBPMQdPbF4bj2REIUxlMRUFk0/ZOAIpDFuViuxPjUL7YC8UPnf+XG7/utJvqXdPKng==",
+ "dev": true,
+ "requires": {
+ "regenerator-transform": "^0.14.2"
+ }
+ },
+ "@babel/plugin-transform-reserved-words": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.12.1.tgz",
+ "integrity": "sha512-pOnUfhyPKvZpVyBHhSBoX8vfA09b7r00Pmm1sH+29ae2hMTKVmSp4Ztsr8KBKjLjx17H0eJqaRC3bR2iThM54A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-shorthand-properties": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.12.1.tgz",
+ "integrity": "sha512-GFZS3c/MhX1OusqB1MZ1ct2xRzX5ppQh2JU1h2Pnfk88HtFTM+TWQqJNfwkmxtPQtb/s1tk87oENfXJlx7rSDw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-spread": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.12.1.tgz",
+ "integrity": "sha512-vuLp8CP0BE18zVYjsEBZ5xoCecMK6LBMMxYzJnh01rxQRvhNhH1csMMmBfNo5tGpGO+NhdSNW2mzIvBu3K1fng==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1"
+ }
+ },
+ "@babel/plugin-transform-sticky-regex": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.12.7.tgz",
+ "integrity": "sha512-VEiqZL5N/QvDbdjfYQBhruN0HYjSPjC4XkeqW4ny/jNtH9gcbgaqBIXYEZCNnESMAGs0/K/R7oFGMhOyu/eIxg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-template-literals": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.12.1.tgz",
+ "integrity": "sha512-b4Zx3KHi+taXB1dVRBhVJtEPi9h1THCeKmae2qP0YdUHIFhVjtpqqNfxeVAa1xeHVhAy4SbHxEwx5cltAu5apw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-typeof-symbol": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.12.1.tgz",
+ "integrity": "sha512-EPGgpGy+O5Kg5pJFNDKuxt9RdmTgj5sgrus2XVeMp/ZIbOESadgILUbm50SNpghOh3/6yrbsH+NB5+WJTmsA7Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-unicode-escapes": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.12.1.tgz",
+ "integrity": "sha512-I8gNHJLIc7GdApm7wkVnStWssPNbSRMPtgHdmH3sRM1zopz09UWPS4x5V4n1yz/MIWTVnJ9sp6IkuXdWM4w+2Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-transform-unicode-regex": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.12.1.tgz",
+ "integrity": "sha512-SqH4ClNngh/zGwHZOOQMTD+e8FGWexILV+ePMyiDJttAWRh5dhDL8rcl5lSgU3Huiq6Zn6pWTMvdPAb21Dwdyg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/preset-env": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.12.7.tgz",
+ "integrity": "sha512-OnNdfAr1FUQg7ksb7bmbKoby4qFOHw6DKWWUNB9KqnnCldxhxJlP+21dpyaWFmf2h0rTbOkXJtAGevY3XW1eew==",
+ "dev": true,
+ "requires": {
+ "@babel/compat-data": "^7.12.7",
+ "@babel/helper-compilation-targets": "^7.12.5",
+ "@babel/helper-module-imports": "^7.12.5",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-validator-option": "^7.12.1",
+ "@babel/plugin-proposal-async-generator-functions": "^7.12.1",
+ "@babel/plugin-proposal-class-properties": "^7.12.1",
+ "@babel/plugin-proposal-dynamic-import": "^7.12.1",
+ "@babel/plugin-proposal-export-namespace-from": "^7.12.1",
+ "@babel/plugin-proposal-json-strings": "^7.12.1",
+ "@babel/plugin-proposal-logical-assignment-operators": "^7.12.1",
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
+ "@babel/plugin-proposal-numeric-separator": "^7.12.7",
+ "@babel/plugin-proposal-object-rest-spread": "^7.12.1",
+ "@babel/plugin-proposal-optional-catch-binding": "^7.12.1",
+ "@babel/plugin-proposal-optional-chaining": "^7.12.7",
+ "@babel/plugin-proposal-private-methods": "^7.12.1",
+ "@babel/plugin-proposal-unicode-property-regex": "^7.12.1",
+ "@babel/plugin-syntax-async-generators": "^7.8.0",
+ "@babel/plugin-syntax-class-properties": "^7.12.1",
+ "@babel/plugin-syntax-dynamic-import": "^7.8.0",
+ "@babel/plugin-syntax-export-namespace-from": "^7.8.3",
+ "@babel/plugin-syntax-json-strings": "^7.8.0",
+ "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4",
+ "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0",
+ "@babel/plugin-syntax-numeric-separator": "^7.10.4",
+ "@babel/plugin-syntax-object-rest-spread": "^7.8.0",
+ "@babel/plugin-syntax-optional-catch-binding": "^7.8.0",
+ "@babel/plugin-syntax-optional-chaining": "^7.8.0",
+ "@babel/plugin-syntax-top-level-await": "^7.12.1",
+ "@babel/plugin-transform-arrow-functions": "^7.12.1",
+ "@babel/plugin-transform-async-to-generator": "^7.12.1",
+ "@babel/plugin-transform-block-scoped-functions": "^7.12.1",
+ "@babel/plugin-transform-block-scoping": "^7.12.1",
+ "@babel/plugin-transform-classes": "^7.12.1",
+ "@babel/plugin-transform-computed-properties": "^7.12.1",
+ "@babel/plugin-transform-destructuring": "^7.12.1",
+ "@babel/plugin-transform-dotall-regex": "^7.12.1",
+ "@babel/plugin-transform-duplicate-keys": "^7.12.1",
+ "@babel/plugin-transform-exponentiation-operator": "^7.12.1",
+ "@babel/plugin-transform-for-of": "^7.12.1",
+ "@babel/plugin-transform-function-name": "^7.12.1",
+ "@babel/plugin-transform-literals": "^7.12.1",
+ "@babel/plugin-transform-member-expression-literals": "^7.12.1",
+ "@babel/plugin-transform-modules-amd": "^7.12.1",
+ "@babel/plugin-transform-modules-commonjs": "^7.12.1",
+ "@babel/plugin-transform-modules-systemjs": "^7.12.1",
+ "@babel/plugin-transform-modules-umd": "^7.12.1",
+ "@babel/plugin-transform-named-capturing-groups-regex": "^7.12.1",
+ "@babel/plugin-transform-new-target": "^7.12.1",
+ "@babel/plugin-transform-object-super": "^7.12.1",
+ "@babel/plugin-transform-parameters": "^7.12.1",
+ "@babel/plugin-transform-property-literals": "^7.12.1",
+ "@babel/plugin-transform-regenerator": "^7.12.1",
+ "@babel/plugin-transform-reserved-words": "^7.12.1",
+ "@babel/plugin-transform-shorthand-properties": "^7.12.1",
+ "@babel/plugin-transform-spread": "^7.12.1",
+ "@babel/plugin-transform-sticky-regex": "^7.12.7",
+ "@babel/plugin-transform-template-literals": "^7.12.1",
+ "@babel/plugin-transform-typeof-symbol": "^7.12.1",
+ "@babel/plugin-transform-unicode-escapes": "^7.12.1",
+ "@babel/plugin-transform-unicode-regex": "^7.12.1",
+ "@babel/preset-modules": "^0.1.3",
+ "@babel/types": "^7.12.7",
+ "core-js-compat": "^3.7.0",
+ "semver": "^5.5.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/preset-modules": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.4.tgz",
+ "integrity": "sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/plugin-proposal-unicode-property-regex": "^7.4.4",
+ "@babel/plugin-transform-dotall-regex": "^7.4.4",
+ "@babel/types": "^7.4.4",
+ "esutils": "^2.0.2"
+ }
+ },
+ "@babel/runtime": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz",
+ "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==",
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.12.9",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
+ "integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.12.5",
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-split-export-declaration": "^7.11.0",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.19"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
+ "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
+ "dev": true,
+ "requires": {
+ "ms": "2.1.2"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ },
+ "@emotion/cache": {
+ "version": "10.0.29",
+ "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-10.0.29.tgz",
+ "integrity": "sha512-fU2VtSVlHiF27empSbxi1O2JFdNWZO+2NFHfwO0pxgTep6Xa3uGb+3pVKfLww2l/IBGLNEZl5Xf/++A4wAYDYQ==",
+ "requires": {
+ "@emotion/sheet": "0.9.4",
+ "@emotion/stylis": "0.8.5",
+ "@emotion/utils": "0.11.3",
+ "@emotion/weak-memoize": "0.2.5"
+ }
+ },
+ "@emotion/core": {
+ "version": "10.1.1",
+ "resolved": "https://registry.npmjs.org/@emotion/core/-/core-10.1.1.tgz",
+ "integrity": "sha512-ZMLG6qpXR8x031NXD8HJqugy/AZSkAuMxxqB46pmAR7ze47MhNJ56cdoX243QPZdGctrdfo+s08yZTiwaUcRKA==",
+ "requires": {
+ "@babel/runtime": "^7.5.5",
+ "@emotion/cache": "^10.0.27",
+ "@emotion/css": "^10.0.27",
+ "@emotion/serialize": "^0.11.15",
+ "@emotion/sheet": "0.9.4",
+ "@emotion/utils": "0.11.3"
+ }
+ },
+ "@emotion/css": {
+ "version": "10.0.27",
+ "resolved": "https://registry.npmjs.org/@emotion/css/-/css-10.0.27.tgz",
+ "integrity": "sha512-6wZjsvYeBhyZQYNrGoR5yPMYbMBNEnanDrqmsqS1mzDm1cOTu12shvl2j4QHNS36UaTE0USIJawCH9C8oW34Zw==",
+ "requires": {
+ "@emotion/serialize": "^0.11.15",
+ "@emotion/utils": "0.11.3",
+ "babel-plugin-emotion": "^10.0.27"
+ }
+ },
+ "@emotion/hash": {
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz",
+ "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow=="
+ },
+ "@emotion/memoize": {
+ "version": "0.7.4",
+ "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz",
+ "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw=="
+ },
+ "@emotion/serialize": {
+ "version": "0.11.16",
+ "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.16.tgz",
+ "integrity": "sha512-G3J4o8by0VRrO+PFeSc3js2myYNOXVJ3Ya+RGVxnshRYgsvErfAOglKAiy1Eo1vhzxqtUvjCyS5gtewzkmvSSg==",
+ "requires": {
+ "@emotion/hash": "0.8.0",
+ "@emotion/memoize": "0.7.4",
+ "@emotion/unitless": "0.7.5",
+ "@emotion/utils": "0.11.3",
+ "csstype": "^2.5.7"
+ },
+ "dependencies": {
+ "csstype": {
+ "version": "2.6.14",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.14.tgz",
+ "integrity": "sha512-2mSc+VEpGPblzAxyeR+vZhJKgYg0Og0nnRi7pmRXFYYxSfnOnW8A5wwQb4n4cE2nIOzqKOAzLCaEX6aBmNEv8A=="
+ }
+ }
+ },
+ "@emotion/sheet": {
+ "version": "0.9.4",
+ "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-0.9.4.tgz",
+ "integrity": "sha512-zM9PFmgVSqBw4zL101Q0HrBVTGmpAxFZH/pYx/cjJT5advXguvcgjHFTCaIO3enL/xr89vK2bh0Mfyj9aa0ANA=="
+ },
+ "@emotion/stylis": {
+ "version": "0.8.5",
+ "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz",
+ "integrity": "sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ=="
+ },
+ "@emotion/unitless": {
+ "version": "0.7.5",
+ "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz",
+ "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg=="
+ },
+ "@emotion/utils": {
+ "version": "0.11.3",
+ "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-0.11.3.tgz",
+ "integrity": "sha512-0o4l6pZC+hI88+bzuaX/6BgOvQVhbt2PfmxauVaYOGgbsAw14wdKyvMCZXnsnsHys94iadcF+RG/wZyx6+ZZBw=="
+ },
+ "@emotion/weak-memoize": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz",
+ "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA=="
+ },
+ "@nodelib/fs.scandir": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.2.tgz",
+ "integrity": "sha512-wrIBsjA5pl13f0RN4Zx4FNWmU71lv03meGKnqRUoCyan17s4V3WL92f3w3AIuWbNnpcrQyFBU5qMavJoB8d27w==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.stat": "2.0.2",
+ "run-parallel": "^1.1.9"
+ },
+ "dependencies": {
+ "@nodelib/fs.stat": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.2.tgz",
+ "integrity": "sha512-z8+wGWV2dgUhLqrtRYa03yDx4HWMvXKi1z8g3m2JyxAx8F7xk74asqPk5LAETjqDSGLFML/6CDl0+yFunSYicw==",
+ "dev": true
+ }
+ }
+ },
+ "@nodelib/fs.walk": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.3.tgz",
+ "integrity": "sha512-l6t8xEhfK9Sa4YO5mIRdau7XSOADfmh3jCr0evNHdY+HNkW6xuQhgMH7D73VV6WpZOagrW0UludvMTiifiwTfA==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.scandir": "2.1.2",
+ "fastq": "^1.6.0"
+ }
+ },
+ "@sindresorhus/is": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz",
+ "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==",
+ "dev": true,
+ "optional": true
+ },
+ "@types/events": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz",
+ "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==",
+ "dev": true
+ },
+ "@types/glob": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
+ "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==",
+ "dev": true,
+ "requires": {
+ "@types/events": "*",
+ "@types/minimatch": "*",
+ "@types/node": "*"
+ }
+ },
+ "@types/minimatch": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
+ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
+ "dev": true
+ },
+ "@types/node": {
+ "version": "12.7.5",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz",
+ "integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==",
+ "dev": true
+ },
+ "@types/parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA=="
+ },
+ "@types/prop-types": {
+ "version": "15.7.3",
+ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",
+ "integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==",
+ "dev": true
+ },
+ "@types/q": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz",
+ "integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==",
+ "dev": true,
+ "optional": true
+ },
+ "@types/react": {
+ "version": "16.14.2",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.2.tgz",
+ "integrity": "sha512-BzzcAlyDxXl2nANlabtT4thtvbbnhee8hMmH/CcJrISDBVcJS1iOsP1f0OAgSdGE0MsY9tqcrb9YoZcOFv9dbQ==",
+ "dev": true,
+ "requires": {
+ "@types/prop-types": "*",
+ "csstype": "^3.0.2"
+ }
+ },
+ "@types/react-dom": {
+ "version": "16.9.10",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.10.tgz",
+ "integrity": "sha512-ItatOrnXDMAYpv6G8UCk2VhbYVTjZT9aorLtA/OzDN9XJ2GKcfam68jutoAcILdRjsRUO8qb7AmyObF77Q8QFw==",
+ "dev": true,
+ "requires": {
+ "@types/react": "^16"
+ }
+ },
+ "@webassemblyjs/ast": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz",
+ "integrity": "sha512-C6wW5L+b7ogSDVqymbkkvuW9kruN//YisMED04xzeBBqjHa2FYnmvOlS6Xj68xWQRgWvI9cIglsjFowH/RJyEA==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/helper-module-context": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/wast-parser": "1.9.0"
+ }
+ },
+ "@webassemblyjs/floating-point-hex-parser": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.9.0.tgz",
+ "integrity": "sha512-TG5qcFsS8QB4g4MhrxK5TqfdNe7Ey/7YL/xN+36rRjl/BlGE/NcBvJcqsRgCP6Z92mRE+7N50pRIi8SmKUbcQA==",
+ "dev": true
+ },
+ "@webassemblyjs/helper-api-error": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.9.0.tgz",
+ "integrity": "sha512-NcMLjoFMXpsASZFxJ5h2HZRcEhDkvnNFOAKneP5RbKRzaWJN36NC4jqQHKwStIhGXu5mUWlUUk7ygdtrO8lbmw==",
+ "dev": true
+ },
+ "@webassemblyjs/helper-buffer": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.9.0.tgz",
+ "integrity": "sha512-qZol43oqhq6yBPx7YM3m9Bv7WMV9Eevj6kMi6InKOuZxhw+q9hOkvq5e/PpKSiLfyetpaBnogSbNCfBwyB00CA==",
+ "dev": true
+ },
+ "@webassemblyjs/helper-code-frame": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.9.0.tgz",
+ "integrity": "sha512-ERCYdJBkD9Vu4vtjUYe8LZruWuNIToYq/ME22igL+2vj2dQ2OOujIZr3MEFvfEaqKoVqpsFKAGsRdBSBjrIvZA==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/wast-printer": "1.9.0"
+ }
+ },
+ "@webassemblyjs/helper-fsm": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.9.0.tgz",
+ "integrity": "sha512-OPRowhGbshCb5PxJ8LocpdX9Kl0uB4XsAjl6jH/dWKlk/mzsANvhwbiULsaiqT5GZGT9qinTICdj6PLuM5gslw==",
+ "dev": true
+ },
+ "@webassemblyjs/helper-module-context": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.9.0.tgz",
+ "integrity": "sha512-MJCW8iGC08tMk2enck1aPW+BE5Cw8/7ph/VGZxwyvGbJwjktKkDK7vy7gAmMDx88D7mhDTCNKAW5tED+gZ0W8g==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0"
+ }
+ },
+ "@webassemblyjs/helper-wasm-bytecode": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.9.0.tgz",
+ "integrity": "sha512-R7FStIzyNcd7xKxCZH5lE0Bqy+hGTwS3LJjuv1ZVxd9O7eHCedSdrId/hMOd20I+v8wDXEn+bjfKDLzTepoaUw==",
+ "dev": true
+ },
+ "@webassemblyjs/helper-wasm-section": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.9.0.tgz",
+ "integrity": "sha512-XnMB8l3ek4tvrKUUku+IVaXNHz2YsJyOOmz+MMkZvh8h1uSJpSen6vYnw3IoQ7WwEuAhL8Efjms1ZWjqh2agvw==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-buffer": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/wasm-gen": "1.9.0"
+ }
+ },
+ "@webassemblyjs/ieee754": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.9.0.tgz",
+ "integrity": "sha512-dcX8JuYU/gvymzIHc9DgxTzUUTLexWwt8uCTWP3otys596io0L5aW02Gb1RjYpx2+0Jus1h4ZFqjla7umFniTg==",
+ "dev": true,
+ "requires": {
+ "@xtuc/ieee754": "^1.2.0"
+ }
+ },
+ "@webassemblyjs/leb128": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.9.0.tgz",
+ "integrity": "sha512-ENVzM5VwV1ojs9jam6vPys97B/S65YQtv/aanqnU7D8aSoHFX8GyhGg0CMfyKNIHBuAVjy3tlzd5QMMINa7wpw==",
+ "dev": true,
+ "requires": {
+ "@xtuc/long": "4.2.2"
+ }
+ },
+ "@webassemblyjs/utf8": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.9.0.tgz",
+ "integrity": "sha512-GZbQlWtopBTP0u7cHrEx+73yZKrQoBMpwkGEIqlacljhXCkVM1kMQge/Mf+csMJAjEdSwhOyLAS0AoR3AG5P8w==",
+ "dev": true
+ },
+ "@webassemblyjs/wasm-edit": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.9.0.tgz",
+ "integrity": "sha512-FgHzBm80uwz5M8WKnMTn6j/sVbqilPdQXTWraSjBwFXSYGirpkSWE2R9Qvz9tNiTKQvoKILpCuTjBKzOIm0nxw==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-buffer": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/helper-wasm-section": "1.9.0",
+ "@webassemblyjs/wasm-gen": "1.9.0",
+ "@webassemblyjs/wasm-opt": "1.9.0",
+ "@webassemblyjs/wasm-parser": "1.9.0",
+ "@webassemblyjs/wast-printer": "1.9.0"
+ }
+ },
+ "@webassemblyjs/wasm-gen": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.9.0.tgz",
+ "integrity": "sha512-cPE3o44YzOOHvlsb4+E9qSqjc9Qf9Na1OO/BHFy4OI91XDE14MjFN4lTMezzaIWdPqHnsTodGGNP+iRSYfGkjA==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/ieee754": "1.9.0",
+ "@webassemblyjs/leb128": "1.9.0",
+ "@webassemblyjs/utf8": "1.9.0"
+ }
+ },
+ "@webassemblyjs/wasm-opt": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.9.0.tgz",
+ "integrity": "sha512-Qkjgm6Anhm+OMbIL0iokO7meajkzQD71ioelnfPEj6r4eOFuqm4YC3VBPqXjFyyNwowzbMD+hizmprP/Fwkl2A==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-buffer": "1.9.0",
+ "@webassemblyjs/wasm-gen": "1.9.0",
+ "@webassemblyjs/wasm-parser": "1.9.0"
+ }
+ },
+ "@webassemblyjs/wasm-parser": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.9.0.tgz",
+ "integrity": "sha512-9+wkMowR2AmdSWQzsPEjFU7njh8HTO5MqO8vjwEHuM+AMHioNqSBONRdr0NQQ3dVQrzp0s8lTcYqzUdb7YgELA==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-api-error": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/ieee754": "1.9.0",
+ "@webassemblyjs/leb128": "1.9.0",
+ "@webassemblyjs/utf8": "1.9.0"
+ }
+ },
+ "@webassemblyjs/wast-parser": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.9.0.tgz",
+ "integrity": "sha512-qsqSAP3QQ3LyZjNC/0jBJ/ToSxfYJ8kYyuiGvtn/8MK89VrNEfwj7BPQzJVHi0jGTRK2dGdJ5PRqhtjzoww+bw==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/floating-point-hex-parser": "1.9.0",
+ "@webassemblyjs/helper-api-error": "1.9.0",
+ "@webassemblyjs/helper-code-frame": "1.9.0",
+ "@webassemblyjs/helper-fsm": "1.9.0",
+ "@xtuc/long": "4.2.2"
+ }
+ },
+ "@webassemblyjs/wast-printer": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.9.0.tgz",
+ "integrity": "sha512-2J0nE95rHXHyQ24cWjMKJ1tqB/ds8z/cyeOZxJhcb+rW+SQASVjuznUSmdz5GpVJTzU8JkhYut0D3siFDD6wsA==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/wast-parser": "1.9.0",
+ "@xtuc/long": "4.2.2"
+ }
+ },
+ "@xtuc/ieee754": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
+ "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
+ "dev": true
+ },
+ "@xtuc/long": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
+ "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
+ "dev": true
+ },
+ "acorn": {
+ "version": "6.4.2",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz",
+ "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==",
+ "dev": true
+ },
+ "aggregate-error": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.0.tgz",
+ "integrity": "sha512-yKD9kEoJIR+2IFqhMwayIBgheLYbB3PS2OBhWae1L/ODTd/JF/30cW0bc9TqzRL3k4U41Dieu3BF4I29p8xesA==",
+ "dev": true,
+ "requires": {
+ "clean-stack": "^2.0.0",
+ "indent-string": "^3.2.0"
+ },
+ "dependencies": {
+ "indent-string": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz",
+ "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=",
+ "dev": true
+ }
+ }
+ },
+ "ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ajv-errors": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz",
+ "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==",
+ "dev": true
+ },
+ "ajv-keywords": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
+ "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
+ "dev": true
+ },
+ "ansi-colors": {
+ "version": "1.1.0",
+ "resolved": "http://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz",
+ "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==",
+ "dev": true,
+ "requires": {
+ "ansi-wrap": "^0.1.0"
+ }
+ },
+ "ansi-gray": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz",
+ "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=",
+ "dev": true,
+ "requires": {
+ "ansi-wrap": "0.1.0"
+ }
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "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==",
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "ansi-wrap": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz",
+ "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=",
+ "dev": true
+ },
+ "anymatch": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz",
+ "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==",
+ "dev": true,
+ "requires": {
+ "micromatch": "^3.1.4",
+ "normalize-path": "^2.1.1"
+ }
+ },
+ "append-buffer": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/append-buffer/-/append-buffer-1.0.2.tgz",
+ "integrity": "sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE=",
+ "dev": true,
+ "requires": {
+ "buffer-equal": "^1.0.0"
+ }
+ },
+ "aproba": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
+ "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
+ "dev": true
+ },
+ "arch": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/arch/-/arch-2.1.1.tgz",
+ "integrity": "sha512-BLM56aPo9vLLFVa8+/+pJLnrZ7QGGTVHWsCwieAWT9o9K8UeGaQbzZbGoabWLOo2ksBCztoXdqBZBplqLDDCSg==",
+ "dev": true,
+ "optional": true
+ },
+ "archive-type": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/archive-type/-/archive-type-4.0.0.tgz",
+ "integrity": "sha1-+S5yIzBW38aWlHJ0nCZ72wRrHXA=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "file-type": "^4.2.0"
+ },
+ "dependencies": {
+ "file-type": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz",
+ "integrity": "sha1-G2AOX8ofvcboDApwxxyNul95BsU=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "archy": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz",
+ "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=",
+ "dev": true
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "arr-diff": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
+ "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=",
+ "dev": true
+ },
+ "arr-filter": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/arr-filter/-/arr-filter-1.1.2.tgz",
+ "integrity": "sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4=",
+ "dev": true,
+ "requires": {
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "arr-flatten": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
+ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
+ "dev": true
+ },
+ "arr-map": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/arr-map/-/arr-map-2.0.2.tgz",
+ "integrity": "sha1-Onc0X/wc814qkYJWAfnljy4kysQ=",
+ "dev": true,
+ "requires": {
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "arr-union": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz",
+ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
+ "dev": true
+ },
+ "array-each": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz",
+ "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=",
+ "dev": true
+ },
+ "array-find-index": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
+ "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
+ "dev": true,
+ "optional": true
+ },
+ "array-initial": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz",
+ "integrity": "sha1-L6dLJnOTccOUe9enrcc74zSz15U=",
+ "dev": true,
+ "requires": {
+ "array-slice": "^1.0.0",
+ "is-number": "^4.0.0"
+ },
+ "dependencies": {
+ "is-number": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz",
+ "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==",
+ "dev": true
+ }
+ }
+ },
+ "array-last": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/array-last/-/array-last-1.3.0.tgz",
+ "integrity": "sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==",
+ "dev": true,
+ "requires": {
+ "is-number": "^4.0.0"
+ },
+ "dependencies": {
+ "is-number": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz",
+ "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==",
+ "dev": true
+ }
+ }
+ },
+ "array-slice": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz",
+ "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==",
+ "dev": true
+ },
+ "array-sort": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-1.0.0.tgz",
+ "integrity": "sha512-ihLeJkonmdiAsD7vpgN3CRcx2J2S0TiYW+IS/5zHBI7mKUq3ySvBdzzBfD236ubDBQFiiyG3SWCPc+msQ9KoYg==",
+ "dev": true,
+ "requires": {
+ "default-compare": "^1.0.0",
+ "get-value": "^2.0.6",
+ "kind-of": "^5.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
+ "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "dev": true
+ }
+ }
+ },
+ "array-unique": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
+ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
+ "dev": true
+ },
+ "asn1.js": {
+ "version": "5.4.1",
+ "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz",
+ "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.0.0",
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0",
+ "safer-buffer": "^2.1.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
+ }
+ },
+ "assert": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz",
+ "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==",
+ "dev": true,
+ "requires": {
+ "object-assign": "^4.1.1",
+ "util": "0.10.3"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
+ "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=",
+ "dev": true
+ },
+ "util": {
+ "version": "0.10.3",
+ "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
+ "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
+ "dev": true,
+ "requires": {
+ "inherits": "2.0.1"
+ }
+ }
+ }
+ },
+ "assign-symbols": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
+ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
+ "dev": true
+ },
+ "async-done": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.2.tgz",
+ "integrity": "sha512-uYkTP8dw2og1tu1nmza1n1CMW0qb8gWWlwqMmLb7MhBVs4BXrFziT6HXUd+/RlRA/i4H9AkofYloUbs1fwMqlw==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.2",
+ "process-nextick-args": "^2.0.0",
+ "stream-exhaust": "^1.0.1"
+ }
+ },
+ "async-each": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz",
+ "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==",
+ "dev": true
+ },
+ "async-settle": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz",
+ "integrity": "sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs=",
+ "dev": true,
+ "requires": {
+ "async-done": "^1.2.2"
+ }
+ },
+ "atob": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
+ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
+ "dev": true
+ },
+ "babel-plugin-dynamic-import-node": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
+ "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==",
+ "dev": true,
+ "requires": {
+ "object.assign": "^4.1.0"
+ }
+ },
+ "babel-plugin-emotion": {
+ "version": "10.0.33",
+ "resolved": "https://registry.npmjs.org/babel-plugin-emotion/-/babel-plugin-emotion-10.0.33.tgz",
+ "integrity": "sha512-bxZbTTGz0AJQDHm8k6Rf3RQJ8tX2scsfsRyKVgAbiUPUNIRtlK+7JxP+TAd1kRLABFxe0CFm2VdK4ePkoA9FxQ==",
+ "requires": {
+ "@babel/helper-module-imports": "^7.0.0",
+ "@emotion/hash": "0.8.0",
+ "@emotion/memoize": "0.7.4",
+ "@emotion/serialize": "^0.11.16",
+ "babel-plugin-macros": "^2.0.0",
+ "babel-plugin-syntax-jsx": "^6.18.0",
+ "convert-source-map": "^1.5.0",
+ "escape-string-regexp": "^1.0.5",
+ "find-root": "^1.1.0",
+ "source-map": "^0.5.7"
+ }
+ },
+ "babel-plugin-macros": {
+ "version": "2.8.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz",
+ "integrity": "sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==",
+ "requires": {
+ "@babel/runtime": "^7.7.2",
+ "cosmiconfig": "^6.0.0",
+ "resolve": "^1.12.0"
+ },
+ "dependencies": {
+ "resolve": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
+ "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==",
+ "requires": {
+ "is-core-module": "^2.1.0",
+ "path-parse": "^1.0.6"
+ }
+ }
+ }
+ },
+ "babel-plugin-syntax-jsx": {
+ "version": "6.18.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz",
+ "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY="
+ },
+ "bach": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz",
+ "integrity": "sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA=",
+ "dev": true,
+ "requires": {
+ "arr-filter": "^1.1.1",
+ "arr-flatten": "^1.0.1",
+ "arr-map": "^2.0.0",
+ "array-each": "^1.0.0",
+ "array-initial": "^1.0.0",
+ "array-last": "^1.1.1",
+ "async-done": "^1.2.2",
+ "async-settle": "^1.0.0",
+ "now-and-later": "^2.0.0"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "dev": true
+ },
+ "base": {
+ "version": "0.11.2",
+ "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz",
+ "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==",
+ "dev": true,
+ "requires": {
+ "cache-base": "^1.0.1",
+ "class-utils": "^0.3.5",
+ "component-emitter": "^1.2.1",
+ "define-property": "^1.0.0",
+ "isobject": "^3.0.1",
+ "mixin-deep": "^1.2.0",
+ "pascalcase": "^0.1.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "base64-js": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
+ "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
+ "dev": true
+ },
+ "big.js": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
+ "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
+ "dev": true
+ },
+ "bin-build": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/bin-build/-/bin-build-3.0.0.tgz",
+ "integrity": "sha512-jcUOof71/TNAI2uM5uoUaDq2ePcVBQ3R/qhxAz1rX7UfvduAL/RXD3jXzvn8cVcDJdGVkiR1shal3OH0ImpuhA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "decompress": "^4.0.0",
+ "download": "^6.2.2",
+ "execa": "^0.7.0",
+ "p-map-series": "^1.0.0",
+ "tempfile": "^2.0.0"
+ }
+ },
+ "bin-check": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bin-check/-/bin-check-4.1.0.tgz",
+ "integrity": "sha512-b6weQyEUKsDGFlACWSIOfveEnImkJyK/FGW6FAG42loyoquvjdtOIqO6yBFzHyqyVVhNgNkQxxx09SFLK28YnA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "execa": "^0.7.0",
+ "executable": "^4.1.0"
+ }
+ },
+ "bin-version": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/bin-version/-/bin-version-3.1.0.tgz",
+ "integrity": "sha512-Mkfm4iE1VFt4xd4vH+gx+0/71esbfus2LsnCGe8Pi4mndSPyT+NGES/Eg99jx8/lUGWfu3z2yuB/bt5UB+iVbQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "execa": "^1.0.0",
+ "find-versions": "^3.0.0"
+ },
+ "dependencies": {
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "execa": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
+ "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "cross-spawn": "^6.0.0",
+ "get-stream": "^4.0.0",
+ "is-stream": "^1.1.0",
+ "npm-run-path": "^2.0.0",
+ "p-finally": "^1.0.0",
+ "signal-exit": "^3.0.0",
+ "strip-eof": "^1.0.0"
+ }
+ },
+ "get-stream": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
+ "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "bin-version-check": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/bin-version-check/-/bin-version-check-4.0.0.tgz",
+ "integrity": "sha512-sR631OrhC+1f8Cvs8WyVWOA33Y8tgwjETNPyyD/myRBXLkfS/vl74FmH/lFcRl9KY3zwGh7jFhvyk9vV3/3ilQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "bin-version": "^3.0.0",
+ "semver": "^5.6.0",
+ "semver-truncate": "^1.1.2"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "bin-wrapper": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bin-wrapper/-/bin-wrapper-4.1.0.tgz",
+ "integrity": "sha512-hfRmo7hWIXPkbpi0ZltboCMVrU+0ClXR/JgbCKKjlDjQf6igXa7OwdqNcFWQZPZTgiY7ZpzE3+LjjkLiTN2T7Q==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "bin-check": "^4.1.0",
+ "bin-version-check": "^4.0.0",
+ "download": "^7.1.0",
+ "import-lazy": "^3.1.0",
+ "os-filter-obj": "^2.0.0",
+ "pify": "^4.0.1"
+ },
+ "dependencies": {
+ "download": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/download/-/download-7.1.0.tgz",
+ "integrity": "sha512-xqnBTVd/E+GxJVrX5/eUJiLYjCGPwMpdL+jGhGU57BvtcA7wwhtHVbXBeUk51kOpW3S7Jn3BQbN9Q1R1Km2qDQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "archive-type": "^4.0.0",
+ "caw": "^2.0.1",
+ "content-disposition": "^0.5.2",
+ "decompress": "^4.2.0",
+ "ext-name": "^5.0.0",
+ "file-type": "^8.1.0",
+ "filenamify": "^2.0.0",
+ "get-stream": "^3.0.0",
+ "got": "^8.3.1",
+ "make-dir": "^1.2.0",
+ "p-event": "^2.1.0",
+ "pify": "^3.0.0"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "file-type": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-8.1.0.tgz",
+ "integrity": "sha512-qyQ0pzAy78gVoJsmYeNgl8uH8yKhr1lVhW7JbzJmnlRi0I4R2eEDEJZVKG8agpDnLpacwNbDhLNG/LMdxHD2YQ==",
+ "dev": true,
+ "optional": true
+ },
+ "got": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/got/-/got-8.3.2.tgz",
+ "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "@sindresorhus/is": "^0.7.0",
+ "cacheable-request": "^2.1.1",
+ "decompress-response": "^3.3.0",
+ "duplexer3": "^0.1.4",
+ "get-stream": "^3.0.0",
+ "into-stream": "^3.1.0",
+ "is-retry-allowed": "^1.1.0",
+ "isurl": "^1.0.0-alpha5",
+ "lowercase-keys": "^1.0.0",
+ "mimic-response": "^1.0.0",
+ "p-cancelable": "^0.4.0",
+ "p-timeout": "^2.0.1",
+ "pify": "^3.0.0",
+ "safe-buffer": "^5.1.1",
+ "timed-out": "^4.0.1",
+ "url-parse-lax": "^3.0.0",
+ "url-to-options": "^1.0.1"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "make-dir": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
+ "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "pify": "^3.0.0"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "p-cancelable": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz",
+ "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==",
+ "dev": true,
+ "optional": true
+ },
+ "p-event": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/p-event/-/p-event-2.3.1.tgz",
+ "integrity": "sha512-NQCqOFhbpVTMX4qMe8PF8lbGtzZ+LCiN7pcNrb/413Na7+TRoe1xkKUzuWa/YEJdGQ0FvKtj35EEbDoVPO2kbA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "p-timeout": "^2.0.1"
+ }
+ },
+ "p-timeout": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz",
+ "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "p-finally": "^1.0.0"
+ }
+ },
+ "pify": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
+ "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
+ "dev": true,
+ "optional": true
+ },
+ "prepend-http": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
+ "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
+ "dev": true,
+ "optional": true
+ },
+ "url-parse-lax": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
+ "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "prepend-http": "^2.0.0"
+ }
+ }
+ }
+ },
+ "binary-extensions": {
+ "version": "1.13.1",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
+ "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==",
+ "dev": true
+ },
+ "binaryextensions": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.1.2.tgz",
+ "integrity": "sha512-xVNN69YGDghOqCCtA6FI7avYrr02mTJjOgB0/f1VPD3pJC8QEvjTKWc4epDx8AqxxA75NI0QpVM2gPJXUbE4Tg==",
+ "dev": true
+ },
+ "bindings": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "file-uri-to-path": "1.0.0"
+ }
+ },
+ "bl": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz",
+ "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "readable-stream": "^2.3.5",
+ "safe-buffer": "^5.1.1"
+ }
+ },
+ "bluebird": {
+ "version": "3.7.2",
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
+ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
+ "dev": true
+ },
+ "bn.js": {
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz",
+ "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==",
+ "dev": true
+ },
+ "body": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/body/-/body-5.1.0.tgz",
+ "integrity": "sha1-5LoM5BCkaTYyM2dgnstOZVMSUGk=",
+ "dev": true,
+ "requires": {
+ "continuable-cache": "^0.3.1",
+ "error": "^7.0.0",
+ "raw-body": "~1.1.0",
+ "safe-json-parse": "~1.0.1"
+ }
+ },
+ "boolbase": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
+ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
+ "dev": true,
+ "optional": 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"
+ }
+ },
+ "braces": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
+ "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
+ "dev": true,
+ "requires": {
+ "arr-flatten": "^1.1.0",
+ "array-unique": "^0.3.2",
+ "extend-shallow": "^2.0.1",
+ "fill-range": "^4.0.0",
+ "isobject": "^3.0.1",
+ "repeat-element": "^1.1.2",
+ "snapdragon": "^0.8.1",
+ "snapdragon-node": "^2.0.1",
+ "split-string": "^3.0.2",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "brorand": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
+ "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=",
+ "dev": true
+ },
+ "browserify-aes": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
+ "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
+ "dev": true,
+ "requires": {
+ "buffer-xor": "^1.0.3",
+ "cipher-base": "^1.0.0",
+ "create-hash": "^1.1.0",
+ "evp_bytestokey": "^1.0.3",
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "browserify-cipher": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz",
+ "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==",
+ "dev": true,
+ "requires": {
+ "browserify-aes": "^1.0.4",
+ "browserify-des": "^1.0.0",
+ "evp_bytestokey": "^1.0.0"
+ }
+ },
+ "browserify-des": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz",
+ "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==",
+ "dev": true,
+ "requires": {
+ "cipher-base": "^1.0.1",
+ "des.js": "^1.0.0",
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.1.2"
+ }
+ },
+ "browserify-rsa": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz",
+ "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==",
+ "dev": true,
+ "requires": {
+ "bn.js": "^5.0.0",
+ "randombytes": "^2.0.1"
+ }
+ },
+ "browserify-sign": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz",
+ "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==",
+ "dev": true,
+ "requires": {
+ "bn.js": "^5.1.1",
+ "browserify-rsa": "^4.0.1",
+ "create-hash": "^1.2.0",
+ "create-hmac": "^1.1.7",
+ "elliptic": "^6.5.3",
+ "inherits": "^2.0.4",
+ "parse-asn1": "^5.1.5",
+ "readable-stream": "^3.6.0",
+ "safe-buffer": "^5.2.0"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true
+ }
+ }
+ },
+ "browserify-zlib": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz",
+ "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==",
+ "dev": true,
+ "requires": {
+ "pako": "~1.0.5"
+ }
+ },
+ "browserslist": {
+ "version": "4.14.7",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.7.tgz",
+ "integrity": "sha512-BSVRLCeG3Xt/j/1cCGj1019Wbty0H+Yvu2AOuZSuoaUWn3RatbL33Cxk+Q4jRMRAbOm0p7SLravLjpnT6s0vzQ==",
+ "dev": true,
+ "requires": {
+ "caniuse-lite": "^1.0.30001157",
+ "colorette": "^1.2.1",
+ "electron-to-chromium": "^1.3.591",
+ "escalade": "^3.1.1",
+ "node-releases": "^1.1.66"
+ }
+ },
+ "buffer": {
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
+ "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "base64-js": "^1.0.2",
+ "ieee754": "^1.1.4"
+ }
+ },
+ "buffer-alloc": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
+ "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "buffer-alloc-unsafe": "^1.1.0",
+ "buffer-fill": "^1.0.0"
+ }
+ },
+ "buffer-alloc-unsafe": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
+ "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==",
+ "dev": true,
+ "optional": true
+ },
+ "buffer-crc32": {
+ "version": "0.2.13",
+ "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
+ "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=",
+ "dev": true
+ },
+ "buffer-equal": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz",
+ "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=",
+ "dev": true
+ },
+ "buffer-fill": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
+ "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=",
+ "dev": true,
+ "optional": 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
+ },
+ "buffer-xor": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
+ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=",
+ "dev": true
+ },
+ "builtin-modules": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
+ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
+ "dev": true
+ },
+ "builtin-status-codes": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz",
+ "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=",
+ "dev": true
+ },
+ "bytes": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-1.0.0.tgz",
+ "integrity": "sha1-NWnt6Lo0MV+rmcPpLLBMciDeH6g=",
+ "dev": true
+ },
+ "cacache": {
+ "version": "12.0.4",
+ "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz",
+ "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==",
+ "dev": true,
+ "requires": {
+ "bluebird": "^3.5.5",
+ "chownr": "^1.1.1",
+ "figgy-pudding": "^3.5.1",
+ "glob": "^7.1.4",
+ "graceful-fs": "^4.1.15",
+ "infer-owner": "^1.0.3",
+ "lru-cache": "^5.1.1",
+ "mississippi": "^3.0.0",
+ "mkdirp": "^0.5.1",
+ "move-concurrently": "^1.0.1",
+ "promise-inflight": "^1.0.1",
+ "rimraf": "^2.6.3",
+ "ssri": "^6.0.1",
+ "unique-filename": "^1.1.1",
+ "y18n": "^4.0.0"
+ },
+ "dependencies": {
+ "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"
+ }
+ },
+ "lru-cache": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
+ "dev": true,
+ "requires": {
+ "yallist": "^3.0.2"
+ }
+ },
+ "y18n": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
+ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
+ "dev": true
+ },
+ "yallist": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
+ "dev": true
+ }
+ }
+ },
+ "cache-base": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
+ "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==",
+ "dev": true,
+ "requires": {
+ "collection-visit": "^1.0.0",
+ "component-emitter": "^1.2.1",
+ "get-value": "^2.0.6",
+ "has-value": "^1.0.0",
+ "isobject": "^3.0.1",
+ "set-value": "^2.0.0",
+ "to-object-path": "^0.3.0",
+ "union-value": "^1.0.0",
+ "unset-value": "^1.0.0"
+ }
+ },
+ "cacheable-request": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz",
+ "integrity": "sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "clone-response": "1.0.2",
+ "get-stream": "3.0.0",
+ "http-cache-semantics": "3.8.1",
+ "keyv": "3.0.0",
+ "lowercase-keys": "1.0.0",
+ "normalize-url": "2.0.1",
+ "responselike": "1.0.2"
+ },
+ "dependencies": {
+ "lowercase-keys": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz",
+ "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
+ },
+ "camelcase": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "dev": true
+ },
+ "camelcase-keys": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
+ "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "camelcase": "^2.0.0",
+ "map-obj": "^1.0.0"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz",
+ "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "caniuse-lite": {
+ "version": "1.0.30001162",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001162.tgz",
+ "integrity": "sha512-E9FktFxaNnp4ky3ucIGzEXLM+Knzlpuq1oN1sFAU0KeayygabGTmOsndpo8QrL4D9pcThlf4D2pUKaDxPCUmVw==",
+ "dev": true
+ },
+ "caw": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/caw/-/caw-2.0.1.tgz",
+ "integrity": "sha512-Cg8/ZSBEa8ZVY9HspcGUYaK63d/bN7rqS3CYCzEGUxuYv6UlmcjzDUz2fCFFHyTvUW5Pk0I+3hkA3iXlIj6guA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "get-proxy": "^2.0.0",
+ "isurl": "^1.0.0-alpha5",
+ "tunnel-agent": "^0.6.0",
+ "url-to-options": "^1.0.1"
+ }
+ },
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "chokidar": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
+ "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
+ "dev": true,
+ "requires": {
+ "anymatch": "^2.0.0",
+ "async-each": "^1.0.1",
+ "braces": "^2.3.2",
+ "fsevents": "^1.2.7",
+ "glob-parent": "^3.1.0",
+ "inherits": "^2.0.3",
+ "is-binary-path": "^1.0.0",
+ "is-glob": "^4.0.0",
+ "normalize-path": "^3.0.0",
+ "path-is-absolute": "^1.0.0",
+ "readdirp": "^2.2.1",
+ "upath": "^1.1.1"
+ },
+ "dependencies": {
+ "is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true
+ }
+ }
+ },
+ "chownr": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
+ "dev": true
+ },
+ "chrome-trace-event": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz",
+ "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
+ "cipher-base": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz",
+ "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "class-utils": {
+ "version": "0.3.6",
+ "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
+ "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==",
+ "dev": true,
+ "requires": {
+ "arr-union": "^3.1.0",
+ "define-property": "^0.2.5",
+ "isobject": "^3.0.0",
+ "static-extend": "^0.1.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ }
+ }
+ },
+ "classnames": {
+ "version": "2.2.6",
+ "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz",
+ "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q=="
+ },
+ "clean-stack": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
+ "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",
+ "dev": true
+ },
+ "cliui": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
+ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
+ "dev": true,
+ "requires": {
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wrap-ansi": "^2.0.0"
+ }
+ },
+ "clone": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
+ "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=",
+ "dev": true
+ },
+ "clone-buffer": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz",
+ "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=",
+ "dev": true
+ },
+ "clone-response": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz",
+ "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "mimic-response": "^1.0.0"
+ }
+ },
+ "clone-stats": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz",
+ "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=",
+ "dev": true
+ },
+ "cloneable-readable": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz",
+ "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.1",
+ "process-nextick-args": "^2.0.0",
+ "readable-stream": "^2.3.5"
+ }
+ },
+ "coa": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/coa/-/coa-2.0.2.tgz",
+ "integrity": "sha512-q5/jG+YQnSy4nRTV4F7lPepBJZ8qBNJJDBuJdoejDyLXgmL7IEo+Le2JDZudFTFt7mrCqIRaSjws4ygRCTCAXA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "@types/q": "^1.5.1",
+ "chalk": "^2.4.1",
+ "q": "^1.1.2"
+ }
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+ "dev": true
+ },
+ "collection-map": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/collection-map/-/collection-map-1.0.0.tgz",
+ "integrity": "sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw=",
+ "dev": true,
+ "requires": {
+ "arr-map": "^2.0.2",
+ "for-own": "^1.0.0",
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "collection-visit": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
+ "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=",
+ "dev": true,
+ "requires": {
+ "map-visit": "^1.0.0",
+ "object-visit": "^1.0.0"
+ }
+ },
+ "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==",
+ "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="
+ },
+ "color-support": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
+ "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
+ "dev": true
+ },
+ "colorette": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz",
+ "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==",
+ "dev": true
+ },
+ "commander": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz",
+ "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "graceful-readlink": ">= 1.0.0"
+ }
+ },
+ "commondir": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
+ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
+ "dev": true
+ },
+ "component-emitter": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
+ "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=",
+ "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
+ },
+ "concat-stream": {
+ "version": "1.6.2",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
+ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
+ "dev": true,
+ "requires": {
+ "buffer-from": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.2.2",
+ "typedarray": "^0.0.6"
+ }
+ },
+ "concurrently": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.3.0.tgz",
+ "integrity": "sha512-8MhqOB6PWlBfA2vJ8a0bSFKATOdWlHiQlk11IfmQBPaHVP8oP2gsh2MObE6UR3hqDHqvaIvLTyceNW6obVuFHQ==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "date-fns": "^2.0.1",
+ "lodash": "^4.17.15",
+ "read-pkg": "^4.0.1",
+ "rxjs": "^6.5.2",
+ "spawn-command": "^0.0.2-1",
+ "supports-color": "^6.1.0",
+ "tree-kill": "^1.2.2",
+ "yargs": "^13.3.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "cliui": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+ "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^3.1.0",
+ "strip-ansi": "^5.2.0",
+ "wrap-ansi": "^5.1.0"
+ }
+ },
+ "find-up": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
+ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^3.0.0"
+ }
+ },
+ "get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.3.1",
+ "json-parse-better-errors": "^1.0.1"
+ }
+ },
+ "read-pkg": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz",
+ "integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=",
+ "dev": true,
+ "requires": {
+ "normalize-package-data": "^2.3.2",
+ "parse-json": "^4.0.0",
+ "pify": "^3.0.0"
+ }
+ },
+ "require-main-filename": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
+ "dev": true
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ },
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "which-module": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
+ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+ "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "string-width": "^3.0.0",
+ "strip-ansi": "^5.0.0"
+ }
+ },
+ "y18n": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
+ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
+ "dev": true
+ },
+ "yargs": {
+ "version": "13.3.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
+ "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^5.0.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^3.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.1.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "13.1.2",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
+ "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+ },
+ "config-chain": {
+ "version": "1.1.12",
+ "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz",
+ "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ini": "^1.3.4",
+ "proto-list": "~1.2.1"
+ }
+ },
+ "console-browserify": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz",
+ "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==",
+ "dev": true
+ },
+ "console-stream": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/console-stream/-/console-stream-0.1.1.tgz",
+ "integrity": "sha1-oJX+B7IEZZVfL6/Si11yvM2UnUQ=",
+ "dev": true,
+ "optional": true
+ },
+ "constants-browserify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz",
+ "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=",
+ "dev": true
+ },
+ "content-disposition": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
+ "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "5.1.2"
+ }
+ },
+ "continuable-cache": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/continuable-cache/-/continuable-cache-0.3.1.tgz",
+ "integrity": "sha1-vXJ6f67XfnH/OYWskzUakSczrQ8=",
+ "dev": true
+ },
+ "convert-source-map": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
+ "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==",
+ "requires": {
+ "safe-buffer": "~5.1.1"
+ }
+ },
+ "copy-concurrently": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
+ "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==",
+ "dev": true,
+ "requires": {
+ "aproba": "^1.1.1",
+ "fs-write-stream-atomic": "^1.0.8",
+ "iferr": "^0.1.5",
+ "mkdirp": "^0.5.1",
+ "rimraf": "^2.5.4",
+ "run-queue": "^1.0.0"
+ }
+ },
+ "copy-descriptor": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
+ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
+ "dev": true
+ },
+ "copy-props": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.4.tgz",
+ "integrity": "sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==",
+ "dev": true,
+ "requires": {
+ "each-props": "^1.3.0",
+ "is-plain-object": "^2.0.1"
+ }
+ },
+ "core-js-compat": {
+ "version": "3.8.0",
+ "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.8.0.tgz",
+ "integrity": "sha512-o9QKelQSxQMYWHXc/Gc4L8bx/4F7TTraE5rhuN8I7mKBt5dBIUpXpIR3omv70ebr8ST5R3PqbDQr+ZI3+Tt1FQ==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.14.7",
+ "semver": "7.0.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
+ "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
+ "dev": true
+ }
+ }
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
+ "dev": true
+ },
+ "cosmiconfig": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz",
+ "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==",
+ "requires": {
+ "@types/parse-json": "^4.0.0",
+ "import-fresh": "^3.1.0",
+ "parse-json": "^5.0.0",
+ "path-type": "^4.0.0",
+ "yaml": "^1.7.2"
+ },
+ "dependencies": {
+ "parse-json": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz",
+ "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==",
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "error-ex": "^1.3.1",
+ "json-parse-even-better-errors": "^2.3.0",
+ "lines-and-columns": "^1.1.6"
+ }
+ }
+ }
+ },
+ "create-ecdh": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz",
+ "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.1.0",
+ "elliptic": "^6.5.3"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
+ }
+ },
+ "create-hash": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
+ "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
+ "dev": true,
+ "requires": {
+ "cipher-base": "^1.0.1",
+ "inherits": "^2.0.1",
+ "md5.js": "^1.3.4",
+ "ripemd160": "^2.0.1",
+ "sha.js": "^2.4.0"
+ }
+ },
+ "create-hmac": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
+ "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
+ "dev": true,
+ "requires": {
+ "cipher-base": "^1.0.3",
+ "create-hash": "^1.1.0",
+ "inherits": "^2.0.1",
+ "ripemd160": "^2.0.0",
+ "safe-buffer": "^5.0.1",
+ "sha.js": "^2.4.8"
+ }
+ },
+ "cross-spawn": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
+ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "lru-cache": "^4.0.1",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "crypto-browserify": {
+ "version": "3.12.0",
+ "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz",
+ "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==",
+ "dev": true,
+ "requires": {
+ "browserify-cipher": "^1.0.0",
+ "browserify-sign": "^4.0.0",
+ "create-ecdh": "^4.0.0",
+ "create-hash": "^1.1.0",
+ "create-hmac": "^1.1.0",
+ "diffie-hellman": "^5.0.0",
+ "inherits": "^2.0.1",
+ "pbkdf2": "^3.0.3",
+ "public-encrypt": "^4.0.0",
+ "randombytes": "^2.0.0",
+ "randomfill": "^1.0.3"
+ }
+ },
+ "css-select": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.1.0.tgz",
+ "integrity": "sha512-Dqk7LQKpwLoH3VovzZnkzegqNSuAziQyNZUcrdDM401iY+R5NkGBXGmtO05/yaXQziALuPogeG0b7UAgjnTJTQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "boolbase": "^1.0.0",
+ "css-what": "^3.2.1",
+ "domutils": "^1.7.0",
+ "nth-check": "^1.0.2"
+ }
+ },
+ "css-select-base-adapter": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz",
+ "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==",
+ "dev": true,
+ "optional": true
+ },
+ "css-tree": {
+ "version": "1.0.0-alpha.37",
+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz",
+ "integrity": "sha512-DMxWJg0rnz7UgxKT0Q1HU/L9BeJI0M6ksor0OgqOnF+aRCDWg/N2641HmVyU9KVIu0OVVWOb2IpC9A+BJRnejg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "mdn-data": "2.0.4",
+ "source-map": "^0.6.1"
+ },
+ "dependencies": {
+ "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,
+ "optional": true
+ }
+ }
+ },
+ "css-what": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.2.1.tgz",
+ "integrity": "sha512-WwOrosiQTvyms+Ti5ZC5vGEK0Vod3FTt1ca+payZqvKuGJF+dq7bG63DstxtN0dpm6FxY27a/zS3Wten+gEtGw==",
+ "dev": true,
+ "optional": true
+ },
+ "csso": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/csso/-/csso-4.0.2.tgz",
+ "integrity": "sha512-kS7/oeNVXkHWxby5tHVxlhjizRCSv8QdU7hB2FpdAibDU8FjTAolhNjKNTiLzXtUrKT6HwClE81yXwEk1309wg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "css-tree": "1.0.0-alpha.37"
+ }
+ },
+ "csstype": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.5.tgz",
+ "integrity": "sha512-uVDi8LpBUKQj6sdxNaTetL6FpeCqTjOvAQuQUa/qAqq8oOd4ivkbhgnqayl0dnPal8Tb/yB1tF+gOvCBiicaiQ=="
+ },
+ "currently-unhandled": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
+ "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "array-find-index": "^1.0.1"
+ }
+ },
+ "cyclist": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz",
+ "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=",
+ "dev": true
+ },
+ "d": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz",
+ "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==",
+ "dev": true,
+ "requires": {
+ "es5-ext": "^0.10.50",
+ "type": "^1.0.1"
+ }
+ },
+ "date-fns": {
+ "version": "2.15.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.15.0.tgz",
+ "integrity": "sha512-ZCPzAMJZn3rNUvvQIMlXhDr4A+Ar07eLeGsGREoWU19a3Pqf5oYa+ccd+B3F6XVtQY6HANMFdOQ8A+ipFnvJdQ==",
+ "dev": true
+ },
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
+ "dev": true
+ },
+ "decode-uri-component": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
+ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
+ "dev": true
+ },
+ "decompress": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz",
+ "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "decompress-tar": "^4.0.0",
+ "decompress-tarbz2": "^4.0.0",
+ "decompress-targz": "^4.0.0",
+ "decompress-unzip": "^4.0.1",
+ "graceful-fs": "^4.1.10",
+ "make-dir": "^1.0.0",
+ "pify": "^2.3.0",
+ "strip-dirs": "^2.0.0"
+ },
+ "dependencies": {
+ "make-dir": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
+ "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "pify": "^3.0.0"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "decompress-response": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
+ "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "mimic-response": "^1.0.0"
+ }
+ },
+ "decompress-tar": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz",
+ "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "file-type": "^5.2.0",
+ "is-stream": "^1.1.0",
+ "tar-stream": "^1.5.2"
+ },
+ "dependencies": {
+ "file-type": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz",
+ "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "decompress-tarbz2": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz",
+ "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "decompress-tar": "^4.1.0",
+ "file-type": "^6.1.0",
+ "is-stream": "^1.1.0",
+ "seek-bzip": "^1.0.5",
+ "unbzip2-stream": "^1.0.9"
+ },
+ "dependencies": {
+ "file-type": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz",
+ "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "decompress-targz": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz",
+ "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "decompress-tar": "^4.1.1",
+ "file-type": "^5.2.0",
+ "is-stream": "^1.1.0"
+ },
+ "dependencies": {
+ "file-type": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz",
+ "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "decompress-unzip": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz",
+ "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "file-type": "^3.8.0",
+ "get-stream": "^2.2.0",
+ "pify": "^2.3.0",
+ "yauzl": "^2.4.2"
+ },
+ "dependencies": {
+ "file-type": {
+ "version": "3.9.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
+ "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=",
+ "dev": true,
+ "optional": true
+ },
+ "get-stream": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz",
+ "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "object-assign": "^4.0.1",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "deep-diff": {
+ "version": "0.3.8",
+ "resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-0.3.8.tgz",
+ "integrity": "sha1-wB3mPvsO7JeYgB1Ax+Da4ltYLIQ="
+ },
+ "default-compare": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz",
+ "integrity": "sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^5.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
+ "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "dev": true
+ }
+ }
+ },
+ "default-resolution": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz",
+ "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=",
+ "dev": true
+ },
+ "define-properties": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
+ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
+ "dev": true,
+ "requires": {
+ "object-keys": "^1.0.12"
+ }
+ },
+ "define-property": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
+ "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^1.0.2",
+ "isobject": "^3.0.1"
+ },
+ "dependencies": {
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "del": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/del/-/del-5.1.0.tgz",
+ "integrity": "sha512-wH9xOVHnczo9jN2IW68BabcecVPxacIA3g/7z6vhSU/4stOKQzeCRK0yD0A24WiAAUJmmVpWqrERcTxnLo3AnA==",
+ "dev": true,
+ "requires": {
+ "globby": "^10.0.1",
+ "graceful-fs": "^4.2.2",
+ "is-glob": "^4.0.1",
+ "is-path-cwd": "^2.2.0",
+ "is-path-inside": "^3.0.1",
+ "p-map": "^3.0.0",
+ "rimraf": "^3.0.0",
+ "slash": "^3.0.0"
+ },
+ "dependencies": {
+ "is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "rimraf": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.0.tgz",
+ "integrity": "sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true
+ }
+ }
+ },
+ "des.js": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz",
+ "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0"
+ }
+ },
+ "detect-file": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz",
+ "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=",
+ "dev": true
+ },
+ "diffie-hellman": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
+ "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.1.0",
+ "miller-rabin": "^4.0.0",
+ "randombytes": "^2.0.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
+ }
+ },
+ "dom-helpers": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.0.tgz",
+ "integrity": "sha512-Ru5o9+V8CpunKnz5LGgWXkmrH/20cGKwcHwS4m73zIvs54CN9epEmT/HLqFJW3kXpakAFkEdzgy1hzlJe3E4OQ==",
+ "requires": {
+ "@babel/runtime": "^7.8.7",
+ "csstype": "^3.0.2"
+ }
+ },
+ "dom-serializer": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz",
+ "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "domelementtype": "^2.0.1",
+ "entities": "^2.0.0"
+ },
+ "dependencies": {
+ "domelementtype": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz",
+ "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "domain-browser": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
+ "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==",
+ "dev": true
+ },
+ "domelementtype": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz",
+ "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==",
+ "dev": true,
+ "optional": true
+ },
+ "domutils": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz",
+ "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "dom-serializer": "0",
+ "domelementtype": "1"
+ }
+ },
+ "download": {
+ "version": "6.2.5",
+ "resolved": "https://registry.npmjs.org/download/-/download-6.2.5.tgz",
+ "integrity": "sha512-DpO9K1sXAST8Cpzb7kmEhogJxymyVUd5qz/vCOSyvwtp2Klj2XcDt5YUuasgxka44SxF0q5RriKIwJmQHG2AuA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "caw": "^2.0.0",
+ "content-disposition": "^0.5.2",
+ "decompress": "^4.0.0",
+ "ext-name": "^5.0.0",
+ "file-type": "5.2.0",
+ "filenamify": "^2.0.0",
+ "get-stream": "^3.0.0",
+ "got": "^7.0.0",
+ "make-dir": "^1.0.0",
+ "p-event": "^1.0.0",
+ "pify": "^3.0.0"
+ },
+ "dependencies": {
+ "file-type": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz",
+ "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=",
+ "dev": true,
+ "optional": true
+ },
+ "make-dir": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
+ "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "pify": "^3.0.0"
+ }
+ }
+ }
+ },
+ "duplexer3": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
+ "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=",
+ "dev": true,
+ "optional": true
+ },
+ "duplexify": {
+ "version": "3.6.1",
+ "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz",
+ "integrity": "sha512-vM58DwdnKmty+FSPzT14K9JXb90H+j5emaR4KYbr2KTIz00WHGbWOe5ghQTx233ZCLZtrGDALzKwcjEtSt35mA==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.0.0",
+ "inherits": "^2.0.1",
+ "readable-stream": "^2.0.0",
+ "stream-shift": "^1.0.0"
+ },
+ "dependencies": {
+ "end-of-stream": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
+ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==",
+ "dev": true,
+ "requires": {
+ "once": "^1.4.0"
+ }
+ }
+ }
+ },
+ "each-props": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz",
+ "integrity": "sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA==",
+ "dev": true,
+ "requires": {
+ "is-plain-object": "^2.0.1",
+ "object.defaults": "^1.1.0"
+ }
+ },
+ "editions": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/editions/-/editions-1.3.4.tgz",
+ "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==",
+ "dev": true
+ },
+ "electron-to-chromium": {
+ "version": "1.3.610",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.610.tgz",
+ "integrity": "sha512-eFDC+yVQpEhtlapk4CYDPfV9ajF9cEof5TBcO49L1ETO+aYogrKWDmYpZyxBScMNe8Bo/gJamH4amQ4yyvXg4g==",
+ "dev": true
+ },
+ "elliptic": {
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
+ "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.4.0",
+ "brorand": "^1.0.1",
+ "hash.js": "^1.0.0",
+ "hmac-drbg": "^1.0.0",
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0",
+ "minimalistic-crypto-utils": "^1.0.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
+ }
+ },
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "emojis-list": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
+ "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
+ "dev": true
+ },
+ "end-of-stream": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.2.tgz",
+ "integrity": "sha512-gUSUszrsxlDnUbUwEI9Oygyrk4ZEWtVaHQc+uZHphVeNxl+qeqMV/jDWoTkjN1RmGlZ5QWAP7o458p/JMlikQg==",
+ "dev": true,
+ "requires": {
+ "once": "^1.4.0"
+ }
+ },
+ "enhanced-resolve": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz",
+ "integrity": "sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "memory-fs": "^0.5.0",
+ "tapable": "^1.0.0"
+ }
+ },
+ "entities": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz",
+ "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==",
+ "dev": true,
+ "optional": true
+ },
+ "errno": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
+ "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
+ "dev": true,
+ "requires": {
+ "prr": "~1.0.1"
+ }
+ },
+ "error": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/error/-/error-7.2.0.tgz",
+ "integrity": "sha512-M6t3j3Vt3uDicrViMP5fLq2AeADNrCVFD8Oj4Qt2MHsX0mPYG7D5XdnEfSdRpaHQzjAJ19wu+I1mw9rQYMTAPg==",
+ "dev": true,
+ "requires": {
+ "string-template": "~0.2.1"
+ }
+ },
+ "error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "requires": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "es-abstract": {
+ "version": "1.17.0-next.1",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.0-next.1.tgz",
+ "integrity": "sha512-7MmGr03N7Rnuid6+wyhD9sHNE2n4tFSwExnU2lQl3lIo2ShXWGePY80zYaoMOmILWv57H0amMjZGHNzzGG70Rw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "es-to-primitive": "^1.2.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.1",
+ "is-callable": "^1.1.4",
+ "is-regex": "^1.0.4",
+ "object-inspect": "^1.7.0",
+ "object-keys": "^1.1.1",
+ "object.assign": "^4.1.0",
+ "string.prototype.trimleft": "^2.1.0",
+ "string.prototype.trimright": "^2.1.0"
+ },
+ "dependencies": {
+ "has-symbols": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
+ "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
+ "dev": true,
+ "optional": true
+ },
+ "object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "es-to-primitive": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
+ "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-callable": "^1.1.4",
+ "is-date-object": "^1.0.1",
+ "is-symbol": "^1.0.2"
+ }
+ },
+ "es5-ext": {
+ "version": "0.10.51",
+ "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
+ "integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
+ "dev": true,
+ "requires": {
+ "es6-iterator": "~2.0.3",
+ "es6-symbol": "~3.1.1",
+ "next-tick": "^1.0.0"
+ }
+ },
+ "es6-iterator": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
+ "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=",
+ "dev": true,
+ "requires": {
+ "d": "1",
+ "es5-ext": "^0.10.35",
+ "es6-symbol": "^3.1.1"
+ }
+ },
+ "es6-symbol": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.2.tgz",
+ "integrity": "sha512-/ZypxQsArlv+KHpGvng52/Iz8by3EQPxhmbuz8yFG89N/caTFBSbcXONDw0aMjy827gQg26XAjP4uXFvnfINmQ==",
+ "dev": true,
+ "requires": {
+ "d": "^1.0.1",
+ "es5-ext": "^0.10.51"
+ }
+ },
+ "es6-weak-map": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz",
+ "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==",
+ "dev": true,
+ "requires": {
+ "d": "1",
+ "es5-ext": "^0.10.46",
+ "es6-iterator": "^2.0.3",
+ "es6-symbol": "^3.1.1"
+ }
+ },
+ "escalade": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+ "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="
+ },
+ "eslint-scope": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
+ "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==",
+ "dev": true,
+ "requires": {
+ "esrecurse": "^4.1.0",
+ "estraverse": "^4.1.1"
+ }
+ },
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "dev": true,
+ "optional": true
+ },
+ "esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^5.2.0"
+ },
+ "dependencies": {
+ "estraverse": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
+ "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
+ "dev": true
+ }
+ }
+ },
+ "estraverse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
+ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+ "dev": true
+ },
+ "esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true
+ },
+ "events": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz",
+ "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==",
+ "dev": true
+ },
+ "evp_bytestokey": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz",
+ "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==",
+ "dev": true,
+ "requires": {
+ "md5.js": "^1.3.4",
+ "safe-buffer": "^5.1.1"
+ }
+ },
+ "exec-buffer": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/exec-buffer/-/exec-buffer-3.2.0.tgz",
+ "integrity": "sha512-wsiD+2Tp6BWHoVv3B+5Dcx6E7u5zky+hUwOHjuH2hKSLR3dvRmX8fk8UD8uqQixHs4Wk6eDmiegVrMPjKj7wpA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "execa": "^0.7.0",
+ "p-finally": "^1.0.0",
+ "pify": "^3.0.0",
+ "rimraf": "^2.5.4",
+ "tempfile": "^2.0.0"
+ }
+ },
+ "execa": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",
+ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "cross-spawn": "^5.0.1",
+ "get-stream": "^3.0.0",
+ "is-stream": "^1.1.0",
+ "npm-run-path": "^2.0.0",
+ "p-finally": "^1.0.0",
+ "signal-exit": "^3.0.0",
+ "strip-eof": "^1.0.0"
+ }
+ },
+ "executable": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz",
+ "integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "pify": "^2.2.0"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "expand-brackets": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
+ "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=",
+ "dev": true,
+ "requires": {
+ "debug": "^2.3.3",
+ "define-property": "^0.2.5",
+ "extend-shallow": "^2.0.1",
+ "posix-character-classes": "^0.1.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "expand-tilde": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz",
+ "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=",
+ "dev": true,
+ "requires": {
+ "homedir-polyfill": "^1.0.1"
+ }
+ },
+ "ext-list": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz",
+ "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "mime-db": "^1.28.0"
+ }
+ },
+ "ext-name": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz",
+ "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ext-list": "^2.0.0",
+ "sort-keys-length": "^1.0.0"
+ }
+ },
+ "extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+ "dev": true
+ },
+ "extend-shallow": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
+ "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=",
+ "dev": true,
+ "requires": {
+ "assign-symbols": "^1.0.0",
+ "is-extendable": "^1.0.1"
+ },
+ "dependencies": {
+ "is-extendable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
+ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
+ "dev": true,
+ "requires": {
+ "is-plain-object": "^2.0.4"
+ }
+ }
+ }
+ },
+ "extglob": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
+ "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
+ "dev": true,
+ "requires": {
+ "array-unique": "^0.3.2",
+ "define-property": "^1.0.0",
+ "expand-brackets": "^2.1.4",
+ "extend-shallow": "^2.0.1",
+ "fragment-cache": "^0.2.1",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "fancy-log": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz",
+ "integrity": "sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw==",
+ "dev": true,
+ "requires": {
+ "ansi-gray": "^0.1.1",
+ "color-support": "^1.1.3",
+ "parse-node-version": "^1.0.0",
+ "time-stamp": "^1.0.0"
+ }
+ },
+ "fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true
+ },
+ "fastq": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.6.0.tgz",
+ "integrity": "sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA==",
+ "dev": true,
+ "requires": {
+ "reusify": "^1.0.0"
+ }
+ },
+ "faye-websocket": {
+ "version": "0.10.0",
+ "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz",
+ "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=",
+ "dev": true,
+ "requires": {
+ "websocket-driver": ">=0.5.1"
+ }
+ },
+ "fd-slicer": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
+ "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "pend": "~1.2.0"
+ }
+ },
+ "figgy-pudding": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz",
+ "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==",
+ "dev": true
+ },
+ "figures": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz",
+ "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "escape-string-regexp": "^1.0.5",
+ "object-assign": "^4.1.0"
+ }
+ },
+ "file-type": {
+ "version": "12.4.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-12.4.0.tgz",
+ "integrity": "sha512-WTvyKq8yjtNmUtVAD8LGcTkvtCdJglM6ks2HTqEClm6+65XTqM6MoZYA1Vtra50DLRWLiM38fEs1y56f5VhnUA==",
+ "dev": true
+ },
+ "file-uri-to-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+ "dev": true,
+ "optional": true
+ },
+ "filename-reserved-regex": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz",
+ "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=",
+ "dev": true,
+ "optional": true
+ },
+ "filenamify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-2.1.0.tgz",
+ "integrity": "sha512-ICw7NTT6RsDp2rnYKVd8Fu4cr6ITzGy3+u4vUujPkabyaz+03F24NWEX7fs5fp+kBonlaqPH8fAO2NM+SXt/JA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "filename-reserved-regex": "^2.0.0",
+ "strip-outer": "^1.0.0",
+ "trim-repeated": "^1.0.0"
+ }
+ },
+ "fill-range": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
+ "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
+ "dev": true,
+ "requires": {
+ "extend-shallow": "^2.0.1",
+ "is-number": "^3.0.0",
+ "repeat-string": "^1.6.1",
+ "to-regex-range": "^2.1.0"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "find-cache-dir": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz",
+ "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==",
+ "dev": true,
+ "requires": {
+ "commondir": "^1.0.1",
+ "make-dir": "^2.0.0",
+ "pkg-dir": "^3.0.0"
+ },
+ "dependencies": {
+ "make-dir": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
+ "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
+ "dev": true,
+ "requires": {
+ "pify": "^4.0.1",
+ "semver": "^5.6.0"
+ }
+ },
+ "pify": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
+ "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
+ "dev": true
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
+ }
+ },
+ "find-root": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
+ "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng=="
+ },
+ "find-up": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
+ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
+ "dev": true,
+ "requires": {
+ "path-exists": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "find-versions": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz",
+ "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "semver-regex": "^2.0.0"
+ }
+ },
+ "findup-sync": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz",
+ "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==",
+ "dev": true,
+ "requires": {
+ "detect-file": "^1.0.0",
+ "is-glob": "^4.0.0",
+ "micromatch": "^3.0.4",
+ "resolve-dir": "^1.0.1"
+ },
+ "dependencies": {
+ "is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ }
+ }
+ },
+ "fined": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/fined/-/fined-1.2.0.tgz",
+ "integrity": "sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==",
+ "dev": true,
+ "requires": {
+ "expand-tilde": "^2.0.2",
+ "is-plain-object": "^2.0.3",
+ "object.defaults": "^1.1.0",
+ "object.pick": "^1.2.0",
+ "parse-filepath": "^1.0.1"
+ }
+ },
+ "flagged-respawn": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz",
+ "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==",
+ "dev": true
+ },
+ "flush-write-stream": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz",
+ "integrity": "sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.3.6"
+ }
+ },
+ "for-in": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
+ "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=",
+ "dev": true
+ },
+ "for-own": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz",
+ "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=",
+ "dev": true,
+ "requires": {
+ "for-in": "^1.0.1"
+ }
+ },
+ "fork-stream": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz",
+ "integrity": "sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA=",
+ "dev": true
+ },
+ "fragment-cache": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
+ "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=",
+ "dev": true,
+ "requires": {
+ "map-cache": "^0.2.2"
+ }
+ },
+ "from2": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
+ "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.1",
+ "readable-stream": "^2.0.0"
+ }
+ },
+ "fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
+ "dev": true,
+ "optional": true
+ },
+ "fs-mkdirp-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz",
+ "integrity": "sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.11",
+ "through2": "^2.0.3"
+ }
+ },
+ "fs-write-stream-atomic": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz",
+ "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "iferr": "^0.1.5",
+ "imurmurhash": "^0.1.4",
+ "readable-stream": "1 || 2"
+ }
+ },
+ "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": "1.2.12",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz",
+ "integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "bindings": "^1.5.0",
+ "nan": "^2.12.1",
+ "node-pre-gyp": "*"
+ },
+ "dependencies": {
+ "abbrev": {
+ "version": "1.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "aproba": {
+ "version": "1.2.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "are-we-there-yet": {
+ "version": "1.1.5",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "delegates": "^1.0.0",
+ "readable-stream": "^2.0.6"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "chownr": {
+ "version": "1.1.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "console-control-strings": {
+ "version": "1.1.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "debug": {
+ "version": "3.2.6",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "deep-extend": {
+ "version": "0.6.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "delegates": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "detect-libc": {
+ "version": "1.0.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "fs-minipass": {
+ "version": "1.2.7",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "minipass": "^2.6.0"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "gauge": {
+ "version": "2.7.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "aproba": "^1.0.3",
+ "console-control-strings": "^1.0.0",
+ "has-unicode": "^2.0.0",
+ "object-assign": "^4.1.0",
+ "signal-exit": "^3.0.0",
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wide-align": "^1.1.0"
+ }
+ },
+ "glob": {
+ "version": "7.1.6",
+ "bundled": true,
+ "dev": true,
+ "optional": 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"
+ }
+ },
+ "has-unicode": {
+ "version": "2.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "ignore-walk": {
+ "version": "3.0.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "minimatch": "^3.0.4"
+ }
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "ini": {
+ "version": "1.3.5",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "minipass": {
+ "version": "2.9.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.0"
+ }
+ },
+ "minizlib": {
+ "version": "1.3.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "minipass": "^2.9.0"
+ }
+ },
+ "mkdirp": {
+ "version": "0.5.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "needle": {
+ "version": "2.3.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "debug": "^3.2.6",
+ "iconv-lite": "^0.4.4",
+ "sax": "^1.2.4"
+ }
+ },
+ "node-pre-gyp": {
+ "version": "0.14.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "detect-libc": "^1.0.2",
+ "mkdirp": "^0.5.1",
+ "needle": "^2.2.1",
+ "nopt": "^4.0.1",
+ "npm-packlist": "^1.1.6",
+ "npmlog": "^4.0.2",
+ "rc": "^1.2.7",
+ "rimraf": "^2.6.1",
+ "semver": "^5.3.0",
+ "tar": "^4.4.2"
+ }
+ },
+ "nopt": {
+ "version": "4.0.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "abbrev": "1",
+ "osenv": "^0.1.4"
+ }
+ },
+ "npm-bundled": {
+ "version": "1.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "npm-normalize-package-bin": "^1.0.1"
+ }
+ },
+ "npm-normalize-package-bin": {
+ "version": "1.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "npm-packlist": {
+ "version": "1.4.8",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ignore-walk": "^3.0.1",
+ "npm-bundled": "^1.0.1",
+ "npm-normalize-package-bin": "^1.0.1"
+ }
+ },
+ "npmlog": {
+ "version": "4.1.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "are-we-there-yet": "~1.1.2",
+ "console-control-strings": "~1.1.0",
+ "gauge": "~2.7.3",
+ "set-blocking": "~2.0.0"
+ }
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "os-homedir": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "osenv": {
+ "version": "0.1.5",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "os-homedir": "^1.0.0",
+ "os-tmpdir": "^1.0.0"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "process-nextick-args": {
+ "version": "2.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "rc": {
+ "version": "1.2.8",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ }
+ },
+ "readable-stream": {
+ "version": "2.3.7",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "rimraf": {
+ "version": "2.7.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "sax": {
+ "version": "1.2.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "semver": {
+ "version": "5.7.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "tar": {
+ "version": "4.4.13",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "chownr": "^1.1.1",
+ "fs-minipass": "^1.2.5",
+ "minipass": "^2.8.6",
+ "minizlib": "^1.2.1",
+ "mkdirp": "^0.5.0",
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.3"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "wide-align": {
+ "version": "1.1.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "string-width": "^1.0.2 || 2"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "yallist": {
+ "version": "3.1.1",
+ "bundled": true,
+ "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=="
+ },
+ "gensync": {
+ "version": "1.0.0-beta.2",
+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
+ "dev": true
+ },
+ "get-caller-file": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
+ "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
+ "dev": true
+ },
+ "get-proxy": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/get-proxy/-/get-proxy-2.1.0.tgz",
+ "integrity": "sha512-zmZIaQTWnNQb4R4fJUEp/FC51eZsc6EkErspy3xtIYStaq8EB/hDIWipxsal+E8rz0qD7f2sL/NA9Xee4RInJw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "npm-conf": "^1.1.0"
+ }
+ },
+ "get-stdin": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
+ "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=",
+ "dev": true,
+ "optional": true
+ },
+ "get-stream": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
+ "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
+ "dev": true,
+ "optional": true
+ },
+ "get-value": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz",
+ "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=",
+ "dev": true
+ },
+ "gifsicle": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/gifsicle/-/gifsicle-4.0.1.tgz",
+ "integrity": "sha512-A/kiCLfDdV+ERV/UB+2O41mifd+RxH8jlRG8DMxZO84Bma/Fw0htqZ+hY2iaalLRNyUu7tYZQslqUBJxBggxbg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "bin-build": "^3.0.0",
+ "bin-wrapper": "^4.0.0",
+ "execa": "^1.0.0",
+ "logalot": "^2.0.0"
+ },
+ "dependencies": {
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "execa": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
+ "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "cross-spawn": "^6.0.0",
+ "get-stream": "^4.0.0",
+ "is-stream": "^1.1.0",
+ "npm-run-path": "^2.0.0",
+ "p-finally": "^1.0.0",
+ "signal-exit": "^3.0.0",
+ "strip-eof": "^1.0.0"
+ }
+ },
+ "get-stream": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
+ "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "glob": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
+ "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
+ "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"
+ }
+ },
+ "glob-parent": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
+ "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
+ "dev": true,
+ "requires": {
+ "is-glob": "^3.1.0",
+ "path-dirname": "^1.0.0"
+ }
+ },
+ "glob-stream": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz",
+ "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=",
+ "dev": true,
+ "requires": {
+ "extend": "^3.0.0",
+ "glob": "^7.1.1",
+ "glob-parent": "^3.1.0",
+ "is-negated-glob": "^1.0.0",
+ "ordered-read-streams": "^1.0.0",
+ "pumpify": "^1.3.5",
+ "readable-stream": "^2.1.5",
+ "remove-trailing-separator": "^1.0.1",
+ "to-absolute-glob": "^2.0.0",
+ "unique-stream": "^2.0.2"
+ }
+ },
+ "glob-watcher": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-5.0.3.tgz",
+ "integrity": "sha512-8tWsULNEPHKQ2MR4zXuzSmqbdyV5PtwwCaWSGQ1WwHsJ07ilNeN1JB8ntxhckbnpSHaf9dXFUHzIWvm1I13dsg==",
+ "dev": true,
+ "requires": {
+ "anymatch": "^2.0.0",
+ "async-done": "^1.2.0",
+ "chokidar": "^2.0.0",
+ "is-negated-glob": "^1.0.0",
+ "just-debounce": "^1.0.0",
+ "object.defaults": "^1.1.0"
+ }
+ },
+ "global-modules": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz",
+ "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==",
+ "dev": true,
+ "requires": {
+ "global-prefix": "^1.0.1",
+ "is-windows": "^1.0.1",
+ "resolve-dir": "^1.0.0"
+ }
+ },
+ "global-prefix": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz",
+ "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=",
+ "dev": true,
+ "requires": {
+ "expand-tilde": "^2.0.2",
+ "homedir-polyfill": "^1.0.1",
+ "ini": "^1.3.4",
+ "is-windows": "^1.0.1",
+ "which": "^1.2.14"
+ }
+ },
+ "globals": {
+ "version": "11.12.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
+ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
+ "dev": true
+ },
+ "globby": {
+ "version": "10.0.1",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz",
+ "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==",
+ "dev": true,
+ "requires": {
+ "@types/glob": "^7.1.1",
+ "array-union": "^2.1.0",
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.0.3",
+ "glob": "^7.1.3",
+ "ignore": "^5.1.1",
+ "merge2": "^1.2.3",
+ "slash": "^3.0.0"
+ },
+ "dependencies": {
+ "@nodelib/fs.stat": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.2.tgz",
+ "integrity": "sha512-z8+wGWV2dgUhLqrtRYa03yDx4HWMvXKi1z8g3m2JyxAx8F7xk74asqPk5LAETjqDSGLFML/6CDl0+yFunSYicw==",
+ "dev": true
+ },
+ "array-union": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
+ "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
+ "dev": true
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "dir-glob": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
+ "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
+ "dev": true,
+ "requires": {
+ "path-type": "^4.0.0"
+ }
+ },
+ "fast-glob": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.0.4.tgz",
+ "integrity": "sha512-wkIbV6qg37xTJwqSsdnIphL1e+LaGz4AIQqr00mIubMaEhv1/HEmJ0uuCGZRNRUkZZmOB5mJKO0ZUTVq+SxMQg==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.stat": "^2.0.1",
+ "@nodelib/fs.walk": "^1.2.1",
+ "glob-parent": "^5.0.0",
+ "is-glob": "^4.0.1",
+ "merge2": "^1.2.3",
+ "micromatch": "^4.0.2"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "glob-parent": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz",
+ "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==",
+ "dev": true,
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "path-type": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
+ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
+ "dev": true
+ },
+ "slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "glogg": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz",
+ "integrity": "sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw==",
+ "dev": true,
+ "requires": {
+ "sparkles": "^1.0.0"
+ }
+ },
+ "got": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz",
+ "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "decompress-response": "^3.2.0",
+ "duplexer3": "^0.1.4",
+ "get-stream": "^3.0.0",
+ "is-plain-obj": "^1.1.0",
+ "is-retry-allowed": "^1.0.0",
+ "is-stream": "^1.0.0",
+ "isurl": "^1.0.0-alpha5",
+ "lowercase-keys": "^1.0.0",
+ "p-cancelable": "^0.3.0",
+ "p-timeout": "^1.1.1",
+ "safe-buffer": "^5.0.1",
+ "timed-out": "^4.0.0",
+ "url-parse-lax": "^1.0.0",
+ "url-to-options": "^1.0.1"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz",
+ "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==",
+ "dev": true
+ },
+ "graceful-readlink": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
+ "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
+ "dev": true,
+ "optional": true
+ },
+ "gulp": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz",
+ "integrity": "sha512-dvEs27SCZt2ibF29xYgmnwwCYZxdxhQ/+LFWlbAW8y7jt68L/65402Lz3+CKy0Ov4rOs+NERmDq7YlZaDqUIfA==",
+ "dev": true,
+ "requires": {
+ "glob-watcher": "^5.0.3",
+ "gulp-cli": "^2.2.0",
+ "undertaker": "^1.2.1",
+ "vinyl-fs": "^3.0.0"
+ },
+ "dependencies": {
+ "gulp-cli": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.2.0.tgz",
+ "integrity": "sha512-rGs3bVYHdyJpLqR0TUBnlcZ1O5O++Zs4bA0ajm+zr3WFCfiSLjGwoCBqFs18wzN+ZxahT9DkOK5nDf26iDsWjA==",
+ "dev": true,
+ "requires": {
+ "ansi-colors": "^1.0.1",
+ "archy": "^1.0.0",
+ "array-sort": "^1.0.0",
+ "color-support": "^1.1.3",
+ "concat-stream": "^1.6.0",
+ "copy-props": "^2.0.1",
+ "fancy-log": "^1.3.2",
+ "gulplog": "^1.0.0",
+ "interpret": "^1.1.0",
+ "isobject": "^3.0.1",
+ "liftoff": "^3.1.0",
+ "matchdep": "^2.0.0",
+ "mute-stdout": "^1.0.0",
+ "pretty-hrtime": "^1.0.0",
+ "replace-homedir": "^1.0.0",
+ "semver-greatest-satisfied-range": "^1.1.0",
+ "v8flags": "^3.0.1",
+ "yargs": "^7.1.0"
+ }
+ }
+ }
+ },
+ "gulp-if": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz",
+ "integrity": "sha512-fCUEngzNiEZEK2YuPm+sdMpO6ukb8+/qzbGfJBXyNOXz85bCG7yBI+pPSl+N90d7gnLvMsarthsAImx0qy7BAw==",
+ "dev": true,
+ "requires": {
+ "gulp-match": "^1.1.0",
+ "ternary-stream": "^3.0.0",
+ "through2": "^3.0.1"
+ },
+ "dependencies": {
+ "through2": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz",
+ "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==",
+ "dev": true,
+ "requires": {
+ "readable-stream": "2 || 3"
+ }
+ }
+ }
+ },
+ "gulp-imagemin": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/gulp-imagemin/-/gulp-imagemin-6.2.0.tgz",
+ "integrity": "sha512-luHT+8kUz60KGzjJLUFzaPjl4b38UQLj8BJGkpJACRjiVEuzjohMOmLagkgXs+Rs4vYaUBr9tt1F/vLizaxgGg==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.1",
+ "fancy-log": "^1.3.2",
+ "imagemin": "^7.0.0",
+ "imagemin-gifsicle": "^6.0.1",
+ "imagemin-jpegtran": "^6.0.0",
+ "imagemin-optipng": "^7.0.0",
+ "imagemin-svgo": "^7.0.0",
+ "plugin-error": "^1.0.1",
+ "plur": "^3.0.1",
+ "pretty-bytes": "^5.3.0",
+ "through2-concurrent": "^2.0.0"
+ }
+ },
+ "gulp-livereload": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/gulp-livereload/-/gulp-livereload-4.0.2.tgz",
+ "integrity": "sha512-InmaR50Xl1xB1WdEk4mrUgGHv3VhhlRLrx7u60iY5AAer90FlK95KXitPcGGQoi28zrUJM189d/h6+V470Ncgg==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.1",
+ "debug": "^3.1.0",
+ "fancy-log": "^1.3.2",
+ "lodash.assign": "^4.2.0",
+ "readable-stream": "^3.0.6",
+ "tiny-lr": "^1.1.1",
+ "vinyl": "^2.2.0"
+ },
+ "dependencies": {
+ "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,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "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,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "clone": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
+ "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=",
+ "dev": true
+ },
+ "clone-stats": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz",
+ "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=",
+ "dev": true
+ },
+ "debug": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
+ "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz",
+ "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "replace-ext": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz",
+ "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=",
+ "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,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "vinyl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz",
+ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==",
+ "dev": true,
+ "requires": {
+ "clone": "^2.1.1",
+ "clone-buffer": "^1.0.0",
+ "clone-stats": "^1.0.0",
+ "cloneable-readable": "^1.0.0",
+ "remove-trailing-separator": "^1.0.1",
+ "replace-ext": "^1.0.0"
+ }
+ }
+ }
+ },
+ "gulp-match": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.1.0.tgz",
+ "integrity": "sha512-DlyVxa1Gj24DitY2OjEsS+X6tDpretuxD6wTfhXE/Rw2hweqc1f6D/XtsJmoiCwLWfXgR87W9ozEityPCVzGtQ==",
+ "dev": true,
+ "requires": {
+ "minimatch": "^3.0.3"
+ }
+ },
+ "gulp-replace": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.0.0.tgz",
+ "integrity": "sha512-lgdmrFSI1SdhNMXZQbrC75MOl1UjYWlOWNbNRnz+F/KHmgxt3l6XstBoAYIdadwETFyG/6i+vWUSCawdC3pqOw==",
+ "dev": true,
+ "requires": {
+ "istextorbinary": "2.2.1",
+ "readable-stream": "^2.0.1",
+ "replacestream": "^4.0.0"
+ }
+ },
+ "gulp-zip": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/gulp-zip/-/gulp-zip-5.0.2.tgz",
+ "integrity": "sha512-rZd0Ppuc8Bf7J2/WzcdNaeb+lcEXf1R8mV/PJ9Kdu7PmnInWVeLSmiXIka/2QSe6uhAsGVFAMffWSaMzAPGTBg==",
+ "dev": true,
+ "requires": {
+ "get-stream": "^5.1.0",
+ "plugin-error": "^1.0.1",
+ "through2": "^3.0.1",
+ "vinyl": "^2.1.0",
+ "yazl": "^2.5.1"
+ },
+ "dependencies": {
+ "get-stream": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
+ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
+ "dev": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "through2": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
+ "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.4",
+ "readable-stream": "2 || 3"
+ }
+ }
+ }
+ },
+ "gulplog": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz",
+ "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=",
+ "dev": true,
+ "requires": {
+ "glogg": "^1.0.0"
+ }
+ },
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
+ "has-ansi": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
+ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
+ },
+ "has-symbol-support-x": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz",
+ "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==",
+ "dev": true,
+ "optional": true
+ },
+ "has-symbols": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
+ "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=",
+ "dev": true
+ },
+ "has-to-string-tag-x": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz",
+ "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "has-symbol-support-x": "^1.4.1"
+ }
+ },
+ "has-value": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
+ "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=",
+ "dev": true,
+ "requires": {
+ "get-value": "^2.0.6",
+ "has-values": "^1.0.0",
+ "isobject": "^3.0.0"
+ }
+ },
+ "has-values": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz",
+ "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=",
+ "dev": true,
+ "requires": {
+ "is-number": "^3.0.0",
+ "kind-of": "^4.0.0"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
+ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "hash-base": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz",
+ "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.6.0",
+ "safe-buffer": "^5.2.0"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true
+ }
+ }
+ },
+ "hash.js": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
+ "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "minimalistic-assert": "^1.0.1"
+ }
+ },
+ "hmac-drbg": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
+ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=",
+ "dev": true,
+ "requires": {
+ "hash.js": "^1.0.3",
+ "minimalistic-assert": "^1.0.0",
+ "minimalistic-crypto-utils": "^1.0.1"
+ }
+ },
+ "hoist-non-react-statics": {
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
+ "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
+ "requires": {
+ "react-is": "^16.7.0"
+ }
+ },
+ "homedir-polyfill": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz",
+ "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=",
+ "dev": true,
+ "requires": {
+ "parse-passwd": "^1.0.0"
+ }
+ },
+ "hosted-git-info": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz",
+ "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",
+ "dev": true
+ },
+ "html-comment-regex": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.2.tgz",
+ "integrity": "sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==",
+ "dev": true,
+ "optional": true
+ },
+ "http-cache-semantics": {
+ "version": "3.8.1",
+ "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz",
+ "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==",
+ "dev": true,
+ "optional": true
+ },
+ "http-parser-js": {
+ "version": "0.4.10",
+ "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.10.tgz",
+ "integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q=",
+ "dev": true
+ },
+ "https-browserify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz",
+ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=",
+ "dev": true
+ },
+ "ieee754": {
+ "version": "1.1.13",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
+ "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==",
+ "dev": true
+ },
+ "iferr": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz",
+ "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=",
+ "dev": true
+ },
+ "ignore": {
+ "version": "5.1.4",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz",
+ "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==",
+ "dev": true
+ },
+ "imagemin": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/imagemin/-/imagemin-7.0.1.tgz",
+ "integrity": "sha512-33AmZ+xjZhg2JMCe+vDf6a9mzWukE7l+wAtesjE7KyteqqKjzxv7aVQeWnul1Ve26mWvEQqyPwl0OctNBfSR9w==",
+ "dev": true,
+ "requires": {
+ "file-type": "^12.0.0",
+ "globby": "^10.0.0",
+ "graceful-fs": "^4.2.2",
+ "junk": "^3.1.0",
+ "make-dir": "^3.0.0",
+ "p-pipe": "^3.0.0",
+ "replace-ext": "^1.0.0"
+ }
+ },
+ "imagemin-gifsicle": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/imagemin-gifsicle/-/imagemin-gifsicle-6.0.1.tgz",
+ "integrity": "sha512-kuu47c6iKDQ6R9J10xCwL0lgs0+sMz3LRHqRcJ2CRBWdcNmo3T5hUaM8hSZfksptZXJLGKk8heSAvwtSdB1Fng==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "exec-buffer": "^3.0.0",
+ "gifsicle": "^4.0.0",
+ "is-gif": "^3.0.0"
+ }
+ },
+ "imagemin-jpegtran": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/imagemin-jpegtran/-/imagemin-jpegtran-6.0.0.tgz",
+ "integrity": "sha512-Ih+NgThzqYfEWv9t58EItncaaXIHR0u9RuhKa8CtVBlMBvY0dCIxgQJQCfwImA4AV1PMfmUKlkyIHJjb7V4z1g==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "exec-buffer": "^3.0.0",
+ "is-jpg": "^2.0.0",
+ "jpegtran-bin": "^4.0.0"
+ }
+ },
+ "imagemin-optipng": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/imagemin-optipng/-/imagemin-optipng-7.1.0.tgz",
+ "integrity": "sha512-JNORTZ6j6untH7e5gF4aWdhDCxe3ODsSLKs/f7Grewy3ebZpl1ZsU+VUTPY4rzeHgaFA8GSWOoA8V2M3OixWZQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "exec-buffer": "^3.0.0",
+ "is-png": "^2.0.0",
+ "optipng-bin": "^6.0.0"
+ }
+ },
+ "imagemin-svgo": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/imagemin-svgo/-/imagemin-svgo-7.0.0.tgz",
+ "integrity": "sha512-+iGJFaPIMx8TjFW6zN+EkOhlqcemdL7F3N3Y0wODvV2kCUBuUtZK7DRZc1+Zfu4U2W/lTMUyx2G8YMOrZntIWg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-svg": "^3.0.0",
+ "svgo": "^1.0.5"
+ }
+ },
+ "import-fresh": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz",
+ "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==",
+ "requires": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ }
+ },
+ "import-lazy": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-3.1.0.tgz",
+ "integrity": "sha512-8/gvXvX2JMn0F+CDlSC4l6kOmVaLOO3XLkksI7CI3Ud95KDYJuYur2b9P/PUt/i/pDAMd/DulQsNbbbmRRsDIQ==",
+ "dev": true,
+ "optional": true
+ },
+ "import-local": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz",
+ "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==",
+ "dev": true,
+ "requires": {
+ "pkg-dir": "^3.0.0",
+ "resolve-cwd": "^2.0.0"
+ }
+ },
+ "imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
+ "dev": true
+ },
+ "indent-string": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz",
+ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "repeating": "^2.0.0"
+ }
+ },
+ "infer-owner": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",
+ "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==",
+ "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.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "dev": true
+ },
+ "ini": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
+ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
+ "dev": true
+ },
+ "interpret": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz",
+ "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==",
+ "dev": true
+ },
+ "into-stream": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz",
+ "integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "from2": "^2.1.1",
+ "p-is-promise": "^1.1.0"
+ }
+ },
+ "invert-kv": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
+ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
+ "dev": true
+ },
+ "irregular-plurals": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-2.0.0.tgz",
+ "integrity": "sha512-Y75zBYLkh0lJ9qxeHlMjQ7bSbyiSqNW/UOPWDmzC7cXskL1hekSITh1Oc6JV0XCWWZ9DE8VYSB71xocLk3gmGw==",
+ "dev": true
+ },
+ "is-absolute": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz",
+ "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==",
+ "dev": true,
+ "requires": {
+ "is-relative": "^1.0.0",
+ "is-windows": "^1.0.1"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
+ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
+ },
+ "is-binary-path": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz",
+ "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=",
+ "dev": true,
+ "requires": {
+ "binary-extensions": "^1.0.0"
+ }
+ },
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true
+ },
+ "is-builtin-module": {
+ "version": "1.0.0",
+ "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
+ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
+ "dev": true,
+ "requires": {
+ "builtin-modules": "^1.0.0"
+ }
+ },
+ "is-callable": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
+ "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",
+ "dev": true,
+ "optional": 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==",
+ "requires": {
+ "has": "^1.0.3"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
+ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-date-object": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
+ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
+ "dev": true,
+ "optional": true
+ },
+ "is-descriptor": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
+ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^0.1.6",
+ "is-data-descriptor": "^0.1.4",
+ "kind-of": "^5.0.0"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
+ "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "dev": true
+ }
+ }
+ },
+ "is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=",
+ "dev": true
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
+ "dev": true
+ },
+ "is-finite": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz",
+ "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "dev": true,
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "is-gif": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-gif/-/is-gif-3.0.0.tgz",
+ "integrity": "sha512-IqJ/jlbw5WJSNfwQ/lHEDXF8rxhRgF6ythk2oiEvhpG29F704eX9NO6TvPfMiq9DrbwgcEDnETYNcZDPewQoVw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "file-type": "^10.4.0"
+ },
+ "dependencies": {
+ "file-type": {
+ "version": "10.11.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-10.11.0.tgz",
+ "integrity": "sha512-uzk64HRpUZyTGZtVuvrjP0FYxzQrBf4rojot6J65YMEbwBLB0CWm0CLojVpwpmFmxcE/lkvYICgfcGozbBq6rw==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "is-glob": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
+ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.0"
+ }
+ },
+ "is-jpg": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-jpg/-/is-jpg-2.0.0.tgz",
+ "integrity": "sha1-LhmX+m6RZuqsAkLarkQ0A+TvHZc=",
+ "dev": true,
+ "optional": true
+ },
+ "is-natural-number": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz",
+ "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=",
+ "dev": true,
+ "optional": true
+ },
+ "is-negated-glob": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz",
+ "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=",
+ "dev": true
+ },
+ "is-number": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
+ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-object": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz",
+ "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=",
+ "dev": true,
+ "optional": true
+ },
+ "is-path-cwd": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
+ "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==",
+ "dev": true
+ },
+ "is-path-inside": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.1.tgz",
+ "integrity": "sha512-CKstxrctq1kUesU6WhtZDbYKzzYBuRH0UYInAVrkc/EYdB9ltbfE0gOoayG9nhohG6447sOOVGhHqsdmBvkbNg==",
+ "dev": true
+ },
+ "is-plain-obj": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
+ "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=",
+ "dev": true,
+ "optional": true
+ },
+ "is-plain-object": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
+ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
+ "dev": true,
+ "requires": {
+ "isobject": "^3.0.1"
+ }
+ },
+ "is-png": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-png/-/is-png-2.0.0.tgz",
+ "integrity": "sha512-4KPGizaVGj2LK7xwJIz8o5B2ubu1D/vcQsgOGFEDlpcvgZHto4gBnyd0ig7Ws+67ixmwKoNmu0hYnpo6AaKb5g==",
+ "dev": true,
+ "optional": true
+ },
+ "is-regex": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz",
+ "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "has": "^1.0.3"
+ }
+ },
+ "is-relative": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz",
+ "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==",
+ "dev": true,
+ "requires": {
+ "is-unc-path": "^1.0.0"
+ }
+ },
+ "is-retry-allowed": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz",
+ "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==",
+ "dev": true,
+ "optional": true
+ },
+ "is-stream": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
+ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
+ "dev": true,
+ "optional": true
+ },
+ "is-svg": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-3.0.0.tgz",
+ "integrity": "sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "html-comment-regex": "^1.1.0"
+ }
+ },
+ "is-symbol": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
+ "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "has-symbols": "^1.0.1"
+ },
+ "dependencies": {
+ "has-symbols": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
+ "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "is-unc-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz",
+ "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==",
+ "dev": true,
+ "requires": {
+ "unc-path-regex": "^0.1.2"
+ }
+ },
+ "is-utf8": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
+ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
+ "dev": true
+ },
+ "is-valid-glob": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz",
+ "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=",
+ "dev": true
+ },
+ "is-windows": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
+ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
+ "dev": true
+ },
+ "is-wsl": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
+ "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=",
+ "dev": true
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
+ "dev": true
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
+ },
+ "isobject": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
+ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
+ "dev": true
+ },
+ "istextorbinary": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-2.2.1.tgz",
+ "integrity": "sha512-TS+hoFl8Z5FAFMK38nhBkdLt44CclNRgDHWeMgsV8ko3nDlr/9UI2Sf839sW7enijf8oKsZYXRvM8g0it9Zmcw==",
+ "dev": true,
+ "requires": {
+ "binaryextensions": "2",
+ "editions": "^1.3.3",
+ "textextensions": "2"
+ }
+ },
+ "isurl": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz",
+ "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "has-to-string-tag-x": "^1.2.0",
+ "is-object": "^1.0.1"
+ }
+ },
+ "jpegtran-bin": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jpegtran-bin/-/jpegtran-bin-4.0.0.tgz",
+ "integrity": "sha512-2cRl1ism+wJUoYAYFt6O/rLBfpXNWG2dUWbgcEkTt5WGMnqI46eEro8T4C5zGROxKRqyKpCBSdHPvt5UYCtxaQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "bin-build": "^3.0.0",
+ "bin-wrapper": "^4.0.0",
+ "logalot": "^2.0.0"
+ }
+ },
+ "js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
+ },
+ "js-yaml": {
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
+ "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "jsesc": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
+ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+ "dev": true
+ },
+ "json-buffer": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz",
+ "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=",
+ "dev": true,
+ "optional": true
+ },
+ "json-parse-better-errors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
+ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
+ "dev": true
+ },
+ "json-parse-even-better-errors": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
+ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="
+ },
+ "json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true
+ },
+ "json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
+ "dev": true
+ },
+ "json5": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
+ "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "junk": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz",
+ "integrity": "sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ==",
+ "dev": true
+ },
+ "just-debounce": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz",
+ "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=",
+ "dev": true
+ },
+ "keyv": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz",
+ "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "json-buffer": "3.0.0"
+ }
+ },
+ "kind-of": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
+ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
+ "dev": true
+ },
+ "last-run": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz",
+ "integrity": "sha1-RblpQsF7HHnHchmCWbqUO+v4yls=",
+ "dev": true,
+ "requires": {
+ "default-resolution": "^2.0.0",
+ "es6-weak-map": "^2.0.1"
+ }
+ },
+ "lazystream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz",
+ "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=",
+ "dev": true,
+ "requires": {
+ "readable-stream": "^2.0.5"
+ }
+ },
+ "lcid": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
+ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
+ "dev": true,
+ "requires": {
+ "invert-kv": "^1.0.0"
+ }
+ },
+ "lead": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz",
+ "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=",
+ "dev": true,
+ "requires": {
+ "flush-write-stream": "^1.0.2"
+ }
+ },
+ "liftoff": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-3.1.0.tgz",
+ "integrity": "sha512-DlIPlJUkCV0Ips2zf2pJP0unEoT1kwYhiiPUGF3s/jtxTCjziNLoiVVh+jqWOWeFi6mmwQ5fNxvAUyPad4Dfog==",
+ "dev": true,
+ "requires": {
+ "extend": "^3.0.0",
+ "findup-sync": "^3.0.0",
+ "fined": "^1.0.1",
+ "flagged-respawn": "^1.0.0",
+ "is-plain-object": "^2.0.4",
+ "object.map": "^1.0.0",
+ "rechoir": "^0.6.2",
+ "resolve": "^1.1.7"
+ }
+ },
+ "lines-and-columns": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
+ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA="
+ },
+ "livereload-js": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-2.4.0.tgz",
+ "integrity": "sha512-XPQH8Z2GDP/Hwz2PCDrh2mth4yFejwA1OZ/81Ti3LgKyhDcEjsSsqFWZojHG0va/duGd+WyosY7eXLDoOyqcPw==",
+ "dev": true
+ },
+ "load-json-file": {
+ "version": "1.1.0",
+ "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
+ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^2.2.0",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0",
+ "strip-bom": "^2.0.0"
+ },
+ "dependencies": {
+ "graceful-fs": {
+ "version": "4.1.15",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
+ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
+ "dev": true
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ },
+ "strip-bom": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
+ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
+ "dev": true,
+ "requires": {
+ "is-utf8": "^0.2.0"
+ }
+ }
+ }
+ },
+ "loader-runner": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz",
+ "integrity": "sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==",
+ "dev": true
+ },
+ "loader-utils": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz",
+ "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==",
+ "dev": true,
+ "requires": {
+ "big.js": "^5.2.2",
+ "emojis-list": "^3.0.0",
+ "json5": "^1.0.1"
+ },
+ "dependencies": {
+ "json5": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
+ "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.0"
+ }
+ }
+ }
+ },
+ "locate-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
+ "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^3.0.0",
+ "path-exists": "^3.0.0"
+ },
+ "dependencies": {
+ "path-exists": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
+ "dev": true
+ }
+ }
+ },
+ "lodash": {
+ "version": "4.17.20",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
+ "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
+ },
+ "lodash.assign": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz",
+ "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=",
+ "dev": true
+ },
+ "logalot": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/logalot/-/logalot-2.1.0.tgz",
+ "integrity": "sha1-X46MkNME7fElMJUaVVSruMXj9VI=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "figures": "^1.3.5",
+ "squeak": "^1.0.0"
+ }
+ },
+ "longest": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
+ "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
+ "dev": true,
+ "optional": true
+ },
+ "loose-envify": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "requires": {
+ "js-tokens": "^3.0.0 || ^4.0.0"
+ }
+ },
+ "loud-rejection": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz",
+ "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "currently-unhandled": "^0.4.1",
+ "signal-exit": "^3.0.0"
+ }
+ },
+ "lowercase-keys": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
+ "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==",
+ "dev": true,
+ "optional": true
+ },
+ "lpad-align": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/lpad-align/-/lpad-align-1.1.2.tgz",
+ "integrity": "sha1-IfYArBwwlcPG5JfuZyce4ISB/p4=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "get-stdin": "^4.0.1",
+ "indent-string": "^2.1.0",
+ "longest": "^1.0.0",
+ "meow": "^3.3.0"
+ }
+ },
+ "lru-cache": {
+ "version": "4.1.5",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
+ "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "pseudomap": "^1.0.2",
+ "yallist": "^2.1.2"
+ }
+ },
+ "make-dir": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.0.tgz",
+ "integrity": "sha512-grNJDhb8b1Jm1qeqW5R/O63wUo4UXo2v2HMic6YT9i/HBlF93S8jkMgH7yugvY9ABDShH4VZMn8I+U8+fCNegw==",
+ "dev": true,
+ "requires": {
+ "semver": "^6.0.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ }
+ }
+ },
+ "make-iterator": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz",
+ "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.2"
+ }
+ },
+ "map-cache": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
+ "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=",
+ "dev": true
+ },
+ "map-obj": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
+ "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
+ "dev": true,
+ "optional": true
+ },
+ "map-visit": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
+ "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=",
+ "dev": true,
+ "requires": {
+ "object-visit": "^1.0.0"
+ }
+ },
+ "matchdep": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz",
+ "integrity": "sha1-xvNINKDY28OzfCfui7yyfHd1WC4=",
+ "dev": true,
+ "requires": {
+ "findup-sync": "^2.0.0",
+ "micromatch": "^3.0.4",
+ "resolve": "^1.4.0",
+ "stack-trace": "0.0.10"
+ },
+ "dependencies": {
+ "findup-sync": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz",
+ "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=",
+ "dev": true,
+ "requires": {
+ "detect-file": "^1.0.0",
+ "is-glob": "^3.1.0",
+ "micromatch": "^3.0.4",
+ "resolve-dir": "^1.0.1"
+ }
+ }
+ }
+ },
+ "md5.js": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
+ "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==",
+ "dev": true,
+ "requires": {
+ "hash-base": "^3.0.0",
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.1.2"
+ }
+ },
+ "mdn-data": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz",
+ "integrity": "sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA==",
+ "dev": true,
+ "optional": true
+ },
+ "memoize-one": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.1.1.tgz",
+ "integrity": "sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA=="
+ },
+ "memory-fs": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz",
+ "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==",
+ "dev": true,
+ "requires": {
+ "errno": "^0.1.3",
+ "readable-stream": "^2.0.1"
+ }
+ },
+ "meow": {
+ "version": "3.7.0",
+ "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
+ "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "camelcase-keys": "^2.0.0",
+ "decamelize": "^1.1.2",
+ "loud-rejection": "^1.0.0",
+ "map-obj": "^1.0.1",
+ "minimist": "^1.1.3",
+ "normalize-package-data": "^2.3.4",
+ "object-assign": "^4.0.1",
+ "read-pkg-up": "^1.0.1",
+ "redent": "^1.0.0",
+ "trim-newlines": "^1.0.0"
+ }
+ },
+ "merge-stream": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
+ "dev": true
+ },
+ "merge2": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.3.tgz",
+ "integrity": "sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "3.1.10",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
+ "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
+ "dev": true,
+ "requires": {
+ "arr-diff": "^4.0.0",
+ "array-unique": "^0.3.2",
+ "braces": "^2.3.1",
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "extglob": "^2.0.4",
+ "fragment-cache": "^0.2.1",
+ "kind-of": "^6.0.2",
+ "nanomatch": "^1.2.9",
+ "object.pick": "^1.3.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.2"
+ }
+ },
+ "miller-rabin": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz",
+ "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.0.0",
+ "brorand": "^1.0.1"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
+ }
+ },
+ "mime-db": {
+ "version": "1.42.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz",
+ "integrity": "sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==",
+ "dev": true,
+ "optional": true
+ },
+ "mimic-response": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
+ "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",
+ "dev": true,
+ "optional": true
+ },
+ "minimalistic-assert": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
+ "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==",
+ "dev": true
+ },
+ "minimalistic-crypto-utils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
+ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=",
+ "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"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "dev": true
+ },
+ "mississippi": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz",
+ "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==",
+ "dev": true,
+ "requires": {
+ "concat-stream": "^1.5.0",
+ "duplexify": "^3.4.2",
+ "end-of-stream": "^1.1.0",
+ "flush-write-stream": "^1.0.0",
+ "from2": "^2.1.0",
+ "parallel-transform": "^1.1.0",
+ "pump": "^3.0.0",
+ "pumpify": "^1.3.3",
+ "stream-each": "^1.1.0",
+ "through2": "^2.0.0"
+ }
+ },
+ "mixin-deep": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
+ "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
+ "dev": true,
+ "requires": {
+ "for-in": "^1.0.2",
+ "is-extendable": "^1.0.1"
+ },
+ "dependencies": {
+ "is-extendable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
+ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
+ "dev": true,
+ "requires": {
+ "is-plain-object": "^2.0.4"
+ }
+ }
+ }
+ },
+ "mkdirp": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
+ "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "move-concurrently": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
+ "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=",
+ "dev": true,
+ "requires": {
+ "aproba": "^1.1.1",
+ "copy-concurrently": "^1.0.0",
+ "fs-write-stream-atomic": "^1.0.8",
+ "mkdirp": "^0.5.1",
+ "rimraf": "^2.5.4",
+ "run-queue": "^1.0.3"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "mute-stdout": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.1.tgz",
+ "integrity": "sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg==",
+ "dev": true
+ },
+ "nan": {
+ "version": "2.14.1",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
+ "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
+ "dev": true,
+ "optional": true
+ },
+ "nanomatch": {
+ "version": "1.2.13",
+ "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
+ "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==",
+ "dev": true,
+ "requires": {
+ "arr-diff": "^4.0.0",
+ "array-unique": "^0.3.2",
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "fragment-cache": "^0.2.1",
+ "is-windows": "^1.0.2",
+ "kind-of": "^6.0.2",
+ "object.pick": "^1.3.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ }
+ },
+ "neo-async": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
+ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
+ "dev": true
+ },
+ "next-tick": {
+ "version": "1.0.0",
+ "resolved": "http://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
+ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=",
+ "dev": true
+ },
+ "nice-try": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
+ "dev": true
+ },
+ "node-libs-browser": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz",
+ "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==",
+ "dev": true,
+ "requires": {
+ "assert": "^1.1.1",
+ "browserify-zlib": "^0.2.0",
+ "buffer": "^4.3.0",
+ "console-browserify": "^1.1.0",
+ "constants-browserify": "^1.0.0",
+ "crypto-browserify": "^3.11.0",
+ "domain-browser": "^1.1.1",
+ "events": "^3.0.0",
+ "https-browserify": "^1.0.0",
+ "os-browserify": "^0.3.0",
+ "path-browserify": "0.0.1",
+ "process": "^0.11.10",
+ "punycode": "^1.2.4",
+ "querystring-es3": "^0.2.0",
+ "readable-stream": "^2.3.3",
+ "stream-browserify": "^2.0.1",
+ "stream-http": "^2.7.2",
+ "string_decoder": "^1.0.0",
+ "timers-browserify": "^2.0.4",
+ "tty-browserify": "0.0.0",
+ "url": "^0.11.0",
+ "util": "^0.11.0",
+ "vm-browserify": "^1.0.1"
+ },
+ "dependencies": {
+ "buffer": {
+ "version": "4.9.2",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
+ "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==",
+ "dev": true,
+ "requires": {
+ "base64-js": "^1.0.2",
+ "ieee754": "^1.1.4",
+ "isarray": "^1.0.0"
+ }
+ },
+ "punycode": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
+ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
+ "dev": true
+ }
+ }
+ },
+ "node-releases": {
+ "version": "1.1.67",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.67.tgz",
+ "integrity": "sha512-V5QF9noGFl3EymEwUYzO+3NTDpGfQB4ve6Qfnzf3UNydMhjQRVPR1DZTuvWiLzaFJYw2fmDwAfnRNEVb64hSIg==",
+ "dev": true
+ },
+ "normalize-package-data": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
+ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
+ "dev": true,
+ "requires": {
+ "hosted-git-info": "^2.1.4",
+ "is-builtin-module": "^1.0.0",
+ "semver": "2 || 3 || 4 || 5",
+ "validate-npm-package-license": "^3.0.1"
+ }
+ },
+ "normalize-path": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
+ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
+ "dev": true,
+ "requires": {
+ "remove-trailing-separator": "^1.0.1"
+ }
+ },
+ "normalize-url": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-2.0.1.tgz",
+ "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "prepend-http": "^2.0.0",
+ "query-string": "^5.0.1",
+ "sort-keys": "^2.0.0"
+ },
+ "dependencies": {
+ "prepend-http": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
+ "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
+ "dev": true,
+ "optional": true
+ },
+ "sort-keys": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz",
+ "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-plain-obj": "^1.0.0"
+ }
+ }
+ }
+ },
+ "now-and-later": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.1.tgz",
+ "integrity": "sha512-KGvQ0cB70AQfg107Xvs/Fbu+dGmZoTRJp2TaPwcwQm3/7PteUyN2BCgk8KBMPGBUXZdVwyWS8fDCGFygBm19UQ==",
+ "dev": true,
+ "requires": {
+ "once": "^1.3.2"
+ }
+ },
+ "npm-conf": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz",
+ "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "config-chain": "^1.1.11",
+ "pify": "^3.0.0"
+ }
+ },
+ "npm-run-path": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
+ "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "path-key": "^2.0.0"
+ }
+ },
+ "nth-check": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
+ "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "boolbase": "~1.0.0"
+ }
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
+ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
+ "dev": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
+ },
+ "object-copy": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
+ "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=",
+ "dev": true,
+ "requires": {
+ "copy-descriptor": "^0.1.0",
+ "define-property": "^0.2.5",
+ "kind-of": "^3.0.3"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "object-inspect": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
+ "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==",
+ "dev": true,
+ "optional": true
+ },
+ "object-keys": {
+ "version": "1.0.12",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz",
+ "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==",
+ "dev": true
+ },
+ "object-visit": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
+ "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=",
+ "dev": true,
+ "requires": {
+ "isobject": "^3.0.0"
+ }
+ },
+ "object.assign": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz",
+ "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "function-bind": "^1.1.1",
+ "has-symbols": "^1.0.0",
+ "object-keys": "^1.0.11"
+ }
+ },
+ "object.defaults": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz",
+ "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=",
+ "dev": true,
+ "requires": {
+ "array-each": "^1.0.1",
+ "array-slice": "^1.0.0",
+ "for-own": "^1.0.0",
+ "isobject": "^3.0.0"
+ }
+ },
+ "object.getownpropertydescriptors": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz",
+ "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.0-next.1"
+ }
+ },
+ "object.map": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz",
+ "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=",
+ "dev": true,
+ "requires": {
+ "for-own": "^1.0.0",
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "object.pick": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz",
+ "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=",
+ "dev": true,
+ "requires": {
+ "isobject": "^3.0.1"
+ }
+ },
+ "object.reduce": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/object.reduce/-/object.reduce-1.0.1.tgz",
+ "integrity": "sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60=",
+ "dev": true,
+ "requires": {
+ "for-own": "^1.0.0",
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "object.values": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz",
+ "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.0-next.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3"
+ }
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "optipng-bin": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/optipng-bin/-/optipng-bin-6.0.0.tgz",
+ "integrity": "sha512-95bB4y8IaTsa/8x6QH4bLUuyvyOoGBCLDA7wOgDL8UFqJpSUh1Hob8JRJhit+wC1ZLN3tQ7mFt7KuBj0x8F2Wg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "bin-build": "^3.0.0",
+ "bin-wrapper": "^4.0.0",
+ "logalot": "^2.0.0"
+ }
+ },
+ "ordered-read-streams": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz",
+ "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=",
+ "dev": true,
+ "requires": {
+ "readable-stream": "^2.0.1"
+ }
+ },
+ "os-browserify": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz",
+ "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=",
+ "dev": true
+ },
+ "os-filter-obj": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/os-filter-obj/-/os-filter-obj-2.0.0.tgz",
+ "integrity": "sha512-uksVLsqG3pVdzzPvmAHpBK0wKxYItuzZr7SziusRPoz67tGV8rL1szZ6IdeUrbqLjGDwApBtN29eEE3IqGHOjg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "arch": "^2.1.0"
+ }
+ },
+ "os-locale": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
+ "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
+ "dev": true,
+ "requires": {
+ "lcid": "^1.0.0"
+ }
+ },
+ "p-cancelable": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz",
+ "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==",
+ "dev": true,
+ "optional": true
+ },
+ "p-event": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/p-event/-/p-event-1.3.0.tgz",
+ "integrity": "sha1-jmtPT2XHK8W2/ii3XtqHT5akoIU=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "p-timeout": "^1.1.1"
+ }
+ },
+ "p-finally": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
+ "dev": true,
+ "optional": true
+ },
+ "p-is-promise": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz",
+ "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=",
+ "dev": true,
+ "optional": true
+ },
+ "p-limit": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+ "dev": true,
+ "requires": {
+ "p-try": "^2.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
+ "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.0.0"
+ }
+ },
+ "p-map": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz",
+ "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==",
+ "dev": true,
+ "requires": {
+ "aggregate-error": "^3.0.0"
+ }
+ },
+ "p-map-series": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-map-series/-/p-map-series-1.0.0.tgz",
+ "integrity": "sha1-v5j+V1cFZYqeE1G++4WuTB8Hvco=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "p-reduce": "^1.0.0"
+ }
+ },
+ "p-pipe": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/p-pipe/-/p-pipe-3.0.0.tgz",
+ "integrity": "sha512-gwwdRFmaxsT3IU+Tl3vYKVRdjfhg8Bbdjw7B+E0y6F7Yz6l+eaQLn0BRmGMXIhcPDONPtOkMoNwx1etZh4zPJA==",
+ "dev": true
+ },
+ "p-reduce": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
+ "integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=",
+ "dev": true,
+ "optional": true
+ },
+ "p-timeout": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz",
+ "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "p-finally": "^1.0.0"
+ }
+ },
+ "p-try": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
+ "dev": true
+ },
+ "pako": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
+ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
+ "dev": true
+ },
+ "parallel-transform": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.2.0.tgz",
+ "integrity": "sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==",
+ "dev": true,
+ "requires": {
+ "cyclist": "^1.0.1",
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.1.5"
+ }
+ },
+ "parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "requires": {
+ "callsites": "^3.0.0"
+ }
+ },
+ "parse-asn1": {
+ "version": "5.1.6",
+ "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz",
+ "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==",
+ "dev": true,
+ "requires": {
+ "asn1.js": "^5.2.0",
+ "browserify-aes": "^1.0.0",
+ "evp_bytestokey": "^1.0.0",
+ "pbkdf2": "^3.0.3",
+ "safe-buffer": "^5.1.1"
+ }
+ },
+ "parse-filepath": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz",
+ "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=",
+ "dev": true,
+ "requires": {
+ "is-absolute": "^1.0.0",
+ "map-cache": "^0.2.0",
+ "path-root": "^0.1.1"
+ }
+ },
+ "parse-json": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
+ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.2.0"
+ }
+ },
+ "parse-node-version": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.0.tgz",
+ "integrity": "sha512-02GTVHD1u0nWc20n2G7WX/PgdhNFG04j5fi1OkaJzPWLTcf6vh6229Lta1wTmXG/7Dg42tCssgkccVt7qvd8Kg==",
+ "dev": true
+ },
+ "parse-passwd": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz",
+ "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
+ "dev": true
+ },
+ "pascalcase": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz",
+ "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=",
+ "dev": true
+ },
+ "path-browserify": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz",
+ "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==",
+ "dev": true
+ },
+ "path-dirname": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz",
+ "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=",
+ "dev": true
+ },
+ "path-exists": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
+ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
+ "dev": true,
+ "requires": {
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "dev": true
+ },
+ "path-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
+ "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=="
+ },
+ "path-root": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz",
+ "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=",
+ "dev": true,
+ "requires": {
+ "path-root-regex": "^0.1.0"
+ }
+ },
+ "path-root-regex": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz",
+ "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=",
+ "dev": true
+ },
+ "path-type": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
+ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="
+ },
+ "pbkdf2": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz",
+ "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==",
+ "dev": true,
+ "requires": {
+ "create-hash": "^1.1.2",
+ "create-hmac": "^1.1.4",
+ "ripemd160": "^2.0.1",
+ "safe-buffer": "^5.0.1",
+ "sha.js": "^2.4.8"
+ }
+ },
+ "pend": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
+ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
+ "dev": true,
+ "optional": true
+ },
+ "picomatch": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.0.7.tgz",
+ "integrity": "sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA==",
+ "dev": true
+ },
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true
+ },
+ "pinkie": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
+ "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
+ "dev": true
+ },
+ "pinkie-promise": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
+ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
+ "dev": true,
+ "requires": {
+ "pinkie": "^2.0.0"
+ }
+ },
+ "pkg-dir": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz",
+ "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==",
+ "dev": true,
+ "requires": {
+ "find-up": "^3.0.0"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
+ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^3.0.0"
+ }
+ }
+ }
+ },
+ "plugin-error": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz",
+ "integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==",
+ "dev": true,
+ "requires": {
+ "ansi-colors": "^1.0.1",
+ "arr-diff": "^4.0.0",
+ "arr-union": "^3.1.0",
+ "extend-shallow": "^3.0.2"
+ }
+ },
+ "plur": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/plur/-/plur-3.1.1.tgz",
+ "integrity": "sha512-t1Ax8KUvV3FFII8ltczPn2tJdjqbd1sIzu6t4JL7nQ3EyeL/lTrj5PWKb06ic5/6XYDr65rQ4uzQEGN70/6X5w==",
+ "dev": true,
+ "requires": {
+ "irregular-plurals": "^2.0.0"
+ }
+ },
+ "posix-character-classes": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
+ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=",
+ "dev": true
+ },
+ "prepend-http": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz",
+ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
+ "dev": true,
+ "optional": true
+ },
+ "prettier": {
+ "version": "1.19.1",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
+ "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
+ "dev": true
+ },
+ "pretty-bytes": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.3.0.tgz",
+ "integrity": "sha512-hjGrh+P926p4R4WbaB6OckyRtO0F0/lQBiT+0gnxjV+5kjPBrfVBFCsCLbMqVQeydvIoouYTCmmEURiH3R1Bdg==",
+ "dev": true
+ },
+ "pretty-hrtime": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz",
+ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=",
+ "dev": true
+ },
+ "process": {
+ "version": "0.11.10",
+ "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
+ "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
+ "dev": true
+ },
+ "process-nextick-args": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
+ "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
+ "dev": true
+ },
+ "promise-inflight": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz",
+ "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=",
+ "dev": true
+ },
+ "prop-types": {
+ "version": "15.7.2",
+ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz",
+ "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
+ "requires": {
+ "loose-envify": "^1.4.0",
+ "object-assign": "^4.1.1",
+ "react-is": "^16.8.1"
+ }
+ },
+ "proto-list": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
+ "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=",
+ "dev": true,
+ "optional": true
+ },
+ "prr": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
+ "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
+ "dev": true
+ },
+ "pseudomap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
+ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
+ "dev": true,
+ "optional": true
+ },
+ "public-encrypt": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz",
+ "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.1.0",
+ "browserify-rsa": "^4.0.0",
+ "create-hash": "^1.1.0",
+ "parse-asn1": "^5.0.0",
+ "randombytes": "^2.0.1",
+ "safe-buffer": "^5.1.2"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
+ }
+ },
+ "pump": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "pumpify": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz",
+ "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==",
+ "dev": true,
+ "requires": {
+ "duplexify": "^3.6.0",
+ "inherits": "^2.0.3",
+ "pump": "^2.0.0"
+ },
+ "dependencies": {
+ "pump": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz",
+ "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ }
+ }
+ },
+ "punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+ "dev": true
+ },
+ "q": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
+ "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
+ "dev": true,
+ "optional": true
+ },
+ "qs": {
+ "version": "6.9.4",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
+ "integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
+ },
+ "query-string": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz",
+ "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "decode-uri-component": "^0.2.0",
+ "object-assign": "^4.1.0",
+ "strict-uri-encode": "^1.0.0"
+ }
+ },
+ "querystring": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
+ "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=",
+ "dev": true
+ },
+ "querystring-es3": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz",
+ "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=",
+ "dev": true
+ },
+ "randombytes": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "randomfill": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz",
+ "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==",
+ "dev": true,
+ "requires": {
+ "randombytes": "^2.0.5",
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "raw-body": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.1.7.tgz",
+ "integrity": "sha1-HQJ8K/oRasxmI7yo8AAWVyqH1CU=",
+ "dev": true,
+ "requires": {
+ "bytes": "1",
+ "string_decoder": "0.10"
+ },
+ "dependencies": {
+ "string_decoder": {
+ "version": "0.10.31",
+ "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
+ "dev": true
+ }
+ }
+ },
+ "react": {
+ "version": "16.14.0",
+ "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz",
+ "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==",
+ "requires": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1",
+ "prop-types": "^15.6.2"
+ }
+ },
+ "react-dom": {
+ "version": "16.14.0",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz",
+ "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==",
+ "requires": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1",
+ "prop-types": "^15.6.2",
+ "scheduler": "^0.19.1"
+ }
+ },
+ "react-input-autosize": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-2.2.2.tgz",
+ "integrity": "sha512-jQJgYCA3S0j+cuOwzuCd1OjmBmnZLdqQdiLKRYrsMMzbjUrVDS5RvJUDwJqA7sKuksDuzFtm6hZGKFu7Mjk5aw==",
+ "requires": {
+ "prop-types": "^15.5.8"
+ }
+ },
+ "react-is": {
+ "version": "16.13.1",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
+ },
+ "react-redux": {
+ "version": "7.2.2",
+ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.2.tgz",
+ "integrity": "sha512-8+CQ1EvIVFkYL/vu6Olo7JFLWop1qRUeb46sGtIMDCSpgwPQq8fPLpirIB0iTqFe9XYEFPHssdX8/UwN6pAkEA==",
+ "requires": {
+ "@babel/runtime": "^7.12.1",
+ "hoist-non-react-statics": "^3.3.2",
+ "loose-envify": "^1.4.0",
+ "prop-types": "^15.7.2",
+ "react-is": "^16.13.1"
+ }
+ },
+ "react-select": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/react-select/-/react-select-3.1.1.tgz",
+ "integrity": "sha512-HjC6jT2BhUxbIbxMZWqVcDibrEpdUJCfGicN0MMV+BQyKtCaPTgFekKWiOizSCy4jdsLMGjLqcFGJMhVGWB0Dg==",
+ "requires": {
+ "@babel/runtime": "^7.4.4",
+ "@emotion/cache": "^10.0.9",
+ "@emotion/core": "^10.0.9",
+ "@emotion/css": "^10.0.9",
+ "memoize-one": "^5.0.0",
+ "prop-types": "^15.6.0",
+ "react-input-autosize": "^2.2.2",
+ "react-transition-group": "^4.3.0"
+ }
+ },
+ "react-transition-group": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.1.tgz",
+ "integrity": "sha512-Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKGw==",
+ "requires": {
+ "@babel/runtime": "^7.5.5",
+ "dom-helpers": "^5.0.1",
+ "loose-envify": "^1.4.0",
+ "prop-types": "^15.6.2"
+ }
+ },
+ "read-pkg": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
+ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "^1.0.0",
+ "normalize-package-data": "^2.3.2",
+ "path-type": "^1.0.0"
+ },
+ "dependencies": {
+ "graceful-fs": {
+ "version": "4.1.15",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
+ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
+ "dev": true
+ },
+ "path-type": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
+ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ }
+ }
+ },
+ "read-pkg-up": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
+ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
+ "dev": true,
+ "requires": {
+ "find-up": "^1.0.0",
+ "read-pkg": "^1.0.0"
+ }
+ },
+ "readable-stream": {
+ "version": "2.3.6",
+ "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
+ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
+ "dev": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ },
+ "dependencies": {
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ }
+ }
+ },
+ "readdirp": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz",
+ "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.11",
+ "micromatch": "^3.1.10",
+ "readable-stream": "^2.0.2"
+ }
+ },
+ "rechoir": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
+ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
+ "dev": true,
+ "requires": {
+ "resolve": "^1.1.6"
+ }
+ },
+ "redent": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz",
+ "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "indent-string": "^2.1.0",
+ "strip-indent": "^1.0.1"
+ }
+ },
+ "redux": {
+ "version": "4.0.5",
+ "resolved": "https://registry.npmjs.org/redux/-/redux-4.0.5.tgz",
+ "integrity": "sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w==",
+ "requires": {
+ "loose-envify": "^1.4.0",
+ "symbol-observable": "^1.2.0"
+ }
+ },
+ "redux-logger": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/redux-logger/-/redux-logger-3.0.6.tgz",
+ "integrity": "sha1-91VZZvMJjzyIYExEnPC69XeCdL8=",
+ "requires": {
+ "deep-diff": "^0.3.5"
+ }
+ },
+ "redux-thunk": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz",
+ "integrity": "sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw=="
+ },
+ "regenerate": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
+ "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==",
+ "dev": true
+ },
+ "regenerate-unicode-properties": {
+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz",
+ "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==",
+ "dev": true,
+ "requires": {
+ "regenerate": "^1.4.0"
+ }
+ },
+ "regenerator-runtime": {
+ "version": "0.13.7",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz",
+ "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew=="
+ },
+ "regenerator-transform": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz",
+ "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==",
+ "dev": true,
+ "requires": {
+ "@babel/runtime": "^7.8.4"
+ }
+ },
+ "regex-not": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
+ "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==",
+ "dev": true,
+ "requires": {
+ "extend-shallow": "^3.0.2",
+ "safe-regex": "^1.1.0"
+ }
+ },
+ "regexpu-core": {
+ "version": "4.7.1",
+ "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.7.1.tgz",
+ "integrity": "sha512-ywH2VUraA44DZQuRKzARmw6S66mr48pQVva4LBeRhcOltJ6hExvWly5ZjFLYo67xbIxb6W1q4bAGtgfEl20zfQ==",
+ "dev": true,
+ "requires": {
+ "regenerate": "^1.4.0",
+ "regenerate-unicode-properties": "^8.2.0",
+ "regjsgen": "^0.5.1",
+ "regjsparser": "^0.6.4",
+ "unicode-match-property-ecmascript": "^1.0.4",
+ "unicode-match-property-value-ecmascript": "^1.2.0"
+ }
+ },
+ "regjsgen": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz",
+ "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==",
+ "dev": true
+ },
+ "regjsparser": {
+ "version": "0.6.4",
+ "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.4.tgz",
+ "integrity": "sha512-64O87/dPDgfk8/RQqC4gkZoGyyWFIEUTTh80CU6CWuK5vkCGyekIx+oKcEIYtP/RAxSQltCZHCNu/mdd7fqlJw==",
+ "dev": true,
+ "requires": {
+ "jsesc": "~0.5.0"
+ },
+ "dependencies": {
+ "jsesc": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
+ "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
+ "dev": true
+ }
+ }
+ },
+ "remove-bom-buffer": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz",
+ "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5",
+ "is-utf8": "^0.2.1"
+ }
+ },
+ "remove-bom-stream": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/remove-bom-stream/-/remove-bom-stream-1.2.0.tgz",
+ "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=",
+ "dev": true,
+ "requires": {
+ "remove-bom-buffer": "^3.0.0",
+ "safe-buffer": "^5.1.0",
+ "through2": "^2.0.3"
+ }
+ },
+ "remove-trailing-separator": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
+ "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=",
+ "dev": true
+ },
+ "repeat-element": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz",
+ "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==",
+ "dev": true
+ },
+ "repeat-string": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
+ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
+ "dev": true
+ },
+ "repeating": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz",
+ "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-finite": "^1.0.0"
+ }
+ },
+ "replace-ext": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz",
+ "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=",
+ "dev": true
+ },
+ "replace-homedir": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-1.0.0.tgz",
+ "integrity": "sha1-6H9tUTuSjd6AgmDBK+f+xv9ueYw=",
+ "dev": true,
+ "requires": {
+ "homedir-polyfill": "^1.0.1",
+ "is-absolute": "^1.0.0",
+ "remove-trailing-separator": "^1.1.0"
+ }
+ },
+ "replacestream": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz",
+ "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==",
+ "dev": true,
+ "requires": {
+ "escape-string-regexp": "^1.0.3",
+ "object-assign": "^4.0.1",
+ "readable-stream": "^2.0.2"
+ }
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "dev": true
+ },
+ "require-main-filename": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
+ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz",
+ "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==",
+ "dev": true,
+ "requires": {
+ "path-parse": "^1.0.5"
+ }
+ },
+ "resolve-cwd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz",
+ "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=",
+ "dev": true,
+ "requires": {
+ "resolve-from": "^3.0.0"
+ },
+ "dependencies": {
+ "resolve-from": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
+ "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=",
+ "dev": true
+ }
+ }
+ },
+ "resolve-dir": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz",
+ "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=",
+ "dev": true,
+ "requires": {
+ "expand-tilde": "^2.0.0",
+ "global-modules": "^1.0.0"
+ }
+ },
+ "resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
+ },
+ "resolve-options": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-1.1.0.tgz",
+ "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=",
+ "dev": true,
+ "requires": {
+ "value-or-function": "^3.0.0"
+ }
+ },
+ "resolve-url": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
+ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=",
+ "dev": true
+ },
+ "responselike": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz",
+ "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "lowercase-keys": "^1.0.0"
+ }
+ },
+ "ret": {
+ "version": "0.1.15",
+ "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
+ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
+ "dev": true
+ },
+ "reusify": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
+ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
+ "dev": true
+ },
+ "rimraf": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
+ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "ripemd160": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz",
+ "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==",
+ "dev": true,
+ "requires": {
+ "hash-base": "^3.0.0",
+ "inherits": "^2.0.1"
+ }
+ },
+ "run-parallel": {
+ "version": "1.1.9",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz",
+ "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==",
+ "dev": true
+ },
+ "run-queue": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz",
+ "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=",
+ "dev": true,
+ "requires": {
+ "aproba": "^1.1.1"
+ }
+ },
+ "rxjs": {
+ "version": "6.6.2",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.2.tgz",
+ "integrity": "sha512-BHdBMVoWC2sL26w//BCu3YzKT4s2jip/WhwsGEDmeKYBhKDZeYezVUnHatYB7L85v5xs0BAQmg6BEYJEKxBabg==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ },
+ "safe-json-parse": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/safe-json-parse/-/safe-json-parse-1.0.1.tgz",
+ "integrity": "sha1-PnZyPjjf3aE8mx0poeB//uSzC1c=",
+ "dev": true
+ },
+ "safe-regex": {
+ "version": "1.1.0",
+ "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
+ "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
+ "dev": true,
+ "requires": {
+ "ret": "~0.1.10"
+ }
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
+ "sax": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
+ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
+ "dev": true,
+ "optional": true
+ },
+ "scheduler": {
+ "version": "0.19.1",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz",
+ "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==",
+ "requires": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1"
+ }
+ },
+ "schema-utils": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
+ "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.1.0",
+ "ajv-errors": "^1.0.0",
+ "ajv-keywords": "^3.1.0"
+ }
+ },
+ "seek-bzip": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz",
+ "integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "commander": "~2.8.1"
+ }
+ },
+ "semver": {
+ "version": "4.3.6",
+ "resolved": "http://registry.npmjs.org/semver/-/semver-4.3.6.tgz",
+ "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=",
+ "dev": true
+ },
+ "semver-greatest-satisfied-range": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz",
+ "integrity": "sha1-E+jCZYq5aRywzXEJMkAoDTb3els=",
+ "dev": true,
+ "requires": {
+ "sver-compat": "^1.5.0"
+ }
+ },
+ "semver-regex": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz",
+ "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==",
+ "dev": true,
+ "optional": true
+ },
+ "semver-truncate": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/semver-truncate/-/semver-truncate-1.1.2.tgz",
+ "integrity": "sha1-V/Qd5pcHpicJp+AQS6IRcQnqR+g=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "semver": "^5.3.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "serialize-javascript": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
+ "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
+ "dev": true,
+ "requires": {
+ "randombytes": "^2.1.0"
+ }
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
+ "dev": true
+ },
+ "set-value": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
+ "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
+ "dev": true,
+ "requires": {
+ "extend-shallow": "^2.0.1",
+ "is-extendable": "^0.1.1",
+ "is-plain-object": "^2.0.3",
+ "split-string": "^3.0.1"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "setimmediate": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
+ "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=",
+ "dev": true
+ },
+ "sha.js": {
+ "version": "2.4.11",
+ "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
+ "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
+ "dev": true
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
+ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
+ "dev": true,
+ "optional": true
+ },
+ "snapdragon": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
+ "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==",
+ "dev": true,
+ "requires": {
+ "base": "^0.11.1",
+ "debug": "^2.2.0",
+ "define-property": "^0.2.5",
+ "extend-shallow": "^2.0.1",
+ "map-cache": "^0.2.2",
+ "source-map": "^0.5.6",
+ "source-map-resolve": "^0.5.0",
+ "use": "^3.1.0"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "snapdragon-node": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz",
+ "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==",
+ "dev": true,
+ "requires": {
+ "define-property": "^1.0.0",
+ "isobject": "^3.0.0",
+ "snapdragon-util": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "snapdragon-util": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz",
+ "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.2.0"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "sort-keys": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz",
+ "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-plain-obj": "^1.0.0"
+ }
+ },
+ "sort-keys-length": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz",
+ "integrity": "sha1-nLb09OnkgVWmqgZx7dM2/xR5oYg=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "sort-keys": "^1.0.0"
+ }
+ },
+ "source-list-map": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",
+ "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==",
+ "dev": true
+ },
+ "source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
+ },
+ "source-map-resolve": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz",
+ "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==",
+ "dev": true,
+ "requires": {
+ "atob": "^2.1.1",
+ "decode-uri-component": "^0.2.0",
+ "resolve-url": "^0.2.1",
+ "source-map-url": "^0.4.0",
+ "urix": "^0.1.0"
+ }
+ },
+ "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"
+ },
+ "dependencies": {
+ "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-url": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
+ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
+ "dev": true
+ },
+ "sparkles": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz",
+ "integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==",
+ "dev": true
+ },
+ "spawn-command": {
+ "version": "0.0.2-1",
+ "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz",
+ "integrity": "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=",
+ "dev": true
+ },
+ "spdx-correct": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz",
+ "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==",
+ "dev": true,
+ "requires": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-exceptions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz",
+ "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==",
+ "dev": true
+ },
+ "spdx-expression-parse": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
+ "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
+ "dev": true,
+ "requires": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-license-ids": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.2.tgz",
+ "integrity": "sha512-qky9CVt0lVIECkEsYbNILVnPvycuEBkXoMFLRWsREkomQLevYhtRKC+R91a5TOAQ3bCMjikRwhyaRqj1VYatYg==",
+ "dev": true
+ },
+ "split-string": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
+ "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==",
+ "dev": true,
+ "requires": {
+ "extend-shallow": "^3.0.0"
+ }
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true,
+ "optional": true
+ },
+ "squeak": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/squeak/-/squeak-1.3.0.tgz",
+ "integrity": "sha1-MwRQN7ZDiLVnZ0uEMiplIQc5FsM=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "chalk": "^1.0.0",
+ "console-stream": "^0.1.1",
+ "lpad-align": "^1.0.1"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
+ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
+ "dev": true,
+ "optional": true
+ },
+ "chalk": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ansi-styles": "^2.2.1",
+ "escape-string-regexp": "^1.0.2",
+ "has-ansi": "^2.0.0",
+ "strip-ansi": "^3.0.0",
+ "supports-color": "^2.0.0"
+ }
+ },
+ "supports-color": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "ssri": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
+ "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==",
+ "dev": true,
+ "requires": {
+ "figgy-pudding": "^3.5.1"
+ }
+ },
+ "stable": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz",
+ "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==",
+ "dev": true,
+ "optional": true
+ },
+ "stack-trace": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
+ "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=",
+ "dev": true
+ },
+ "static-extend": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
+ "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=",
+ "dev": true,
+ "requires": {
+ "define-property": "^0.2.5",
+ "object-copy": "^0.1.0"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ }
+ }
+ },
+ "stream-browserify": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz",
+ "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==",
+ "dev": true,
+ "requires": {
+ "inherits": "~2.0.1",
+ "readable-stream": "^2.0.2"
+ }
+ },
+ "stream-each": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz",
+ "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "stream-shift": "^1.0.0"
+ }
+ },
+ "stream-exhaust": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz",
+ "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==",
+ "dev": true
+ },
+ "stream-http": {
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz",
+ "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==",
+ "dev": true,
+ "requires": {
+ "builtin-status-codes": "^3.0.0",
+ "inherits": "^2.0.1",
+ "readable-stream": "^2.3.6",
+ "to-arraybuffer": "^1.0.0",
+ "xtend": "^4.0.0"
+ }
+ },
+ "stream-shift": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz",
+ "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=",
+ "dev": true
+ },
+ "strict-uri-encode": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
+ "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
+ "dev": true,
+ "optional": true
+ },
+ "string-template": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/string-template/-/string-template-0.2.1.tgz",
+ "integrity": "sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0=",
+ "dev": true
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "dev": true,
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "string.prototype.trimleft": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
+ "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "function-bind": "^1.1.1"
+ }
+ },
+ "string.prototype.trimright": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz",
+ "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "function-bind": "^1.1.1"
+ }
+ },
+ "string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.2.0"
+ },
+ "dependencies": {
+ "safe-buffer": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
+ "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==",
+ "dev": true
+ }
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "strip-dirs": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz",
+ "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-natural-number": "^4.0.1"
+ }
+ },
+ "strip-eof": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
+ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
+ "dev": true,
+ "optional": true
+ },
+ "strip-indent": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz",
+ "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "get-stdin": "^4.0.1"
+ }
+ },
+ "strip-outer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz",
+ "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "escape-string-regexp": "^1.0.2"
+ }
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "sver-compat": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/sver-compat/-/sver-compat-1.5.0.tgz",
+ "integrity": "sha1-PPh9/rTQe0o/FIJ7wYaz/QxkXNg=",
+ "dev": true,
+ "requires": {
+ "es6-iterator": "^2.0.1",
+ "es6-symbol": "^3.1.1"
+ }
+ },
+ "svgo": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.3.2.tgz",
+ "integrity": "sha512-yhy/sQYxR5BkC98CY7o31VGsg014AKLEPxdfhora76l36hD9Rdy5NZA/Ocn6yayNPgSamYdtX2rFJdcv07AYVw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "chalk": "^2.4.1",
+ "coa": "^2.0.2",
+ "css-select": "^2.0.0",
+ "css-select-base-adapter": "^0.1.1",
+ "css-tree": "1.0.0-alpha.37",
+ "csso": "^4.0.2",
+ "js-yaml": "^3.13.1",
+ "mkdirp": "~0.5.1",
+ "object.values": "^1.1.0",
+ "sax": "~1.2.4",
+ "stable": "^0.1.8",
+ "unquote": "~1.1.1",
+ "util.promisify": "~1.0.0"
+ }
+ },
+ "symbol-observable": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
+ "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ=="
+ },
+ "tapable": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz",
+ "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==",
+ "dev": true
+ },
+ "tar-stream": {
+ "version": "1.6.2",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz",
+ "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "bl": "^1.0.0",
+ "buffer-alloc": "^1.2.0",
+ "end-of-stream": "^1.0.0",
+ "fs-constants": "^1.0.0",
+ "readable-stream": "^2.3.0",
+ "to-buffer": "^1.1.1",
+ "xtend": "^4.0.0"
+ }
+ },
+ "temp-dir": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz",
+ "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=",
+ "dev": true,
+ "optional": true
+ },
+ "tempfile": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/tempfile/-/tempfile-2.0.0.tgz",
+ "integrity": "sha1-awRGhWqbERTRhW/8vlCczLCXcmU=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "temp-dir": "^1.0.0",
+ "uuid": "^3.0.1"
+ }
+ },
+ "ternary-stream": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ternary-stream/-/ternary-stream-3.0.0.tgz",
+ "integrity": "sha512-oIzdi+UL/JdktkT+7KU5tSIQjj8pbShj3OASuvDEhm0NT5lppsm7aXWAmAq4/QMaBIyfuEcNLbAQA+HpaISobQ==",
+ "dev": true,
+ "requires": {
+ "duplexify": "^4.1.1",
+ "fork-stream": "^0.0.4",
+ "merge-stream": "^2.0.0",
+ "through2": "^3.0.1"
+ },
+ "dependencies": {
+ "duplexify": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz",
+ "integrity": "sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.4.1",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1",
+ "stream-shift": "^1.0.0"
+ }
+ },
+ "readable-stream": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz",
+ "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "through2": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz",
+ "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==",
+ "dev": true,
+ "requires": {
+ "readable-stream": "2 || 3"
+ }
+ }
+ }
+ },
+ "terser": {
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
+ "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==",
+ "dev": true,
+ "requires": {
+ "commander": "^2.20.0",
+ "source-map": "~0.6.1",
+ "source-map-support": "~0.5.12"
+ },
+ "dependencies": {
+ "commander": {
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+ "dev": true
+ },
+ "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
+ }
+ }
+ },
+ "terser-webpack-plugin": {
+ "version": "1.4.5",
+ "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.5.tgz",
+ "integrity": "sha512-04Rfe496lN8EYruwi6oPQkG0vo8C+HT49X687FZnpPF0qMAIHONI6HEXYPKDOE8e5HjXTyKfqRd/agHtH0kOtw==",
+ "dev": true,
+ "requires": {
+ "cacache": "^12.0.2",
+ "find-cache-dir": "^2.1.0",
+ "is-wsl": "^1.1.0",
+ "schema-utils": "^1.0.0",
+ "serialize-javascript": "^4.0.0",
+ "source-map": "^0.6.1",
+ "terser": "^4.1.2",
+ "webpack-sources": "^1.4.0",
+ "worker-farm": "^1.7.0"
+ },
+ "dependencies": {
+ "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
+ }
+ }
+ },
+ "textextensions": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-2.4.0.tgz",
+ "integrity": "sha512-qftQXnX1DzpSV8EddtHIT0eDDEiBF8ywhFYR2lI9xrGtxqKN+CvLXhACeCIGbCpQfxxERbrkZEFb8cZcDKbVZA==",
+ "dev": true
+ },
+ "through": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
+ "dev": true,
+ "optional": true
+ },
+ "through2": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
+ "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==",
+ "dev": true,
+ "requires": {
+ "readable-stream": "~2.3.6",
+ "xtend": "~4.0.1"
+ }
+ },
+ "through2-concurrent": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/through2-concurrent/-/through2-concurrent-2.0.0.tgz",
+ "integrity": "sha512-R5/jLkfMvdmDD+seLwN7vB+mhbqzWop5fAjx5IX8/yQq7VhBhzDmhXgaHAOnhnWkCpRMM7gToYHycB0CS/pd+A==",
+ "dev": true,
+ "requires": {
+ "through2": "^2.0.0"
+ }
+ },
+ "through2-filter": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz",
+ "integrity": "sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==",
+ "dev": true,
+ "requires": {
+ "through2": "~2.0.0",
+ "xtend": "~4.0.0"
+ }
+ },
+ "time-stamp": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz",
+ "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=",
+ "dev": true
+ },
+ "timed-out": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
+ "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=",
+ "dev": true,
+ "optional": true
+ },
+ "timers-browserify": {
+ "version": "2.0.12",
+ "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz",
+ "integrity": "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==",
+ "dev": true,
+ "requires": {
+ "setimmediate": "^1.0.4"
+ }
+ },
+ "tiny-lr": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/tiny-lr/-/tiny-lr-1.1.1.tgz",
+ "integrity": "sha512-44yhA3tsaRoMOjQQ+5v5mVdqef+kH6Qze9jTpqtVufgYjYt08zyZAwNwwVBj3i1rJMnR52IxOW0LK0vBzgAkuA==",
+ "dev": true,
+ "requires": {
+ "body": "^5.1.0",
+ "debug": "^3.1.0",
+ "faye-websocket": "~0.10.0",
+ "livereload-js": "^2.3.0",
+ "object-assign": "^4.1.0",
+ "qs": "^6.4.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
+ "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ }
+ }
+ },
+ "to-absolute-glob": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz",
+ "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=",
+ "dev": true,
+ "requires": {
+ "is-absolute": "^1.0.0",
+ "is-negated-glob": "^1.0.0"
+ }
+ },
+ "to-arraybuffer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
+ "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=",
+ "dev": true
+ },
+ "to-buffer": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz",
+ "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==",
+ "dev": true,
+ "optional": true
+ },
+ "to-fast-properties": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
+ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4="
+ },
+ "to-object-path": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz",
+ "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "to-regex": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz",
+ "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==",
+ "dev": true,
+ "requires": {
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "regex-not": "^1.0.2",
+ "safe-regex": "^1.1.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
+ "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=",
+ "dev": true,
+ "requires": {
+ "is-number": "^3.0.0",
+ "repeat-string": "^1.6.1"
+ }
+ },
+ "to-through": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/to-through/-/to-through-2.0.0.tgz",
+ "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=",
+ "dev": true,
+ "requires": {
+ "through2": "^2.0.3"
+ }
+ },
+ "tree-kill": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
+ "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
+ "dev": true
+ },
+ "trim-newlines": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
+ "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=",
+ "dev": true,
+ "optional": true
+ },
+ "trim-repeated": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz",
+ "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "escape-string-regexp": "^1.0.2"
+ }
+ },
+ "ts-loader": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-6.2.2.tgz",
+ "integrity": "sha512-HDo5kXZCBml3EUPcc7RlZOV/JGlLHwppTLEHb3SHnr5V7NXD4klMEkrhJe5wgRbaWsSXi+Y1SIBN/K9B6zWGWQ==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.3.0",
+ "enhanced-resolve": "^4.0.0",
+ "loader-utils": "^1.0.2",
+ "micromatch": "^4.0.0",
+ "semver": "^6.0.0"
+ },
+ "dependencies": {
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "tslib": {
+ "version": "1.13.0",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
+ "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==",
+ "dev": true
+ },
+ "tty-browserify": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
+ "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=",
+ "dev": true
+ },
+ "tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "type": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
+ "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==",
+ "dev": true
+ },
+ "typedarray": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
+ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
+ "dev": true
+ },
+ "typescript": {
+ "version": "3.9.7",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
+ "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
+ "dev": true
+ },
+ "unbzip2-stream": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.2.tgz",
+ "integrity": "sha512-pZMVAofMrrHX6Ik39hCk470kulCbmZ2SWfQLPmTWqfJV/oUm0gn1CblvHdUu4+54Je6Jq34x8kY6XjTy6dMkOg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "buffer": "^5.2.1",
+ "through": "^2.3.8"
+ }
+ },
+ "unc-path-regex": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz",
+ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=",
+ "dev": true
+ },
+ "undertaker": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.1.tgz",
+ "integrity": "sha512-71WxIzDkgYk9ZS+spIB8iZXchFhAdEo2YU8xYqBYJ39DIUIqziK78ftm26eecoIY49X0J2MLhG4hr18Yp6/CMA==",
+ "dev": true,
+ "requires": {
+ "arr-flatten": "^1.0.1",
+ "arr-map": "^2.0.0",
+ "bach": "^1.0.0",
+ "collection-map": "^1.0.0",
+ "es6-weak-map": "^2.0.1",
+ "last-run": "^1.1.0",
+ "object.defaults": "^1.0.0",
+ "object.reduce": "^1.0.0",
+ "undertaker-registry": "^1.0.0"
+ }
+ },
+ "undertaker-registry": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-1.0.1.tgz",
+ "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA=",
+ "dev": true
+ },
+ "unicode-canonical-property-names-ecmascript": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",
+ "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==",
+ "dev": true
+ },
+ "unicode-match-property-ecmascript": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz",
+ "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==",
+ "dev": true,
+ "requires": {
+ "unicode-canonical-property-names-ecmascript": "^1.0.4",
+ "unicode-property-aliases-ecmascript": "^1.0.4"
+ }
+ },
+ "unicode-match-property-value-ecmascript": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz",
+ "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==",
+ "dev": true
+ },
+ "unicode-property-aliases-ecmascript": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz",
+ "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==",
+ "dev": true
+ },
+ "union-value": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
+ "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
+ "dev": true,
+ "requires": {
+ "arr-union": "^3.1.0",
+ "get-value": "^2.0.6",
+ "is-extendable": "^0.1.1",
+ "set-value": "^2.0.1"
+ }
+ },
+ "unique-filename": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz",
+ "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==",
+ "dev": true,
+ "requires": {
+ "unique-slug": "^2.0.0"
+ }
+ },
+ "unique-slug": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz",
+ "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==",
+ "dev": true,
+ "requires": {
+ "imurmurhash": "^0.1.4"
+ }
+ },
+ "unique-stream": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz",
+ "integrity": "sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==",
+ "dev": true,
+ "requires": {
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "through2-filter": "^3.0.0"
+ }
+ },
+ "unquote": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz",
+ "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=",
+ "dev": true,
+ "optional": true
+ },
+ "unset-value": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",
+ "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=",
+ "dev": true,
+ "requires": {
+ "has-value": "^0.3.1",
+ "isobject": "^3.0.0"
+ },
+ "dependencies": {
+ "has-value": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz",
+ "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=",
+ "dev": true,
+ "requires": {
+ "get-value": "^2.0.3",
+ "has-values": "^0.1.4",
+ "isobject": "^2.0.0"
+ },
+ "dependencies": {
+ "isobject": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
+ "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
+ "dev": true,
+ "requires": {
+ "isarray": "1.0.0"
+ }
+ }
+ }
+ },
+ "has-values": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz",
+ "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=",
+ "dev": true
+ }
+ }
+ },
+ "upath": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz",
+ "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==",
+ "dev": true
+ },
+ "uri-js": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
+ "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==",
+ "dev": true,
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "urix": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",
+ "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=",
+ "dev": true
+ },
+ "url": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz",
+ "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=",
+ "dev": true,
+ "requires": {
+ "punycode": "1.3.2",
+ "querystring": "0.2.0"
+ },
+ "dependencies": {
+ "punycode": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
+ "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=",
+ "dev": true
+ }
+ }
+ },
+ "url-parse-lax": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz",
+ "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "prepend-http": "^1.0.1"
+ }
+ },
+ "url-to-options": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz",
+ "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=",
+ "dev": true,
+ "optional": true
+ },
+ "use": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
+ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==",
+ "dev": true
+ },
+ "util": {
+ "version": "0.11.1",
+ "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz",
+ "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==",
+ "dev": true,
+ "requires": {
+ "inherits": "2.0.3"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
+ "dev": true
+ },
+ "util.promisify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz",
+ "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "object.getownpropertydescriptors": "^2.0.3"
+ }
+ },
+ "uuid": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
+ "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
+ "dev": true,
+ "optional": true
+ },
+ "v8-compile-cache": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz",
+ "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==",
+ "dev": true
+ },
+ "v8flags": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.3.tgz",
+ "integrity": "sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w==",
+ "dev": true,
+ "requires": {
+ "homedir-polyfill": "^1.0.1"
+ }
+ },
+ "validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "dev": true,
+ "requires": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
+ "value-or-function": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-3.0.0.tgz",
+ "integrity": "sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM=",
+ "dev": true
+ },
+ "vinyl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz",
+ "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==",
+ "dev": true,
+ "requires": {
+ "clone": "^2.1.1",
+ "clone-buffer": "^1.0.0",
+ "clone-stats": "^1.0.0",
+ "cloneable-readable": "^1.0.0",
+ "remove-trailing-separator": "^1.0.1",
+ "replace-ext": "^1.0.0"
+ }
+ },
+ "vinyl-fs": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.3.tgz",
+ "integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==",
+ "dev": true,
+ "requires": {
+ "fs-mkdirp-stream": "^1.0.0",
+ "glob-stream": "^6.1.0",
+ "graceful-fs": "^4.0.0",
+ "is-valid-glob": "^1.0.0",
+ "lazystream": "^1.0.0",
+ "lead": "^1.0.0",
+ "object.assign": "^4.0.4",
+ "pumpify": "^1.3.5",
+ "readable-stream": "^2.3.3",
+ "remove-bom-buffer": "^3.0.0",
+ "remove-bom-stream": "^1.2.0",
+ "resolve-options": "^1.1.0",
+ "through2": "^2.0.0",
+ "to-through": "^2.0.0",
+ "value-or-function": "^3.0.0",
+ "vinyl": "^2.0.0",
+ "vinyl-sourcemap": "^1.1.0"
+ }
+ },
+ "vinyl-sourcemap": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz",
+ "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=",
+ "dev": true,
+ "requires": {
+ "append-buffer": "^1.0.2",
+ "convert-source-map": "^1.5.0",
+ "graceful-fs": "^4.1.6",
+ "normalize-path": "^2.1.1",
+ "now-and-later": "^2.0.0",
+ "remove-bom-buffer": "^3.0.0",
+ "vinyl": "^2.0.0"
+ }
+ },
+ "vm-browserify": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
+ "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==",
+ "dev": true
+ },
+ "watchpack": {
+ "version": "1.7.5",
+ "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
+ "integrity": "sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ==",
+ "dev": true,
+ "requires": {
+ "chokidar": "^3.4.1",
+ "graceful-fs": "^4.1.2",
+ "neo-async": "^2.5.0",
+ "watchpack-chokidar2": "^2.0.1"
+ },
+ "dependencies": {
+ "anymatch": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
+ "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ }
+ },
+ "binary-extensions": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz",
+ "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==",
+ "dev": true,
+ "optional": true
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "chokidar": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz",
+ "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "anymatch": "~3.1.1",
+ "braces": "~3.0.2",
+ "fsevents": "~2.1.2",
+ "glob-parent": "~5.1.0",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.5.0"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "fsevents": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
+ "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
+ "dev": true,
+ "optional": true
+ },
+ "glob-parent": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
+ "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "binary-extensions": "^2.0.0"
+ }
+ },
+ "is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true,
+ "optional": true
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true,
+ "optional": true
+ },
+ "readdirp": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
+ "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "picomatch": "^2.2.1"
+ },
+ "dependencies": {
+ "picomatch": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
+ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
+ "dev": true,
+ "optional": true
+ }
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "watchpack-chokidar2": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz",
+ "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "chokidar": "^2.1.8"
+ }
+ },
+ "webpack": {
+ "version": "4.44.2",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.44.2.tgz",
+ "integrity": "sha512-6KJVGlCxYdISyurpQ0IPTklv+DULv05rs2hseIXer6D7KrUicRDLFb4IUM1S6LUAKypPM/nSiVSuv8jHu1m3/Q==",
+ "dev": true,
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-module-context": "1.9.0",
+ "@webassemblyjs/wasm-edit": "1.9.0",
+ "@webassemblyjs/wasm-parser": "1.9.0",
+ "acorn": "^6.4.1",
+ "ajv": "^6.10.2",
+ "ajv-keywords": "^3.4.1",
+ "chrome-trace-event": "^1.0.2",
+ "enhanced-resolve": "^4.3.0",
+ "eslint-scope": "^4.0.3",
+ "json-parse-better-errors": "^1.0.2",
+ "loader-runner": "^2.4.0",
+ "loader-utils": "^1.2.3",
+ "memory-fs": "^0.4.1",
+ "micromatch": "^3.1.10",
+ "mkdirp": "^0.5.3",
+ "neo-async": "^2.6.1",
+ "node-libs-browser": "^2.2.1",
+ "schema-utils": "^1.0.0",
+ "tapable": "^1.1.3",
+ "terser-webpack-plugin": "^1.4.3",
+ "watchpack": "^1.7.4",
+ "webpack-sources": "^1.4.1"
+ },
+ "dependencies": {
+ "enhanced-resolve": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.3.0.tgz",
+ "integrity": "sha512-3e87LvavsdxyoCfGusJnrZ5G8SLPOFeHSNpZI/ATL9a5leXo2k0w6MKnbqhdBad9qTobSfB20Ld7UmgoNbAZkQ==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "memory-fs": "^0.5.0",
+ "tapable": "^1.0.0"
+ },
+ "dependencies": {
+ "memory-fs": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz",
+ "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==",
+ "dev": true,
+ "requires": {
+ "errno": "^0.1.3",
+ "readable-stream": "^2.0.1"
+ }
+ }
+ }
+ },
+ "memory-fs": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
+ "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=",
+ "dev": true,
+ "requires": {
+ "errno": "^0.1.3",
+ "readable-stream": "^2.0.1"
+ }
+ }
+ }
+ },
+ "webpack-cli": {
+ "version": "3.3.12",
+ "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.12.tgz",
+ "integrity": "sha512-NVWBaz9k839ZH/sinurM+HcDvJOTXwSjYp1ku+5XKeOC03z8v5QitnK/x+lAxGXFyhdayoIf/GOpv85z3/xPag==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "cross-spawn": "^6.0.5",
+ "enhanced-resolve": "^4.1.1",
+ "findup-sync": "^3.0.0",
+ "global-modules": "^2.0.0",
+ "import-local": "^2.0.0",
+ "interpret": "^1.4.0",
+ "loader-utils": "^1.4.0",
+ "supports-color": "^6.1.0",
+ "v8-compile-cache": "^2.1.1",
+ "yargs": "^13.3.2"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "cliui": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+ "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^3.1.0",
+ "strip-ansi": "^5.2.0",
+ "wrap-ansi": "^5.1.0"
+ }
+ },
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "find-up": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
+ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^3.0.0"
+ }
+ },
+ "get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true
+ },
+ "global-modules": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz",
+ "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==",
+ "dev": true,
+ "requires": {
+ "global-prefix": "^3.0.0"
+ }
+ },
+ "global-prefix": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz",
+ "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==",
+ "dev": true,
+ "requires": {
+ "ini": "^1.3.5",
+ "kind-of": "^6.0.2",
+ "which": "^1.3.1"
+ }
+ },
+ "interpret": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
+ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "require-main-filename": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
+ "dev": true
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ },
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "which-module": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
+ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+ "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "string-width": "^3.0.0",
+ "strip-ansi": "^5.0.0"
+ }
+ },
+ "y18n": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
+ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
+ "dev": true
+ },
+ "yargs": {
+ "version": "13.3.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
+ "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^5.0.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^3.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.1.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "13.1.2",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
+ "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+ },
+ "webpack-sources": {
+ "version": "1.4.3",
+ "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz",
+ "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==",
+ "dev": true,
+ "requires": {
+ "source-list-map": "^2.0.0",
+ "source-map": "~0.6.1"
+ },
+ "dependencies": {
+ "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
+ }
+ }
+ },
+ "websocket-driver": {
+ "version": "0.7.3",
+ "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.3.tgz",
+ "integrity": "sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg==",
+ "dev": true,
+ "requires": {
+ "http-parser-js": ">=0.4.0 <0.4.11",
+ "safe-buffer": ">=5.1.0",
+ "websocket-extensions": ">=0.1.1"
+ }
+ },
+ "websocket-extensions": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz",
+ "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==",
+ "dev": true
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "which-module": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz",
+ "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=",
+ "dev": true
+ },
+ "worker-farm": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",
+ "integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==",
+ "dev": true,
+ "requires": {
+ "errno": "~0.1.7"
+ }
+ },
+ "wrap-ansi": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
+ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
+ "dev": true,
+ "requires": {
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ },
+ "xtend": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
+ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
+ "dev": true
+ },
+ "y18n": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
+ "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=",
+ "dev": true
+ },
+ "yallist": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
+ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
+ "dev": true,
+ "optional": true
+ },
+ "yaml": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz",
+ "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg=="
+ },
+ "yargs": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz",
+ "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=",
+ "dev": true,
+ "requires": {
+ "camelcase": "^3.0.0",
+ "cliui": "^3.2.0",
+ "decamelize": "^1.1.1",
+ "get-caller-file": "^1.0.1",
+ "os-locale": "^1.4.0",
+ "read-pkg-up": "^1.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^1.0.1",
+ "set-blocking": "^2.0.0",
+ "string-width": "^1.0.2",
+ "which-module": "^1.0.0",
+ "y18n": "^3.2.1",
+ "yargs-parser": "^5.0.0"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
+ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
+ "dev": true
+ }
+ }
+ },
+ "yargs-parser": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz",
+ "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=",
+ "dev": true,
+ "requires": {
+ "camelcase": "^3.0.0"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
+ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
+ "dev": true
+ }
+ }
+ },
+ "yauzl": {
+ "version": "2.10.0",
+ "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
+ "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "buffer-crc32": "~0.2.3",
+ "fd-slicer": "~1.1.0"
+ }
+ },
+ "yazl": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz",
+ "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==",
+ "dev": true,
+ "requires": {
+ "buffer-crc32": "~0.2.3"
+ }
+ }
+ }
+}
diff --git a/browser/package.json b/browser/package.json
new file mode 100644
index 00000000..2f5e37fd
--- /dev/null
+++ b/browser/package.json
@@ -0,0 +1,50 @@
+{
+ "name": "dnote-extension",
+ "repository": "https://github.com/dnote/dnote",
+ "description": "Dnote browser extension for Chrome and Firefox",
+ "scripts": {
+ "clean": "TARGET=firefox gulp clean && TARGET=chrome gulp clean",
+ "build:chrome": "TARGET=chrome NODE_ENV=production concurrently webpack \"gulp build\"",
+ "build:firefox": "TARGET=firefox NODE_ENV=production concurrently webpack \"gulp build\"",
+ "package:chrome": "TARGET=chrome NODE_ENV=production gulp package",
+ "package:firefox": "TARGET=firefox NODE_ENV=production gulp package",
+ "watch:chrome": "TARGET=chrome NODE_ENV=development concurrently \"webpack --watch\" \"gulp watch\" ",
+ "watch:firefox": "TARGET=firefox NODE_ENV=development concurrently \"webpack --watch\" \"gulp watch\" ",
+ "lint": "../node_modules/.bin/eslint ./src --ext .ts,.tsx,.js",
+ "lint:fix": "../node_modules/.bin/eslint ./src --fix --ext .ts,.tsx,.js"
+ },
+ "author": "Monomax Software Pty Ltd",
+ "license": "GPL-3.0-or-later",
+ "version": "2.0.0",
+ "dependencies": {
+ "classnames": "^2.2.5",
+ "lodash": "^4.17.20",
+ "qs": "^6.9.4",
+ "react": "^16.14.0",
+ "react-dom": "^16.14.0",
+ "react-redux": "^7.2.2",
+ "react-select": "^3.1.1",
+ "redux": "^4.0.4",
+ "redux-logger": "^3.0.6",
+ "redux-thunk": "^2.2.0"
+ },
+ "devDependencies": {
+ "@babel/core": "^7.12.9",
+ "@babel/preset-env": "^7.12.7",
+ "@types/react": "^16.14.2",
+ "@types/react-dom": "^16.9.10",
+ "concurrently": "^5.3.0",
+ "del": "^5.0.0",
+ "gulp": "^4.0.0",
+ "gulp-if": "^3.0.0",
+ "gulp-imagemin": "^6.2.0",
+ "gulp-livereload": "^4.0.2",
+ "gulp-replace": "^1.0.0",
+ "gulp-zip": "^5.0.2",
+ "prettier": "^1.19.1",
+ "ts-loader": "^6.2.2",
+ "typescript": "^3.9.7",
+ "webpack": "^4.44.2",
+ "webpack-cli": "^3.3.12"
+ }
+}
diff --git a/browser/scripts/build_prod.sh b/browser/scripts/build_prod.sh
new file mode 100755
index 00000000..24050ca3
--- /dev/null
+++ b/browser/scripts/build_prod.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# build_prod.sh builds distributable archive for the addon
+# remember to bump version in package.json
+set -eux
+
+# clean
+npm run clean
+
+# chrome
+npm run build:chrome
+npm run package:chrome
+# firefox
+npm run build:firefox
+npm run package:firefox
diff --git a/browser/scripts/zip.sh b/browser/scripts/zip.sh
new file mode 100755
index 00000000..03cb6acc
--- /dev/null
+++ b/browser/scripts/zip.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+tar --exclude='./node_modules' --exclude='./package' --exclude='./dist' -zcvf extension.tar.gz * .eslintrc
diff --git a/browser/src/browser.d.ts b/browser/src/browser.d.ts
new file mode 100644
index 00000000..415ffff0
--- /dev/null
+++ b/browser/src/browser.d.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+// browser.d.ts
+declare let browser: any;
+declare let chrome: any;
diff --git a/browser/src/global.d.ts b/browser/src/global.d.ts
new file mode 100644
index 00000000..0bf0f41c
--- /dev/null
+++ b/browser/src/global.d.ts
@@ -0,0 +1,25 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+// global.d.ts
+
+// defined by webpack-define-plugin
+declare let __API_ENDPOINT__: string;
+declare let __STANDALONE__: string;
+declare let __WEB_URL__: string;
+declare let __VERSION__: string;
diff --git a/browser/src/images/close.svg b/browser/src/images/close.svg
new file mode 100644
index 00000000..1e675311
--- /dev/null
+++ b/browser/src/images/close.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/browser/src/images/hamberger-menu.svg b/browser/src/images/hamberger-menu.svg
new file mode 100644
index 00000000..1dd2b78f
--- /dev/null
+++ b/browser/src/images/hamberger-menu.svg
@@ -0,0 +1 @@
+
diff --git a/browser/src/images/iconx128.png b/browser/src/images/iconx128.png
new file mode 100644
index 00000000..011a9d8f
Binary files /dev/null and b/browser/src/images/iconx128.png differ
diff --git a/browser/src/images/iconx16.png b/browser/src/images/iconx16.png
new file mode 100644
index 00000000..07ef9d85
Binary files /dev/null and b/browser/src/images/iconx16.png differ
diff --git a/browser/src/images/iconx32.png b/browser/src/images/iconx32.png
new file mode 100644
index 00000000..ea23c53e
Binary files /dev/null and b/browser/src/images/iconx32.png differ
diff --git a/browser/src/images/iconx48.png b/browser/src/images/iconx48.png
new file mode 100644
index 00000000..1d27086f
Binary files /dev/null and b/browser/src/images/iconx48.png differ
diff --git a/browser/src/images/iconx96.png b/browser/src/images/iconx96.png
new file mode 100644
index 00000000..a7508afd
Binary files /dev/null and b/browser/src/images/iconx96.png differ
diff --git a/browser/src/images/logo-circle.png b/browser/src/images/logo-circle.png
new file mode 100644
index 00000000..54022b6f
Binary files /dev/null and b/browser/src/images/logo-circle.png differ
diff --git a/browser/src/popup.html b/browser/src/popup.html
new file mode 100644
index 00000000..861f45d1
--- /dev/null
+++ b/browser/src/popup.html
@@ -0,0 +1,15 @@
+
+
+
+ Dnote browser extension
+
+
+
+
+
+
+
+
+
+
+
diff --git a/browser/src/scripts/components/App.tsx b/browser/src/scripts/components/App.tsx
new file mode 100644
index 00000000..19407637
--- /dev/null
+++ b/browser/src/scripts/components/App.tsx
@@ -0,0 +1,118 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useEffect } from 'react';
+
+import initServices from '../utils/services';
+import { logout } from '../store/auth/actions';
+import { AuthState } from '../store/auth/types';
+import { useSelector, useDispatch } from '../store/hooks';
+import Header from './Header';
+import Home from './Home';
+import Menu from './Menu';
+import Success from './Success';
+import Settings from './Settings';
+import Composer from './Composer';
+
+interface Props {}
+
+function renderRoutes(path: string, isLoggedIn: boolean) {
+ switch (path) {
+ case '/success':
+ return ;
+ case '/': {
+ if (isLoggedIn) {
+ return ;
+ }
+
+ return ;
+ }
+ case '/settings': {
+ return ;
+ }
+ default:
+ return Not found
;
+ }
+}
+
+// useCheckSessionValid ensures that the current session is valid
+function useCheckSessionValid(auth: AuthState) {
+ const dispatch = useDispatch();
+
+ useEffect(() => {
+ // if session is expired, clear it
+ const now = Math.round(new Date().getTime() / 1000);
+ if (auth.sessionKey && auth.sessionKeyExpiry < now) {
+ dispatch(logout());
+ }
+ }, [dispatch, auth.sessionKey, auth.sessionKeyExpiry]);
+}
+
+const App: React.FunctionComponent = () => {
+ const [isMenuOpen, setIsMenuOpen] = useState(false);
+ const [errMsg, setErrMsg] = useState('');
+
+ const dispatch = useDispatch();
+ const { path, auth, settings } = useSelector(state => ({
+ path: state.location.path,
+ auth: state.auth,
+ settings: state.settings
+ }));
+
+ useCheckSessionValid(auth);
+
+ const isLoggedIn = Boolean(auth.sessionKey);
+ const toggleMenu = () => {
+ setIsMenuOpen(!isMenuOpen);
+ };
+
+ const handleLogout = async (done?: Function) => {
+ try {
+ await initServices(settings.apiUrl).users.signout();
+ dispatch(logout());
+
+ if (done) {
+ done();
+ }
+ } catch (e) {
+ setErrMsg(e.message);
+ }
+ };
+
+ return (
+
+
+
+ {isMenuOpen && (
+
+ )}
+
+
+ {errMsg && {errMsg}
}
+
+ {renderRoutes(path, isLoggedIn)}
+
+
+ );
+};
+
+export default App;
diff --git a/browser/src/scripts/components/BookIcon.tsx b/browser/src/scripts/components/BookIcon.tsx
new file mode 100644
index 00000000..9f9acb91
--- /dev/null
+++ b/browser/src/scripts/components/BookIcon.tsx
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/browser/src/scripts/components/BookSelector.tsx b/browser/src/scripts/components/BookSelector.tsx
new file mode 100644
index 00000000..4ab86d87
--- /dev/null
+++ b/browser/src/scripts/components/BookSelector.tsx
@@ -0,0 +1,117 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import CreatableSelect from 'react-select/creatable';
+import cloneDeep from 'lodash/cloneDeep';
+import { useSelector, useDispatch } from '../store/hooks';
+import { updateBook, resetBook } from '../store/composer/actions';
+
+interface Props {
+ selectorRef: React.Dispatch;
+ onAfterChange: () => void;
+}
+
+function useCurrentOptions(options) {
+ const currentValue = useSelector(state => state.composer.bookUUID);
+
+ for (let i = 0; i < options.length; i++) {
+ const option = options[i];
+
+ if (option.value === currentValue) {
+ return option;
+ }
+ }
+
+ return null;
+}
+
+function useOptions() {
+ const { books, composer } = useSelector(state => ({
+ books: state.books,
+ composer: state.composer
+ }));
+
+ const opts = books.items.map(book => ({
+ label: book.label,
+ value: book.uuid
+ }));
+
+ if (composer.bookLabel !== '' && composer.bookUUID === '') {
+ opts.push({
+ label: composer.bookLabel,
+ value: ''
+ });
+ }
+
+ // clone the array so as not to mutate Redux state manually
+ // e.g. react-select mutates options prop internally upon adding a new option
+ return cloneDeep(opts);
+}
+
+const BookSelector: React.FunctionComponent = ({
+ selectorRef,
+ onAfterChange
+}) => {
+ const dispatch = useDispatch();
+ const { books } = useSelector(state => ({
+ books: state.books
+ }));
+ const options = useOptions();
+ const currentOption = useCurrentOptions(options);
+
+ let placeholder: string;
+ if (books.isFetched) {
+ placeholder = 'Choose a book';
+ } else {
+ placeholder = 'Loading books...';
+ }
+
+ return (
+ {
+ selectorRef(el);
+ }}
+ multi={false}
+ isClearable
+ placeholder={placeholder}
+ options={options}
+ value={currentOption}
+ onChange={(option, meta) => {
+ if (meta.action === 'clear') {
+ dispatch(resetBook());
+ } else {
+ let uuid: string;
+ if (meta.action === 'create-option') {
+ uuid = '';
+ } else {
+ uuid = option.value;
+ }
+
+ dispatch(updateBook({ uuid, label: option.label }));
+ }
+
+ onAfterChange();
+ }}
+ formatCreateLabel={label => `Add a new book ${label}`}
+ isDisabled={!books.isFetched}
+ />
+ );
+};
+
+export default BookSelector;
diff --git a/browser/src/scripts/components/CloseIcon.tsx b/browser/src/scripts/components/CloseIcon.tsx
new file mode 100644
index 00000000..c574d1ce
--- /dev/null
+++ b/browser/src/scripts/components/CloseIcon.tsx
@@ -0,0 +1,29 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+export default () => (
+
+
+
+
+);
diff --git a/browser/src/scripts/components/Composer.tsx b/browser/src/scripts/components/Composer.tsx
new file mode 100644
index 00000000..154d3c03
--- /dev/null
+++ b/browser/src/scripts/components/Composer.tsx
@@ -0,0 +1,239 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useEffect, useCallback } from 'react';
+import classnames from 'classnames';
+
+import { KEYCODE_ENTER } from 'jslib/helpers/keyboard';
+import initServices from '../utils/services';
+import BookSelector from './BookSelector';
+import Flash from './Flash';
+import { useSelector, useDispatch } from '../store/hooks';
+import { updateContent, resetComposer } from '../store/composer/actions';
+import { fetchBooks } from '../store/books/actions';
+import { navigate } from '../store/location/actions';
+
+interface Props {}
+
+// focusBookSelectorInput focuses on the input element of the book selector.
+// It needs to traverse the tree returned by the ref API of the 'react-select' library,
+// and to guard against possible breaking changes, if the path does not exist, it noops.
+function focusBookSelectorInput(bookSelectorRef) {
+ return (
+ bookSelectorRef.select &&
+ bookSelectorRef.select.select &&
+ bookSelectorRef.select.select.inputRef &&
+ bookSelectorRef.select.select.inputRef.focus()
+ );
+}
+
+function useFetchData() {
+ const dispatch = useDispatch();
+
+ const { books } = useSelector(state => ({
+ books: state.books
+ }));
+
+ useEffect(() => {
+ if (!books.isFetched) {
+ dispatch(fetchBooks());
+ }
+ }, [dispatch, books.isFetched]);
+}
+
+function useInitFocus(contentRef, bookSelectorRef) {
+ const { composer, books } = useSelector(state => ({
+ composer: state.composer,
+ books: state.books
+ }));
+
+ useEffect(() => {
+ if (!books.isFetched) {
+ return () => null;
+ }
+
+ if (bookSelectorRef && contentRef) {
+ if (composer.bookLabel === '') {
+ focusBookSelectorInput(bookSelectorRef);
+ } else {
+ contentRef.focus();
+ }
+ }
+
+ return () => null;
+ }, [contentRef, bookSelectorRef, books.isFetched, composer.bookLabel]);
+}
+
+const Composer: React.FunctionComponent = () => {
+ useFetchData();
+ const [contentFocused, setContentFocused] = useState(false);
+ const [submitting, setSubmitting] = useState(false);
+ const [errMsg, setErrMsg] = useState('');
+ const dispatch = useDispatch();
+ const [contentRef, setContentEl] = useState(null);
+ const [bookSelectorRef, setBookSelectorEl] = useState(null);
+
+ const { composer, settings, auth } = useSelector(state => ({
+ composer: state.composer,
+ settings: state.settings,
+ auth: state.auth
+ }));
+
+ const handleSubmit = useCallback(
+ async e => {
+ e.preventDefault();
+
+ const services = initServices(settings.apiUrl);
+
+ setSubmitting(true);
+
+ try {
+ let bookUUID;
+ if (composer.bookUUID === '') {
+ const resp = await services.books.create(
+ {
+ name: composer.bookLabel
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${auth.sessionKey}`
+ }
+ }
+ );
+
+ bookUUID = resp.book.uuid;
+ } else {
+ bookUUID = composer.bookUUID;
+ }
+
+ const resp = await services.notes.create(
+ {
+ book_uuid: bookUUID,
+ content: composer.content
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${auth.sessionKey}`
+ }
+ }
+ );
+
+ // clear the composer state
+ setErrMsg('');
+ setSubmitting(false);
+
+ dispatch(resetComposer());
+
+ // navigate
+ dispatch(
+ navigate('/success', {
+ bookName: composer.bookLabel,
+ noteUUID: resp.result.uuid
+ })
+ );
+ } catch (err) {
+ setErrMsg(err.message);
+ setSubmitting(false);
+ }
+ },
+ [
+ settings.apiUrl,
+ composer.bookUUID,
+ composer.content,
+ composer.bookLabel,
+ auth.sessionKey,
+ dispatch
+ ]
+ );
+
+ useEffect(() => {
+ const handleSubmitShortcut = e => {
+ // Shift + Enter
+ if (e.shiftKey && e.keyCode === KEYCODE_ENTER) {
+ handleSubmit(e);
+ }
+ };
+
+ window.addEventListener('keydown', handleSubmitShortcut);
+
+ return () => {
+ window.removeEventListener('keydown', handleSubmitShortcut);
+ };
+ }, [composer, handleSubmit]);
+
+ let submitBtnText: string;
+ if (submitting) {
+ submitBtnText = 'Saving...';
+ } else {
+ submitBtnText = 'Save';
+ }
+
+ useInitFocus(contentRef, bookSelectorRef);
+
+ return (
+
+ );
+};
+
+export default Composer;
diff --git a/browser/src/scripts/components/Flash.tsx b/browser/src/scripts/components/Flash.tsx
new file mode 100644
index 00000000..aac61e1d
--- /dev/null
+++ b/browser/src/scripts/components/Flash.tsx
@@ -0,0 +1,37 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+type Kind = 'error' | 'info';
+
+interface Props {
+ message: string;
+ when: boolean;
+ kind: Kind;
+}
+
+const Flash: React.FunctionComponent = ({ message, when, kind }) => {
+ if (when) {
+ return {message}
;
+ }
+
+ return null;
+};
+
+export default Flash;
diff --git a/browser/src/scripts/components/Header.tsx b/browser/src/scripts/components/Header.tsx
new file mode 100644
index 00000000..1ebf8876
--- /dev/null
+++ b/browser/src/scripts/components/Header.tsx
@@ -0,0 +1,54 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import Link from './Link';
+import MenuToggleIcon from './MenuToggleIcon';
+import CloseIcon from './CloseIcon';
+
+interface Props {
+ toggleMenu: () => void;
+ isShowingMenu: boolean;
+}
+
+const Header: React.FunctionComponent = ({
+ toggleMenu,
+ isShowingMenu
+}) => (
+
+);
+
+export default Header;
diff --git a/browser/src/scripts/components/Home.tsx b/browser/src/scripts/components/Home.tsx
new file mode 100644
index 00000000..ff0b8ec4
--- /dev/null
+++ b/browser/src/scripts/components/Home.tsx
@@ -0,0 +1,108 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+
+import { login } from '../store/auth/actions';
+import { useDispatch } from '../store/hooks';
+import Flash from '../components/Flash';
+
+interface Props {}
+
+const Home: React.FunctionComponent = () => {
+ const [email, setEmail] = useState('');
+ const [password, setPassword] = useState('');
+ const [errMsg, setErrMsg] = useState('');
+ const [loggingIn, setLoggingIn] = useState(false);
+ const dispatch = useDispatch();
+
+ const handleLogin = async e => {
+ e.preventDefault();
+
+ setErrMsg('');
+ setLoggingIn(true);
+
+ try {
+ await dispatch(login({ email, password }));
+ } catch (err) {
+ console.log('error while logging in', err);
+
+ setErrMsg(e.message);
+ setLoggingIn(false);
+ }
+ };
+
+ return (
+
+
Welcome to Dnote
+
+
A simple personal knowledge base
+
+
+
+
+ Email
+
+ {
+ setEmail(e.target.value);
+ }}
+ />
+
+ Password
+ {
+ setPassword(e.target.value);
+ }}
+ />
+
+
+ {loggingIn ? 'Signing in...' : 'Sign in'}
+
+
+
+
+
+ );
+};
+
+export default Home;
diff --git a/browser/src/scripts/components/Link.tsx b/browser/src/scripts/components/Link.tsx
new file mode 100644
index 00000000..11eb6927
--- /dev/null
+++ b/browser/src/scripts/components/Link.tsx
@@ -0,0 +1,60 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+/* eslint-disable react/jsx-props-no-spreading */
+
+import React from 'react';
+
+import { useDispatch } from '../store/hooks';
+import { navigate } from '../store/location/actions';
+
+interface Props {
+ to: string;
+ className: string;
+ tabIndex?: number;
+ onClick?: () => void;
+}
+
+const Link: React.FunctionComponent = ({
+ to,
+ children,
+ onClick,
+ ...restProps
+}) => {
+ const dispatch = useDispatch();
+
+ return (
+ {
+ e.preventDefault();
+
+ dispatch(navigate(to));
+
+ if (onClick) {
+ onClick();
+ }
+ }}
+ {...restProps}
+ >
+ {children}
+
+ );
+};
+
+export default Link;
diff --git a/browser/src/scripts/components/Menu.tsx b/browser/src/scripts/components/Menu.tsx
new file mode 100644
index 00000000..a6cbfa9f
--- /dev/null
+++ b/browser/src/scripts/components/Menu.tsx
@@ -0,0 +1,63 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { Fragment } from 'react';
+
+import Link from './Link';
+
+export default ({ toggleMenu, loggedIn, onLogout }) => (
+
+
+
+ {}}
+ role="none"
+ />
+
+);
diff --git a/browser/src/scripts/components/MenuToggleIcon.tsx b/browser/src/scripts/components/MenuToggleIcon.tsx
new file mode 100644
index 00000000..0ff072fb
--- /dev/null
+++ b/browser/src/scripts/components/MenuToggleIcon.tsx
@@ -0,0 +1,61 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see
.
+ */
+
+import React from 'react';
+
+export default () => (
+
+
+
+
+
+);
diff --git a/browser/src/scripts/components/Settings.tsx b/browser/src/scripts/components/Settings.tsx
new file mode 100644
index 00000000..f9465e0c
--- /dev/null
+++ b/browser/src/scripts/components/Settings.tsx
@@ -0,0 +1,156 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see
.
+ */
+
+import React, { useState } from 'react';
+
+import Flash from './Flash';
+import { updateSettings, resetSettings } from '../store/settings/actions';
+import { useDispatch, useSelector, useStore } from '../store/hooks';
+
+interface Props {}
+
+// isValidURL checks if the given string is a valid URL
+function isValidURL(url: string): boolean {
+ const a = document.createElement('a');
+ a.href = url;
+ return a.host && a.host !== window.location.host;
+}
+
+// validateFormState validates the given form state. If any input is
+// invalid, it throws an error.
+function validateFormState({ apiUrl, webUrl }) {
+ if (!isValidURL(apiUrl)) {
+ throw new Error('Invalid URL for the API URL');
+ }
+
+ if (!isValidURL(webUrl)) {
+ throw new Error('Invalid URL for the web URL');
+ }
+}
+
+const Settings: React.FunctionComponent
= () => {
+ const { settings } = useSelector(state => ({
+ settings: state.settings
+ }));
+ const store = useStore();
+
+ const [apiUrl, setAPIUrl] = useState(settings.apiUrl);
+ const [webUrl, setWebUrl] = useState(settings.webUrl);
+ const [errMsg, setErrMsg] = useState('');
+ const [successMsg, setSuccessMsg] = useState('');
+ const dispatch = useDispatch();
+
+ function handleRestore() {
+ dispatch(resetSettings());
+ setSuccessMsg('Restored the default settings');
+
+ const { settings: settingsState } = store.getState();
+
+ setAPIUrl(settingsState.apiUrl);
+ setWebUrl(settingsState.webUrl);
+ }
+
+ function handleSubmit(e) {
+ e.preventDefault();
+ setSuccessMsg('');
+ setErrMsg('');
+
+ try {
+ validateFormState({ apiUrl, webUrl });
+ } catch (err) {
+ setErrMsg(err.message);
+ return;
+ }
+
+ dispatch(
+ updateSettings({
+ apiUrl,
+ webUrl
+ })
+ );
+ setSuccessMsg('Succesfully updated the settings.');
+ }
+
+ return (
+
+
+
+
+
+
Settings
+
+
Customize your Dnote extension
+
+
+
+
+ API URL
+
+
+ {
+ setAPIUrl(e.target.value);
+ }}
+ />
+
+
+
+
+ Web URL
+
+
+ {
+ setWebUrl(e.target.value);
+ }}
+ />
+
+
+
+
+ Save
+
+
+
+ Restore default
+
+
+
+
+
+ );
+};
+
+export default Settings;
diff --git a/browser/src/scripts/components/Success.tsx b/browser/src/scripts/components/Success.tsx
new file mode 100644
index 00000000..5a198d5a
--- /dev/null
+++ b/browser/src/scripts/components/Success.tsx
@@ -0,0 +1,105 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect, useState, Fragment } from 'react';
+
+import {
+ KEYCODE_ENTER,
+ KEYCODE_ESC,
+ KEYCODE_LOWERCASE_B
+} from 'jslib/helpers/keyboard';
+import Flash from './Flash';
+import ext from '../utils/ext';
+import BookIcon from './BookIcon';
+import { navigate } from '../store/location/actions';
+import { useSelector, useDispatch } from '../store/hooks';
+
+const Success: React.FunctionComponent = () => {
+ const [errorMsg, setErrorMsg] = useState('');
+
+ const dispatch = useDispatch();
+ const { location, settings } = useSelector(state => ({
+ location: state.location,
+ settings: state.settings
+ }));
+
+ const { bookName, noteUUID } = location.state;
+
+ useEffect(() => {
+ const handleKeydown = e => {
+ e.preventDefault();
+
+ if (e.keyCode === KEYCODE_ENTER) {
+ dispatch(navigate('/'));
+ } else if (e.keyCode === KEYCODE_ESC) {
+ window.close();
+ } else if (e.keyCode === KEYCODE_LOWERCASE_B) {
+ const url = `${settings.webUrl}/notes/${noteUUID}`;
+
+ ext.tabs
+ .create({ url })
+ .then(() => {
+ window.close();
+ })
+ .catch(err => {
+ setErrorMsg(err.message);
+ });
+ }
+ };
+
+ window.addEventListener('keydown', handleKeydown);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeydown);
+ };
+ }, [dispatch, noteUUID, settings.webUrl]);
+
+ return (
+
+
+
+
+
+
+
+
+ Saved to
+ {bookName}
+
+
+
+
+
+ Enter {' '}
+ Go back
+
+
+ b {' '}
+ Open in browser
+
+
+ ESC
+ Close
+
+
+
+
+ );
+};
+
+export default Success;
diff --git a/browser/src/scripts/popup.tsx b/browser/src/scripts/popup.tsx
new file mode 100644
index 00000000..a0f3aef9
--- /dev/null
+++ b/browser/src/scripts/popup.tsx
@@ -0,0 +1,65 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import ReactDOM from 'react-dom';
+import { Provider } from 'react-redux';
+
+import { debounce } from 'jslib/helpers/perf';
+import configureStore from './store';
+import { loadState, saveState } from './utils/storage';
+import App from './components/App';
+import ext from './utils/ext';
+
+const appContainer = document.getElementById('app');
+
+loadState(items => {
+ if (ext.runtime.lastError) {
+ appContainer.innerText = `Failed to retrieve previous app state ${ext.runtime.lastError.message}`;
+ return;
+ }
+
+ let initialState;
+ const prevState = items.state;
+ if (prevState) {
+ // rehydrate
+ initialState = prevState;
+ }
+
+ const store = configureStore(initialState);
+
+ store.subscribe(
+ debounce(() => {
+ const state = store.getState();
+
+ saveState(state);
+ }, 100)
+ );
+
+ ReactDOM.render(
+
+
+ ,
+ appContainer,
+ () => {
+ // On Chrome, popup window size is kept at minimum if app render is delayed
+ // Therefore add minimum dimension to body until app is rendered
+ document.getElementsByTagName('body')[0].className = '';
+ }
+ );
+});
diff --git a/browser/src/scripts/store/auth/actions.ts b/browser/src/scripts/store/auth/actions.ts
new file mode 100644
index 00000000..793d1ef6
--- /dev/null
+++ b/browser/src/scripts/store/auth/actions.ts
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { LOGIN, LOGOUT, LogoutAction } from './types';
+import { ThunkAction } from '../types';
+import initServices from '../../utils/services';
+
+export function login({ email, password }): ThunkAction {
+ return (dispatch, getState) => {
+ const { settings } = getState();
+ const { apiUrl } = settings;
+
+ return initServices(apiUrl)
+ .users.signin({ email, password })
+ .then(resp => {
+ dispatch({
+ type: LOGIN,
+ data: {
+ sessionKey: resp.key,
+ sessionKeyExpiry: resp.expiresAt
+ }
+ });
+ });
+ };
+}
+
+export function logout(): LogoutAction {
+ return {
+ type: LOGOUT
+ };
+}
diff --git a/browser/src/scripts/store/auth/reducers.ts b/browser/src/scripts/store/auth/reducers.ts
new file mode 100644
index 00000000..50c39e12
--- /dev/null
+++ b/browser/src/scripts/store/auth/reducers.ts
@@ -0,0 +1,45 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { LOGIN, LOGOUT, AuthState, AuthActionType } from './types';
+
+const initialState: AuthState = {
+ sessionKey: '',
+ sessionKeyExpiry: 0
+};
+
+export default function (
+ state = initialState,
+ action: AuthActionType
+): AuthState {
+ switch (action.type) {
+ case LOGIN: {
+ const { sessionKey, sessionKeyExpiry } = action.data;
+
+ return {
+ ...state,
+ sessionKey,
+ sessionKeyExpiry
+ };
+ }
+ case LOGOUT:
+ return initialState;
+ default:
+ return state;
+ }
+}
diff --git a/browser/src/scripts/store/auth/types.ts b/browser/src/scripts/store/auth/types.ts
new file mode 100644
index 00000000..c3a08d42
--- /dev/null
+++ b/browser/src/scripts/store/auth/types.ts
@@ -0,0 +1,39 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+export interface AuthState {
+ sessionKey: string;
+ sessionKeyExpiry: number;
+}
+
+export const LOGIN = 'auth/LOGIN';
+export const LOGOUT = 'auth/LOGOUT';
+
+export interface LoginAction {
+ type: typeof LOGIN;
+ data: {
+ sessionKey: string;
+ sessionKeyExpiry: number;
+ };
+}
+
+export interface LogoutAction {
+ type: typeof LOGOUT;
+}
+
+export type AuthActionType = LogoutAction | LoginAction;
diff --git a/browser/src/scripts/store/books/actions.ts b/browser/src/scripts/store/books/actions.ts
new file mode 100644
index 00000000..39c50c14
--- /dev/null
+++ b/browser/src/scripts/store/books/actions.ts
@@ -0,0 +1,78 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import initServices from '../../utils/services';
+
+import {
+ START_FETCHING,
+ RECEIVE,
+ RECEIVE_ERROR,
+ StartFetchingAction,
+ ReceiveAction,
+ ReceiveErrorAction
+} from './types';
+
+function startFetchingBooks(): StartFetchingAction {
+ return {
+ type: START_FETCHING
+ };
+}
+
+function receiveBooks(books): ReceiveAction {
+ return {
+ type: RECEIVE,
+ data: {
+ books
+ }
+ };
+}
+
+function receiveBooksError(error: string): ReceiveErrorAction {
+ return {
+ type: RECEIVE_ERROR,
+ data: {
+ error
+ }
+ };
+}
+
+export function fetchBooks() {
+ return (dispatch, getState) => {
+ dispatch(startFetchingBooks());
+
+ const { settings, auth } = getState();
+ const services = initServices(settings.apiUrl);
+
+ services.books
+ .fetch(
+ {},
+ {
+ headers: {
+ Authorization: `Bearer ${auth.sessionKey}`
+ }
+ }
+ )
+ .then(books => {
+ dispatch(receiveBooks(books));
+ })
+ .catch(err => {
+ console.log('error fetching books', err);
+ dispatch(receiveBooksError(err));
+ });
+ };
+}
diff --git a/browser/src/scripts/store/books/reducers.ts b/browser/src/scripts/store/books/reducers.ts
new file mode 100644
index 00000000..7ea1cb12
--- /dev/null
+++ b/browser/src/scripts/store/books/reducers.ts
@@ -0,0 +1,66 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ START_FETCHING,
+ RECEIVE,
+ RECEIVE_ERROR,
+ BooksState,
+ BooksActionType
+} from './types';
+
+const initialState = {
+ items: [],
+ isFetching: false,
+ isFetched: false,
+ error: null
+};
+
+export default function (
+ state = initialState,
+ action: BooksActionType
+): BooksState {
+ switch (action.type) {
+ case START_FETCHING:
+ return {
+ ...state,
+ isFetching: true,
+ isFetched: false
+ };
+ case RECEIVE: {
+ const { books } = action.data;
+
+ // get uuids of deleted books and that of a currently selected book
+ return {
+ ...state,
+ isFetching: false,
+ isFetched: true,
+ items: [...state.items, ...books]
+ };
+ }
+ case RECEIVE_ERROR:
+ return {
+ ...state,
+ isFetching: false,
+ isFetched: true,
+ error: action.data.error
+ };
+ default:
+ return state;
+ }
+}
diff --git a/browser/src/scripts/store/books/types.ts b/browser/src/scripts/store/books/types.ts
new file mode 100644
index 00000000..cf060f0c
--- /dev/null
+++ b/browser/src/scripts/store/books/types.ts
@@ -0,0 +1,53 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+export type BookData = any;
+
+export interface BooksState {
+ items: BookData[];
+ isFetching: boolean;
+ isFetched: boolean;
+ error: string | null;
+}
+
+export const START_FETCHING = 'books/START_FETCHING';
+export const RECEIVE = 'books/RECEIVE';
+export const RECEIVE_ERROR = 'books/RECEIVE_ERROR';
+
+export interface StartFetchingAction {
+ type: typeof START_FETCHING;
+}
+
+export interface ReceiveAction {
+ type: typeof RECEIVE;
+ data: {
+ books: BookData[];
+ };
+}
+
+export interface ReceiveErrorAction {
+ type: typeof RECEIVE_ERROR;
+ data: {
+ error: string;
+ };
+}
+
+export type BooksActionType =
+ | StartFetchingAction
+ | ReceiveAction
+ | ReceiveErrorAction;
diff --git a/browser/src/scripts/store/composer/actions.ts b/browser/src/scripts/store/composer/actions.ts
new file mode 100644
index 00000000..f77c3ba0
--- /dev/null
+++ b/browser/src/scripts/store/composer/actions.ts
@@ -0,0 +1,65 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ UPDATE_CONTENT,
+ UPDATE_BOOK,
+ RESET,
+ RESET_BOOK,
+ UpdateContentAction,
+ UpdateBookAction,
+ ResetBookAction,
+ ResetAction
+} from './types';
+
+export function updateContent(content: string): UpdateContentAction {
+ return {
+ type: UPDATE_CONTENT,
+ data: { content }
+ };
+}
+
+export interface UpdateBookActionParam {
+ uuid: string;
+ label: string;
+}
+
+export function updateBook({
+ uuid,
+ label
+}: UpdateBookActionParam): UpdateBookAction {
+ return {
+ type: UPDATE_BOOK,
+ data: {
+ uuid,
+ label
+ }
+ };
+}
+
+export function resetBook(): ResetBookAction {
+ return {
+ type: RESET_BOOK
+ };
+}
+
+export function resetComposer(): ResetAction {
+ return {
+ type: RESET
+ };
+}
diff --git a/browser/src/scripts/store/composer/reducers.ts b/browser/src/scripts/store/composer/reducers.ts
new file mode 100644
index 00000000..4a09017e
--- /dev/null
+++ b/browser/src/scripts/store/composer/reducers.ts
@@ -0,0 +1,65 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ UPDATE_CONTENT,
+ UPDATE_BOOK,
+ RESET,
+ RESET_BOOK,
+ ComposerActionType,
+ ComposerState
+} from './types';
+
+const initialState: ComposerState = {
+ content: '',
+ bookUUID: '',
+ bookLabel: ''
+};
+
+export default function (
+ state = initialState,
+ action: ComposerActionType
+): ComposerState {
+ switch (action.type) {
+ case UPDATE_CONTENT: {
+ return {
+ ...state,
+ content: action.data.content
+ };
+ }
+ case UPDATE_BOOK: {
+ return {
+ ...state,
+ bookUUID: action.data.uuid,
+ bookLabel: action.data.label
+ };
+ }
+ case RESET_BOOK: {
+ return {
+ ...state,
+ bookUUID: '',
+ bookLabel: ''
+ };
+ }
+ case RESET: {
+ return initialState;
+ }
+ default:
+ return state;
+ }
+}
diff --git a/browser/src/scripts/store/composer/types.ts b/browser/src/scripts/store/composer/types.ts
new file mode 100644
index 00000000..c6e003c0
--- /dev/null
+++ b/browser/src/scripts/store/composer/types.ts
@@ -0,0 +1,57 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+export interface ComposerState {
+ content: string;
+ bookUUID: string;
+ bookLabel: string;
+}
+
+export const UPDATE_CONTENT = 'composer/UPDATE_CONTENT';
+export const UPDATE_BOOK = 'composer/UPDATE_BOOK';
+export const RESET = 'composer/RESET';
+export const RESET_BOOK = 'composer/RESET_BOOK';
+
+export interface UpdateContentAction {
+ type: typeof UPDATE_CONTENT;
+ data: {
+ content: string;
+ };
+}
+
+export interface UpdateBookAction {
+ type: typeof UPDATE_BOOK;
+ data: {
+ uuid: string;
+ label: string;
+ };
+}
+
+export interface ResetAction {
+ type: typeof RESET;
+}
+
+export interface ResetBookAction {
+ type: typeof RESET_BOOK;
+}
+
+export type ComposerActionType =
+ | UpdateContentAction
+ | UpdateBookAction
+ | ResetAction
+ | ResetBookAction;
diff --git a/browser/src/scripts/store/hooks.ts b/browser/src/scripts/store/hooks.ts
new file mode 100644
index 00000000..01b5c6cc
--- /dev/null
+++ b/browser/src/scripts/store/hooks.ts
@@ -0,0 +1,43 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { Store, Action } from 'redux';
+import {
+ useDispatch as useReduxDispatch,
+ useStore as useReduxStore,
+ useSelector as useReduxSelector
+} from 'react-redux';
+import { ThunkDispatch } from 'redux-thunk';
+
+import { AppState } from './types';
+
+type ReduxDispatch = ThunkDispatch;
+
+export function useDispatch(): ReduxDispatch {
+ return useReduxDispatch();
+}
+
+export function useStore(): Store {
+ return useReduxStore();
+}
+
+export function useSelector(
+ selector: (state: AppState) => TSelected
+) {
+ return useReduxSelector(selector);
+}
diff --git a/browser/src/scripts/store/index.ts b/browser/src/scripts/store/index.ts
new file mode 100644
index 00000000..902a1038
--- /dev/null
+++ b/browser/src/scripts/store/index.ts
@@ -0,0 +1,70 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { combineReducers, createStore, applyMiddleware, compose } from 'redux';
+import thunkMiddleware from 'redux-thunk';
+import createLogger from 'redux-logger';
+
+import location from './location/reducers';
+import settings from './settings/reducers';
+import books from './books/reducers';
+import composer from './composer/reducers';
+import auth from './auth/reducers';
+import { AppState } from './types';
+import config from '../utils/config';
+
+const rootReducer = combineReducers({
+ auth,
+ location,
+ settings,
+ books,
+ composer
+});
+
+// initState returns a new state with any missing values populated
+// if a state is given.
+function initState(s: AppState | undefined): AppState {
+ if (s === undefined) {
+ return undefined;
+ }
+
+ const { settings: settingsState } = s;
+
+ return {
+ ...s,
+ settings: {
+ ...settingsState,
+ apiUrl: settingsState.apiUrl || config.defaultApiEndpoint,
+ webUrl: settingsState.webUrl || config.defaultWebUrl
+ }
+ };
+}
+
+// configureStore returns a new store that contains the appliation state
+export default function configureStore(state: AppState | undefined) {
+ const typedWindow = window as any;
+
+ const composeEnhancers =
+ typedWindow.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
+
+ return createStore(
+ rootReducer,
+ initState(state),
+ composeEnhancers(applyMiddleware(createLogger, thunkMiddleware))
+ );
+}
diff --git a/browser/src/scripts/store/location/actions.ts b/browser/src/scripts/store/location/actions.ts
new file mode 100644
index 00000000..0cf6f1fd
--- /dev/null
+++ b/browser/src/scripts/store/location/actions.ts
@@ -0,0 +1,26 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { NAVIGATE, NavigateAction } from './types';
+
+export function navigate(path: string, state?): NavigateAction {
+ return {
+ type: NAVIGATE,
+ data: { path, state }
+ };
+}
diff --git a/browser/src/scripts/store/location/reducers.ts b/browser/src/scripts/store/location/reducers.ts
new file mode 100644
index 00000000..b1e155c1
--- /dev/null
+++ b/browser/src/scripts/store/location/reducers.ts
@@ -0,0 +1,40 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { NAVIGATE, LocationState, LocationActionType } from './types';
+
+const initialState: LocationState = {
+ path: '/',
+ state: {}
+};
+
+export default function (
+ state = initialState,
+ action: LocationActionType
+): LocationState {
+ switch (action.type) {
+ case NAVIGATE:
+ return {
+ ...state,
+ path: action.data.path,
+ state: action.data.state || {}
+ };
+ default:
+ return state;
+ }
+}
diff --git a/browser/src/scripts/store/location/types.ts b/browser/src/scripts/store/location/types.ts
new file mode 100644
index 00000000..84a085e9
--- /dev/null
+++ b/browser/src/scripts/store/location/types.ts
@@ -0,0 +1,34 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+export interface LocationState {
+ path: string;
+ state: any;
+}
+
+export const NAVIGATE = 'location/NAVIGATE';
+
+export interface NavigateAction {
+ type: typeof NAVIGATE;
+ data: {
+ path: string;
+ state: string;
+ };
+}
+
+export type LocationActionType = NavigateAction;
diff --git a/browser/src/scripts/store/settings/actions.ts b/browser/src/scripts/store/settings/actions.ts
new file mode 100644
index 00000000..a44adad4
--- /dev/null
+++ b/browser/src/scripts/store/settings/actions.ts
@@ -0,0 +1,32 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { UPDATE, RESET, UpdateAction, ResetAction } from './types';
+
+export function updateSettings(settings): UpdateAction {
+ return {
+ type: UPDATE,
+ data: { settings }
+ };
+}
+
+export function resetSettings(): ResetAction {
+ return {
+ type: RESET
+ };
+}
diff --git a/browser/src/scripts/store/settings/reducers.ts b/browser/src/scripts/store/settings/reducers.ts
new file mode 100644
index 00000000..438a6236
--- /dev/null
+++ b/browser/src/scripts/store/settings/reducers.ts
@@ -0,0 +1,42 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { UPDATE, RESET, SettingsState, SettingsActionType } from './types';
+import config from '../../utils/config';
+
+const initialState: SettingsState = {
+ apiUrl: config.defaultApiEndpoint,
+ webUrl: config.defaultWebUrl
+};
+
+export default function (
+ state = initialState,
+ action: SettingsActionType
+): SettingsState {
+ switch (action.type) {
+ case UPDATE:
+ return {
+ ...state,
+ ...action.data.settings
+ };
+ case RESET:
+ return initialState;
+ default:
+ return state;
+ }
+}
diff --git a/browser/src/scripts/store/settings/types.ts b/browser/src/scripts/store/settings/types.ts
new file mode 100644
index 00000000..772b256a
--- /dev/null
+++ b/browser/src/scripts/store/settings/types.ts
@@ -0,0 +1,38 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+export interface SettingsState {
+ apiUrl: string;
+ webUrl: string;
+}
+
+export const UPDATE = 'settings/UPDATE';
+export const RESET = 'settings/RESET';
+
+export interface UpdateAction {
+ type: typeof UPDATE;
+ data: {
+ settings: Partial;
+ };
+}
+
+export interface ResetAction {
+ type: typeof RESET;
+}
+
+export type SettingsActionType = UpdateAction | ResetAction;
diff --git a/browser/src/scripts/store/types.ts b/browser/src/scripts/store/types.ts
new file mode 100644
index 00000000..a879febc
--- /dev/null
+++ b/browser/src/scripts/store/types.ts
@@ -0,0 +1,43 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { Action } from 'redux';
+import { ThunkAction as ReduxThunkAction } from 'redux-thunk';
+
+import { AuthState } from './auth/types';
+import { ComposerState } from './composer/types';
+import { LocationState } from './location/types';
+import { SettingsState } from './settings/types';
+import { BooksState } from './books/types';
+
+// AppState represents the application state
+export interface AppState {
+ auth: AuthState;
+ composer: ComposerState;
+ location: LocationState;
+ settings: SettingsState;
+ books: BooksState;
+}
+
+// ThunkAction is a thunk action type
+export type ThunkAction = ReduxThunkAction<
+ Promise,
+ AppState,
+ void,
+ Action
+>;
diff --git a/browser/src/scripts/utils/config.ts b/browser/src/scripts/utils/config.ts
new file mode 100644
index 00000000..435539e1
--- /dev/null
+++ b/browser/src/scripts/utils/config.ts
@@ -0,0 +1,23 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+export default {
+ defaultWebUrl: __WEB_URL__,
+ defaultApiEndpoint: __API_ENDPOINT__,
+ version: __VERSION__
+};
diff --git a/browser/src/scripts/utils/ext.ts b/browser/src/scripts/utils/ext.ts
new file mode 100644
index 00000000..5b8e6bfb
--- /dev/null
+++ b/browser/src/scripts/utils/ext.ts
@@ -0,0 +1,55 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+// module ext provides a cross-browser interface to access extension APIs
+// by using WebExtensions API if available, and using Chrome as a fallback.
+const ext: any = {};
+
+const apis = ['tabs', 'storage', 'runtime'];
+
+for (let i = 0; i < apis.length; i++) {
+ const api = apis[i];
+
+ try {
+ if (browser[api]) {
+ ext[api] = browser[api];
+ }
+ } catch (e) {}
+
+ try {
+ if (chrome[api] && !ext[api]) {
+ ext[api] = chrome[api];
+
+ // Standardize the signature to conform to WebExtensions API
+ if (api === 'tabs') {
+ const fn = ext[api].create;
+
+ // Promisify chrome.tabs.create
+ ext[api].create = obj => {
+ return new Promise(resolve => {
+ fn(obj, tab => {
+ resolve(tab);
+ });
+ });
+ };
+ }
+ }
+ } catch (e) {}
+}
+
+export default ext;
diff --git a/browser/src/scripts/utils/fetch.js b/browser/src/scripts/utils/fetch.js
new file mode 100644
index 00000000..475ea5a7
--- /dev/null
+++ b/browser/src/scripts/utils/fetch.js
@@ -0,0 +1,64 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import qs from 'qs';
+
+function checkStatus(response) {
+ if (response.status >= 200 && response.status < 300) {
+ return response;
+ }
+ return response.text().then(body => {
+ const error = new Error(body);
+ error.response = response;
+
+ throw error;
+ });
+}
+
+function parseJSON(response) {
+ if (response.headers.get('Content-Type') === 'application/json') {
+ return response.json();
+ }
+
+ return Promise.resolve();
+}
+
+function request(url, options) {
+ return fetch(url, options).then(checkStatus).then(parseJSON);
+}
+
+export function post(url, data, options = {}) {
+ return request(url, {
+ method: 'POST',
+ body: JSON.stringify(data),
+ ...options
+ });
+}
+
+export function get(url, options = {}) {
+ let endpoint = url;
+
+ if (options.params) {
+ endpoint = `${endpoint}?${qs.stringify(options.params)}`;
+ }
+
+ return request(endpoint, {
+ method: 'GET',
+ ...options
+ });
+}
diff --git a/browser/src/scripts/utils/services.ts b/browser/src/scripts/utils/services.ts
new file mode 100644
index 00000000..52e22a14
--- /dev/null
+++ b/browser/src/scripts/utils/services.ts
@@ -0,0 +1,27 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import init from 'jslib/services';
+
+const initServices = (baseUrl: string) =>
+ init({
+ baseUrl,
+ pathPrefix: ''
+ });
+
+export default initServices;
diff --git a/browser/src/scripts/utils/storage.ts b/browser/src/scripts/utils/storage.ts
new file mode 100644
index 00000000..0df5b02e
--- /dev/null
+++ b/browser/src/scripts/utils/storage.ts
@@ -0,0 +1,63 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+import ext from './ext';
+
+const stateKey = 'state';
+
+// filterState filters the given state to be suitable for reuse upon next app
+// load
+function filterState(state) {
+ return {
+ ...state,
+ location: {
+ ...state.location,
+ path: '/'
+ }
+ };
+}
+
+function parseStorageItem(item) {
+ if (!item) {
+ return null;
+ }
+
+ return JSON.parse(item);
+}
+
+// saveState writes the given state to storage
+export function saveState(state) {
+ const filtered = filterState(state);
+ const serialized = JSON.stringify(filtered);
+
+ ext.storage.local.set({ [stateKey]: serialized }, () => {
+ console.log('synced state');
+ });
+}
+
+// loadState loads and parses serialized state stored in ext.storage
+export function loadState(done) {
+ ext.storage.local.get('state', items => {
+ const parsed = {
+ ...items,
+ state: parseStorageItem(items.state)
+ };
+
+ return done(parsed);
+ });
+}
diff --git a/browser/src/styles/popup.css b/browser/src/styles/popup.css
new file mode 100644
index 00000000..4dec5270
--- /dev/null
+++ b/browser/src/styles/popup.css
@@ -0,0 +1,431 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+/* container width: 345px */
+
+/* global */
+html {
+ font-size: 62.5%;
+ /* 1.0 rem = 10px */
+}
+body {
+ margin: 0;
+ font-family: 'Lato', sans-serif;
+ font-size: 1.6rem;
+}
+body.pending {
+ height: 257px;
+ width: 345px;
+}
+main.blur {
+ opacity: 0.15;
+}
+.container {
+ width: 345px;
+ position: relative;
+}
+.input {
+ display: block;
+ width: 100%;
+ padding: .375rem .75rem;
+ font-size: 1rem;
+ line-height: 1.5;
+ color: #495057;
+ background-color: #fff;
+ background-clip: padding-box;
+ border: 1px solid #ced4da;
+ border-radius: .25rem;
+ transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
+ box-sizing: border-box;
+ font-size: 16px;
+}
+.login-input {
+ margin-top: 4px;
+}
+.message {
+ color: #2cae2c;
+ margin-bottom: 6px;
+}
+.alert {
+ padding: 10px 9px;
+ font-size: 1.4rem;
+}
+.alert-info {
+ color: #0c5460;
+ background-color: #bee5eb;
+ border-color: #f5c6cb;
+}
+.alert-error {
+ color: #721c24;
+ background-color: #f8d7da;
+ border-color: #f5c6cb;
+}
+kbd {
+ display: inline-block;
+ padding: 3px 5px;
+ font: 11px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
+ line-height: 10px;
+ color: #444d56;
+ vertical-align: middle;
+ background-color: #fafbfc;
+ border: solid 1px #d1d5da;
+ border-bottom-color: #c6cbd1;
+ border-radius: 3px;
+ box-shadow: inset 0 -1px 0 #c6cbd1;
+}
+.menu {
+ position: absolute;
+ left: 0;
+ right: 0;
+ background: white;
+ margin-top: 0;
+ margin-bottom: 0;
+ z-index: 1;
+ list-style: none;
+ padding-left: 0;
+ margin-bottom: 0;
+ box-shadow: 0px 3px 2px 0px #cacaca;
+}
+.menu .logout-button {
+ width: 100%;
+ border: none;
+ background: none;
+ text-align: left;
+ cursor: pointer;
+}
+.menu-link {
+ display: block;
+ padding: 10px 13px;
+ color: inherit;
+ text-decoration: none;
+ font-size: 16px;
+
+ /* override chrome default */
+ font: inherit !important;
+}
+.menu-link:hover {
+ background: #f7f7f7;
+}
+.menu-link:not(:hover) {
+ background: inherit;
+}
+.menu-overlay {
+ position: absolute;
+ bottom: 0;
+ top: 44px;
+ left: 0;
+ right: 0;
+ opacity: 0.8;
+ background: #f7f7f7;
+}
+.header {
+ background-color: #272a35;
+ height: 44px;
+ display: flex;
+ align-items: center;
+ padding: 0 8px;
+ justify-content: space-between;
+}
+.header .logo {
+ width: 32px;
+}
+.header .logo-link {
+ height: 32px;
+}
+.header .menu-toggle {
+ height: 20px;
+}
+
+.heading {
+ font-size: 2.2rem;
+ margin-top: 0;
+ margin-bottom: 0;
+ text-align: center;
+}
+.lead {
+ color: #575757;
+ text-align: center;
+}
+.page {
+ padding: 16px 28px;
+}
+
+/* home */
+.home {
+ text-align: center;
+}
+.home #login-form {
+ text-align: left;
+}
+.home #login-form label {
+ display: inline-block;
+ font-weight: 600;
+ margin-top: 8px;
+}
+.home .login-btn {
+ width: 100%;
+ justify-content: center;
+ margin-top: 12px;
+}
+.home .actions {
+ margin-top: 18px;
+ font-size: 1.3rem;
+ color: gray;
+}
+.home .actions a {
+ color: gray;
+ font-weight: 600;
+}
+.home .actions .signup:visited {
+ color: inherit;
+}
+
+/* settings */
+.settings #settings-form {
+ margin-top: 12px;
+}
+.settings .input-row ~ .input-row {
+ margin-top: 12px;
+}
+.settings .label {
+ display: inline-block;
+ margin-bottom: 2px;
+}
+.settings .actions {
+ margin-top: 12px;
+ text-align: center;
+}
+.settings .restore {
+ margin-top: 8px;
+ display: inline-block;
+ color: gray;
+ font-size: 1.3rem;
+}
+
+/* composer */
+.composer .form {
+ display: flex;
+ flex-direction: column;
+}
+.composer .content-container {
+ position: relative;
+ height: 148px;
+}
+.composer .content {
+ border: none;
+ resize: none;
+ height: 100%;
+ width: 100%;
+ padding: 11px 11px 18px 11px;
+ font-size: 1.5rem;
+ margin-bottom: 0;
+ box-sizing: border-box;
+ border: 1px solid #e2e2e2;
+ border-top: 0;
+}
+.composer .content::placeholder {
+ color: #aaa;
+}
+.composer .content:focus {
+ box-shadow: inset 0px 0px 3px #c0c0c0;
+ outline: none;
+}
+.composer .shortcut-hint {
+ position: absolute;
+ bottom: 3px;
+ right: 7px;
+ color: gray;
+ font-size: 1.2rem;
+ font-style: italic;
+}
+.composer .shortcut-hint:not(.shown) {
+ visibility: hidden;
+}
+.composer .submit-button {
+ color: #fff;
+ background-color: #272a35;
+ border-radius: 0;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ font-weight: 400;
+ line-height: 1.25;
+ text-align: center;
+ white-space: nowrap;
+ vertical-align: middle;
+ user-select: none;
+ transition: all 0.2s ease-in-out;
+ font-size: 1.4rem;
+ text-decoration: none;
+ padding: 11px 18px;
+ border-radius: 5px;
+ cursor: pointer;
+ box-sizing: border-box;
+ padding: 6px 0;
+ border-radius: 0;
+ border: none;
+}
+.composer .submit-button:hover {
+ color: #fff;
+ background-color: #323642;
+ box-shadow: 0px 0px 4px 2px #cacaca;
+}
+.composer .book-value {
+ display: flex;
+ align-items: center;
+}
+.composer .book-value .book-icon {
+ margin-right: 9px;
+ margin-top: 1px;
+}
+.composer .book-option {
+ font-size: 1.4rem;
+ padding: 5px 8px;
+}
+
+/* success */
+.success-page {
+ text-align: center;
+ padding: 21px 0;
+}
+.success-page .key-list {
+ display: inline-block;
+ list-style: none;
+ padding-left: 0;
+ margin-bottom: 0;
+}
+.success-page .key-item {
+ display: flex;
+}
+.success-page .key-item:not(:first-child) {
+ margin-top: 8px;
+}
+.success-page .key-desc {
+ font-size: 1.4rem;
+ margin-left: 9px;
+}
+.success-page .book-icon {
+ vertical-align: middle;
+}
+.success-page .heading {
+ display: inline-block;
+ font-size: 2.2rem;
+ margin-left: 13px;
+ margin-top: 0;
+ margin-bottom: 0;
+ vertical-align: middle;
+}
+
+/* buttons */
+.button {
+ display: inline-flex;
+ align-items: center;
+ font-weight: 400;
+ line-height: 1.25;
+ text-align: center;
+ white-space: nowrap;
+ vertical-align: middle;
+ user-select: none;
+ border-width: 2px;
+ border-style: solid;
+ border-color: transparent;
+ border-image: initial;
+ padding: 0.5rem 1rem;
+ border-radius: 0.25rem;
+ transition: all 0.2s ease-in-out;
+ font-size: 1.4rem;
+ text-decoration: none;
+ padding: 11px 18px;
+ border-radius: 5px;
+ cursor: pointer;
+ box-sizing: border-box;
+}
+
+.button:hover {
+ text-decoration: none;
+}
+
+.button:disabled {
+ cursor: not-allowed;
+ opacity: 0.6;
+}
+
+.button:icon {
+ margin-right: 3px;
+}
+
+.button-first {
+ color: #ffffff;
+ background-color: #333745;
+}
+.button-first:hover {
+ color: #ffffff;
+ background-color: #252833;
+ box-shadow: 0px 0px 4px 2px #cacaca;
+}
+
+.button-first-outline {
+ background: transparent;
+ border-color: #333745;
+ color: #333744;
+}
+.button-first-outline:hover {
+ color: #333744;
+}
+
+.button-second {
+ background: white;
+ color: #343a40;
+}
+.button-second:hover {
+ color: #343a40;
+}
+
+.button-third {
+ color: #ffffff;
+ background-color: #4577cc;
+}
+.button-third:hover {
+ color: #ffffff;
+ background-color: #245fc5;
+ box-shadow: 0px 0px 4px 2px #cacaca;
+}
+
+.button-outline {
+ color: #0366d6;
+ background-color: #fff;
+ border: 2px solid #0366d6;
+}
+
+.button ~ .button {
+ margin-left: 10px;
+}
+
+.button-small {
+ padding: 5px 14px;
+}
+.button-stretch {
+ width: 100%;
+ justify-content: center;
+}
+.button-no-ui {
+ border: none;
+ background: none;
+ text-align: left;
+ cursor: pointer;
+}
diff --git a/browser/src/styles/select.css b/browser/src/styles/select.css
new file mode 100644
index 00000000..54024788
--- /dev/null
+++ b/browser/src/styles/select.css
@@ -0,0 +1,453 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+/**
+ * React Select
+ * ============
+ * Created by Jed Watson and Joss Mackison for KeystoneJS, http://www.keystonejs.com/
+ * https://twitter.com/jedwatson https://twitter.com/jossmackison https://twitter.com/keystonejs
+ * MIT License: https://github.com/JedWatson/react-select
+*/
+.Select {
+ position: relative;
+}
+.Select input::-webkit-contacts-auto-fill-button,
+.Select input::-webkit-credentials-auto-fill-button {
+ display: none !important;
+}
+.Select input::-ms-clear {
+ display: none !important;
+}
+.Select input::-ms-reveal {
+ display: none !important;
+}
+.Select,
+.Select div,
+.Select input,
+.Select span {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+.Select.is-disabled .Select-arrow-zone {
+ cursor: default;
+ pointer-events: none;
+ opacity: 0.35;
+}
+.Select.is-disabled > .Select-control {
+ background-color: #f9f9f9;
+}
+.Select.is-disabled > .Select-control:hover {
+ box-shadow: none;
+}
+.Select.is-open > .Select-control {
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+ background: #fff;
+ border-color: #b3b3b3 #ccc #d9d9d9;
+}
+.Select.is-open > .Select-control .Select-arrow {
+ top: -2px;
+ border-color: transparent transparent #999;
+ border-width: 0 5px 5px;
+}
+.Select.is-searchable.is-open > .Select-control {
+ cursor: text;
+}
+.Select.is-searchable.is-focused:not(.is-open) > .Select-control {
+ cursor: text;
+}
+.Select.is-focused > .Select-control {
+ background: #fff;
+}
+.Select.is-focused:not(.is-open) > .Select-control {
+ border-color: #007eff;
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
+ 0 0 0 3px rgba(0, 126, 255, 0.1);
+ background: #fff;
+}
+.Select.has-value.is-clearable.Select--single > .Select-control .Select-value {
+ padding-right: 42px;
+}
+.Select.has-value.Select--single
+ > .Select-control .Select-value .Select-value-label,
+.Select.has-value.is-pseudo-focused.Select--single
+ > .Select-control .Select-value .Select-value-label {
+ color: #333;
+}
+.Select.has-value.Select--single
+ > .Select-control .Select-value a.Select-value-label,
+.Select.has-value.is-pseudo-focused.Select--single
+ > .Select-control .Select-value a.Select-value-label {
+ cursor: pointer;
+ text-decoration: none;
+}
+.Select.has-value.Select--single
+ > .Select-control .Select-value a.Select-value-label:hover,
+.Select.has-value.is-pseudo-focused.Select--single
+ > .Select-control .Select-value a.Select-value-label:hover,
+.Select.has-value.Select--single
+ > .Select-control .Select-value a.Select-value-label:focus,
+.Select.has-value.is-pseudo-focused.Select--single
+ > .Select-control .Select-value a.Select-value-label:focus {
+ color: #007eff;
+ outline: none;
+ text-decoration: underline;
+}
+.Select.has-value.Select--single
+ > .Select-control .Select-value a.Select-value-label:focus,
+.Select.has-value.is-pseudo-focused.Select--single
+ > .Select-control .Select-value a.Select-value-label:focus {
+ background: #fff;
+}
+.Select.has-value.is-pseudo-focused .Select-input {
+ opacity: 0;
+}
+.Select.is-open .Select-arrow,
+.Select .Select-arrow-zone:hover > .Select-arrow {
+ border-top-color: #666;
+}
+.Select.Select--rtl {
+ direction: rtl;
+ text-align: right;
+}
+.Select-control {
+ background-color: #fff;
+ color: #333;
+ cursor: default;
+ display: table;
+ border: 1px solid #e2e2e2;
+ border-top: 0;
+ height: 36px;
+ outline: none;
+ overflow: hidden;
+ position: relative;
+ width: 100%;
+}
+.Select-control:hover {
+ box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
+}
+.Select-control .Select-input:focus {
+ outline: none;
+ background: #fff;
+}
+.Select-placeholder,
+.Select--single > .Select-control .Select-value {
+ bottom: 0;
+ color: #aaa;
+ left: 0;
+ line-height: 34px;
+ padding-left: 10px;
+ padding-right: 10px;
+ position: absolute;
+ right: 0;
+ top: 0;
+ max-width: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.Select-input {
+ height: 34px;
+ padding-left: 10px;
+ padding-right: 10px;
+ vertical-align: middle;
+}
+.Select-input > input {
+ width: 100%;
+ background: none transparent;
+ border: 0 none;
+ box-shadow: none;
+ cursor: default;
+ display: inline-block;
+ font-family: inherit;
+ font-size: inherit;
+ margin: 0;
+ outline: none;
+ line-height: 17px;
+ /* For IE 8 compatibility */
+ padding: 8px 0 12px;
+ /* For IE 8 compatibility */
+ -webkit-appearance: none;
+}
+.is-focused .Select-input > input {
+ cursor: text;
+}
+.has-value.is-pseudo-focused .Select-input {
+ opacity: 0;
+}
+.Select-control:not(.is-searchable) > .Select-input {
+ outline: none;
+}
+.Select-loading-zone {
+ cursor: pointer;
+ display: table-cell;
+ position: relative;
+ text-align: center;
+ vertical-align: middle;
+ width: 16px;
+}
+.Select-loading {
+ -webkit-animation: Select-animation-spin 400ms infinite linear;
+ -o-animation: Select-animation-spin 400ms infinite linear;
+ animation: Select-animation-spin 400ms infinite linear;
+ width: 16px;
+ height: 16px;
+ box-sizing: border-box;
+ border-radius: 50%;
+ border: 2px solid #ccc;
+ border-right-color: #333;
+ display: inline-block;
+ position: relative;
+ vertical-align: middle;
+}
+.Select-clear-zone {
+ -webkit-animation: Select-animation-fadeIn 200ms;
+ -o-animation: Select-animation-fadeIn 200ms;
+ animation: Select-animation-fadeIn 200ms;
+ color: #999;
+ cursor: pointer;
+ display: table-cell;
+ position: relative;
+ text-align: center;
+ vertical-align: middle;
+ width: 17px;
+}
+.Select-clear-zone:hover {
+ color: #d0021b;
+}
+.Select-clear {
+ display: inline-block;
+ font-size: 18px;
+ line-height: 1;
+}
+.Select--multi .Select-clear-zone {
+ width: 17px;
+}
+.Select-arrow-zone {
+ cursor: pointer;
+ display: table-cell;
+ position: relative;
+ text-align: center;
+ vertical-align: middle;
+ width: 25px;
+ padding-right: 5px;
+}
+.Select--rtl .Select-arrow-zone {
+ padding-right: 0;
+ padding-left: 5px;
+}
+.Select-arrow {
+ border-color: #999 transparent transparent;
+ border-style: solid;
+ border-width: 5px 5px 2.5px;
+ display: inline-block;
+ height: 0;
+ width: 0;
+ position: relative;
+}
+.Select-control > *:last-child {
+ padding-right: 5px;
+}
+.Select--multi .Select-multi-value-wrapper {
+ display: inline-block;
+}
+.Select .Select-aria-only {
+ position: absolute;
+ display: inline-block;
+ height: 1px;
+ width: 1px;
+ margin: -1px;
+ clip: rect(0, 0, 0, 0);
+ overflow: hidden;
+ float: left;
+}
+@-webkit-keyframes Select-animation-fadeIn {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+@keyframes Select-animation-fadeIn {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+.Select-menu-outer {
+ border-bottom-right-radius: 4px;
+ border-bottom-left-radius: 4px;
+ background-color: #fff;
+ border: 1px solid #ccc;
+ border-top-color: #e6e6e6;
+ box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
+ box-sizing: border-box;
+ margin-top: -1px;
+ max-height: 200px;
+ position: absolute;
+ left: 0;
+ top: 100%;
+ width: 100%;
+ z-index: 1;
+ -webkit-overflow-scrolling: touch;
+}
+.Select-menu {
+ max-height: 150px;
+ overflow-y: auto;
+}
+.Select-option {
+ box-sizing: border-box;
+ background-color: #fff;
+ color: #666666;
+ cursor: pointer;
+ display: block;
+ padding: 8px 10px;
+}
+.Select-option:last-child {
+ border-bottom-right-radius: 4px;
+ border-bottom-left-radius: 4px;
+}
+.Select-option.is-selected {
+ background-color: #f5faff;
+ /* Fallback color for IE 8 */
+ background-color: rgba(0, 126, 255, 0.04);
+ color: #333;
+}
+.Select-option.is-focused {
+ background-color: #ebf5ff;
+ /* Fallback color for IE 8 */
+ background-color: rgba(0, 126, 255, 0.08);
+ color: #333;
+}
+.Select-option.is-disabled {
+ color: #cccccc;
+ cursor: default;
+}
+.Select-noresults {
+ box-sizing: border-box;
+ color: #999999;
+ cursor: default;
+ display: block;
+ padding: 8px 10px;
+}
+.Select--multi .Select-input {
+ vertical-align: middle;
+ margin-left: 10px;
+ padding: 0;
+}
+.Select--multi.Select--rtl .Select-input {
+ margin-left: 0;
+ margin-right: 10px;
+}
+.Select--multi.has-value .Select-input {
+ margin-left: 5px;
+}
+.Select--multi .Select-value {
+ background-color: #ebf5ff;
+ /* Fallback color for IE 8 */
+ background-color: rgba(0, 126, 255, 0.08);
+ border-radius: 2px;
+ border: 1px solid #c2e0ff;
+ /* Fallback color for IE 8 */
+ border: 1px solid rgba(0, 126, 255, 0.24);
+ color: #007eff;
+ display: inline-block;
+ font-size: 0.9em;
+ line-height: 1.4;
+ margin-left: 5px;
+ margin-top: 5px;
+ vertical-align: top;
+}
+.Select--multi .Select-value-icon,
+.Select--multi .Select-value-label {
+ display: inline-block;
+ vertical-align: middle;
+}
+.Select--multi .Select-value-label {
+ border-bottom-right-radius: 2px;
+ border-top-right-radius: 2px;
+ cursor: default;
+ padding: 2px 5px;
+}
+.Select--multi a.Select-value-label {
+ color: #007eff;
+ cursor: pointer;
+ text-decoration: none;
+}
+.Select--multi a.Select-value-label:hover {
+ text-decoration: underline;
+}
+.Select--multi .Select-value-icon {
+ cursor: pointer;
+ border-bottom-left-radius: 2px;
+ border-top-left-radius: 2px;
+ border-right: 1px solid #c2e0ff;
+ /* Fallback color for IE 8 */
+ border-right: 1px solid rgba(0, 126, 255, 0.24);
+ padding: 1px 5px 3px;
+}
+.Select--multi .Select-value-icon:hover,
+.Select--multi .Select-value-icon:focus {
+ background-color: #d8eafd;
+ /* Fallback color for IE 8 */
+ background-color: rgba(0, 113, 230, 0.08);
+ color: #0071e6;
+}
+.Select--multi .Select-value-icon:active {
+ background-color: #c2e0ff;
+ /* Fallback color for IE 8 */
+ background-color: rgba(0, 126, 255, 0.24);
+}
+.Select--multi.Select--rtl .Select-value {
+ margin-left: 0;
+ margin-right: 5px;
+}
+.Select--multi.Select--rtl .Select-value-icon {
+ border-right: none;
+ border-left: 1px solid #c2e0ff;
+ /* Fallback color for IE 8 */
+ border-left: 1px solid rgba(0, 126, 255, 0.24);
+}
+.Select--multi.is-disabled .Select-value {
+ background-color: #fcfcfc;
+ border: 1px solid #e3e3e3;
+ color: #333;
+}
+.Select--multi.is-disabled .Select-value-icon {
+ cursor: not-allowed;
+ border-right: 1px solid #e3e3e3;
+}
+.Select--multi.is-disabled .Select-value-icon:hover,
+.Select--multi.is-disabled .Select-value-icon:focus,
+.Select--multi.is-disabled .Select-value-icon:active {
+ background-color: #fcfcfc;
+}
+@keyframes Select-animation-spin {
+ to {
+ transform: rotate(1turn);
+ }
+}
+@-webkit-keyframes Select-animation-spin {
+ to {
+ -webkit-transform: rotate(1turn);
+ }
+}
diff --git a/browser/tsconfig.json b/browser/tsconfig.json
new file mode 100644
index 00000000..7de1a1c1
--- /dev/null
+++ b/browser/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "compilerOptions": {
+ "sourceMap": true,
+ "noImplicitAny": false,
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "target": "es6",
+ "jsx": "react",
+ "esModuleInterop": true,
+ "allowJs": true,
+ "baseUrl": ".",
+ "paths": {
+ "jslib/*": [
+ "../jslib/src/*"
+ ]
+ }
+ }
+}
diff --git a/browser/webpack.config.js b/browser/webpack.config.js
new file mode 100644
index 00000000..d2f2829d
--- /dev/null
+++ b/browser/webpack.config.js
@@ -0,0 +1,76 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+const path = require('path');
+const webpack = require('webpack');
+const packageJson = require('./package.json');
+
+const ENV = process.env.NODE_ENV;
+const TARGET = process.env.TARGET;
+const isProduction = ENV === 'production';
+
+console.log(`Running webpack in ${ENV} mode`);
+
+const webUrl = isProduction
+ ? 'https://app.getdnote.com'
+ : 'http://127.0.0.1:3000';
+const apiUrl = isProduction
+ ? 'https://api.getdnote.com'
+ : 'http://127.0.0.1:5000';
+
+const plugins = [
+ new webpack.DefinePlugin({
+ __API_ENDPOINT__: JSON.stringify(apiUrl),
+ __WEB_URL__: JSON.stringify(webUrl),
+ __VERSION__: JSON.stringify(packageJson.version)
+ })
+];
+
+const moduleRules = [
+ {
+ test: /\.ts(x?)$/,
+ exclude: /node_modules|_test\.ts(x)$/,
+ loaders: ['ts-loader'],
+ exclude: path.resolve(__dirname, 'node_modules')
+ }
+];
+
+module.exports = env => {
+ return {
+ // run in production mode because of Content Security Policy error encountered
+ // when running a JavaScript bundle produced in a development mode
+ mode: 'production',
+ entry: { popup: ['./src/scripts/popup.tsx'] },
+ output: {
+ filename: '[name].js',
+ path: path.resolve(__dirname, 'dist', TARGET, 'scripts')
+ },
+ resolve: {
+ extensions: ['.ts', '.tsx', '.js'],
+ alias: {
+ jslib: path.join(__dirname, '../jslib/src')
+ },
+ modules: [path.resolve('node_modules')]
+ },
+ module: { rules: moduleRules },
+ plugins: plugins,
+ optimization: {
+ minimize: isProduction
+ }
+ };
+};
diff --git a/go.mod b/go.mod
index 48dfc85c..13001182 100644
--- a/go.mod
+++ b/go.mod
@@ -1,43 +1,41 @@
module github.com/dnote/dnote
-go 1.25
+go 1.13
require (
+ github.com/PuerkitoBio/goquery v1.6.0 // indirect
+ github.com/andybalholm/cascadia v1.2.0 // indirect
+ github.com/aymerick/douceur v0.2.0
github.com/dnote/actions v0.2.0
- github.com/fatih/color v1.18.0
- github.com/google/go-cmp v0.7.0
+ github.com/dnote/color v1.7.0
+ github.com/gobuffalo/packr/v2 v2.8.1
+ github.com/google/go-cmp v0.5.4
github.com/google/go-github v17.0.0+incompatible
- github.com/google/uuid v1.6.0
- github.com/gorilla/csrf v1.7.3
- github.com/gorilla/mux v1.8.1
- github.com/gorilla/schema v1.4.1
- github.com/mattn/go-sqlite3 v1.14.32
+ github.com/google/go-querystring v1.0.0 // indirect
+ github.com/google/uuid v1.1.2
+ github.com/gorilla/css v1.0.0 // indirect
+ github.com/gorilla/mux v1.8.0
+ github.com/jinzhu/gorm v1.9.16
+ github.com/joho/godotenv v1.3.0
+ github.com/karrick/godirwalk v1.16.1 // indirect
+ github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
+ github.com/lib/pq v1.8.0
+ github.com/mattn/go-colorable v0.1.8 // indirect
+ github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/pkg/errors v0.9.1
github.com/radovskyb/watcher v1.0.7
- github.com/sergi/go-diff v1.3.1
- github.com/spf13/cobra v1.10.1
- golang.org/x/crypto v0.45.0
- golang.org/x/time v0.13.0
+ github.com/robfig/cron v1.2.0
+ github.com/rubenv/sql-migrate v0.0.0-20200616145509-8d140a17f351
+ github.com/sergi/go-diff v1.1.0
+ github.com/sirupsen/logrus v1.7.0 // indirect
+ github.com/spf13/cobra v1.1.1
+ golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392
+ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
+ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // indirect
+ golang.org/x/sys v0.0.0-20201130072748-111129e158e2 // indirect
+ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
+ golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
+ gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/yaml.v2 v2.4.0
- gorm.io/driver/sqlite v1.6.0
- gorm.io/gorm v1.30.0
-)
-
-require (
- github.com/google/go-querystring v1.1.0 // indirect
- github.com/gorilla/securecookie v1.1.2 // indirect
- github.com/inconshreveable/mousetrap v1.1.0 // indirect
- github.com/jinzhu/inflection v1.0.0 // indirect
- github.com/jinzhu/now v1.1.5 // indirect
- github.com/kr/pretty v0.3.1 // indirect
- github.com/mattn/go-colorable v0.1.14 // indirect
- github.com/mattn/go-isatty v0.0.20 // indirect
- github.com/spf13/pflag v1.0.10 // indirect
- github.com/stretchr/testify v1.8.1 // indirect
- golang.org/x/sys v0.38.0 // indirect
- golang.org/x/term v0.37.0 // indirect
- golang.org/x/text v0.31.0 // indirect
- gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
- gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)
diff --git a/go.sum b/go.sum
index 8b3c653a..74ab29c7 100644
--- a/go.sum
+++ b/go.sum
@@ -1,103 +1,705 @@
-github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
-github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
+cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
+cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
+cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
+cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
+cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
+cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
+cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
+cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
+cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
+dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
+github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
+github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
+github.com/PuerkitoBio/goquery v1.5.1 h1:PSPBGne8NIUWw+/7vFBV+kG2J/5MOjbzc7154OaKCSE=
+github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
+github.com/PuerkitoBio/goquery v1.6.0 h1:j7taAbelrdcsOlGeMenZxc2AWXD5fieT1/znArdnx94=
+github.com/PuerkitoBio/goquery v1.6.0/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
+github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
+github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
+github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
+github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo=
+github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
+github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE=
+github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY=
+github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
+github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
+github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
+github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
+github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
+github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
+github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
+github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
+github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
+github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
+github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
+github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
+github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
+github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
+github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
+github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
+github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
+github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
+github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
+github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
+github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
+github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
+github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
+github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
+github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
+github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
+github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
+github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
+github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/denisenkom/go-mssqldb v0.0.0-20191001013358-cfbb681360f0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
+github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM=
+github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
+github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
+github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/dnote/actions v0.2.0 h1:P1ut2/QRKwfAzIIB374vN9A4IanU94C/payEocvngYo=
github.com/dnote/actions v0.2.0/go.mod h1:bBIassLhppVQdbC3iaE92SHBpM1HOVe+xZoAlj9ROxw=
-github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
-github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
-github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
-github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
+github.com/dnote/color v1.7.0 h1:8/QGLQKSU8/zcWQaHbMyC1hJRkKO/Uu9M89sH76ecHE=
+github.com/dnote/color v1.7.0/go.mod h1:75UcP/TH7CNvjQ5pwDumkUS3vkPdGggy7/3fT8MlxHM=
+github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
+github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
+github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
+github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
+github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
+github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
+github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
+github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
+github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
+github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
+github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
+github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
+github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
+github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
+github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
+github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
+github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
+github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
+github.com/gobuffalo/envy v1.7.1 h1:OQl5ys5MBea7OGCdvPbBJWRgnhC/fGona6QKfvFeau8=
+github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w=
+github.com/gobuffalo/logger v1.0.1 h1:ZEgyRGgAm4ZAhAO45YXMs5Fp+bzGLESFewzAVBMKuTg=
+github.com/gobuffalo/logger v1.0.1/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
+github.com/gobuffalo/logger v1.0.3 h1:YaXOTHNPCvkqqA7w05A4v0k2tCdpr+sgFlgINbQ6gqc=
+github.com/gobuffalo/logger v1.0.3/go.mod h1:SoeejUwldiS7ZsyCBphOGURmWdwUFXs0J7TCjEhjKxM=
+github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4=
+github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
+github.com/gobuffalo/packd v1.0.0 h1:6ERZvJHfe24rfFmA9OaoKBdC7+c9sydrytMg8SdFGBM=
+github.com/gobuffalo/packd v1.0.0/go.mod h1:6VTc4htmJRFB7u1m/4LeMTWjFoYrUiBkU9Fdec9hrhI=
+github.com/gobuffalo/packr/v2 v2.7.1 h1:n3CIW5T17T8v4GGK5sWXLVWJhCz7b5aNLSxW6gYim4o=
+github.com/gobuffalo/packr/v2 v2.7.1/go.mod h1:qYEvAazPaVxy7Y7KR0W8qYEE+RymX74kETFqjFoFlOc=
+github.com/gobuffalo/packr/v2 v2.8.0 h1:IULGd15bQL59ijXLxEvA5wlMxsmx/ZkQv9T282zNVIY=
+github.com/gobuffalo/packr/v2 v2.8.0/go.mod h1:PDk2k3vGevNE3SwVyVRgQCCXETC9SaONCNSXT1Q8M1g=
+github.com/gobuffalo/packr/v2 v2.8.1 h1:tkQpju6i3EtMXJ9uoF5GT6kB+LMTimDWD8Xvbz6zDVA=
+github.com/gobuffalo/packr/v2 v2.8.1/go.mod h1:c/PLlOuTU+p3SybaJATW3H6lX/iK7xEz5OeMf+NnJpg=
+github.com/godror/godror v0.13.3/go.mod h1:2ouUT4kdhUBk7TAkHWD4SN0CdI0pgEQbo8FVHhbSKWg=
+github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
+github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
+github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
+github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=
+github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
+github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
-github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
-github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
-github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
-github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
-github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
-github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/gorilla/csrf v1.7.3 h1:BHWt6FTLZAb2HtWT5KDBf6qgpZzvtbp9QWDRKZMXJC0=
-github.com/gorilla/csrf v1.7.3/go.mod h1:F1Fj3KG23WYHE6gozCmBAezKookxbIvUJT+121wTuLk=
-github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
-github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
-github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
-github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
-github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
-github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
-github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
-github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
+github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
+github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
+github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
+github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
+github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
+github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
+github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
+github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
+github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
+github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
+github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
+github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
+github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
+github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
+github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
+github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
+github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
+github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
+github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
+github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
+github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
+github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
+github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
+github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
+github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
+github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
+github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
+github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
+github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
+github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
+github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
+github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
+github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
+github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
+github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
+github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
+github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
+github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
+github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
+github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
+github.com/jinzhu/gorm v1.9.12 h1:Drgk1clyWT9t9ERbzHza6Mj/8FY/CqMyVzOiHviMo6Q=
+github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZT/Qs=
+github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
+github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
-github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
-github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
+github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
+github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
+github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
+github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
+github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
+github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
+github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
+github.com/karrick/godirwalk v1.15.3 h1:0a2pXOgtB16CqIqXTiT7+K9L73f74n/aNQUnH6Ortew=
+github.com/karrick/godirwalk v1.15.3/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
+github.com/karrick/godirwalk v1.15.6 h1:Yf2mmR8TJy+8Fa0SuQVto5SYap6IF7lNVX4Jdl8G1qA=
+github.com/karrick/godirwalk v1.15.6/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
+github.com/karrick/godirwalk v1.15.8/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
+github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw=
+github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
+github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
+github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
+github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
-github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
-github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
-github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
-github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
-github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
-github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
-github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
-github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
-github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
-github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
-github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
-github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
+github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
+github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.5.2 h1:yTSXVswvWUOQ3k1sd7vJfDrbSl8lKuscqFJRqjC0ifw=
+github.com/lib/pq v1.5.2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg=
+github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
+github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
+github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
+github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
+github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
+github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
+github.com/markbates/errx v1.1.0 h1:QDFeR+UP95dO12JgW+tgi2UVfo0V8YBHiUIOaeBPiEI=
+github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc=
+github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY=
+github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI=
+github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI=
+github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
+github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
+github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
+github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw=
+github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
+github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
+github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/mattn/go-oci8 v0.0.7/go.mod h1:wjDx6Xm9q7dFtHJvIlrI99JytznLw5wQ4R+9mNXJwGI=
+github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
+github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
+github.com/mattn/go-sqlite3 v1.12.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
+github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
+github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
+github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
+github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
+github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
+github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
+github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
+github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
+github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
+github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
+github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
+github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
+github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
+github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
+github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
+github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
+github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
+github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
+github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
+github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
+github.com/olekukonko/tablewriter v0.0.2/go.mod h1:rSAaSIOAGT9odnlyGlUfAJaoc5w2fSBUmeGDbRWPxyQ=
+github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
+github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
+github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
+github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
+github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
+github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
+github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
+github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
+github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
+github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
+github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
+github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
+github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
+github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
+github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
+github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
+github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
+github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
+github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
+github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
+github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
+github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
+github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
+github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
+github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
+github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
+github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/radovskyb/watcher v1.0.7 h1:AYePLih6dpmS32vlHfhCeli8127LzkIgwJGcwwe8tUE=
github.com/radovskyb/watcher v1.0.7/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg=
-github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
-github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
-github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
-github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
-github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
-github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
-github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
-github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
-github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
-github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
+github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
+github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
+github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
+github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
+github.com/rogpeppe/go-internal v1.4.0 h1:LUa41nrWTQNGhzdsZ5lTnkwbNjj6rXTdazA1cSdjkOY=
+github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
+github.com/rogpeppe/go-internal v1.5.2 h1:qLvObTrvO/XRCqmkKxUlOBc48bI3efyDuAZe25QiF0w=
+github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
+github.com/rubenv/sql-migrate v0.0.0-20200429072036-ae26b214fa43 h1:0i6uTtxUGc/jpK/CngM4T2S2NFnqYUUxH+lKDgBLw8U=
+github.com/rubenv/sql-migrate v0.0.0-20200429072036-ae26b214fa43/go.mod h1:DCgfY80j8GYL7MLEfvcpSFvjD0L5yZq/aZUJmhZklyg=
+github.com/rubenv/sql-migrate v0.0.0-20200616145509-8d140a17f351 h1:HXr/qUllAWv9riaI4zh2eXWKmCSDqVS/XH1MRHLKRwk=
+github.com/rubenv/sql-migrate v0.0.0-20200616145509-8d140a17f351/go.mod h1:DCgfY80j8GYL7MLEfvcpSFvjD0L5yZq/aZUJmhZklyg=
+github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
+github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
+github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
+github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
+github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
+github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
+github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
+github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
+github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
+github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
+github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
+github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
+github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
+github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
+github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
+github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
+github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
+github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
+github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
+github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
+github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
+github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
+github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
+github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
+github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
+github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
+github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4=
+github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
+github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
+github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
+github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
+github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
+github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
+github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
+github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
+github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
-github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
+github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
-github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
-github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
-github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
-golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
-golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
-golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
-golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
-golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
-golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
-golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
-golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
-golang.org/x/time v0.13.0 h1:eUlYslOIt32DgYD6utsuUeHs4d7AsEYLuIAdg7FlYgI=
-golang.org/x/time v0.13.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
+github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
+github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
+github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
+github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
+github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
+github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
+github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
+github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
+github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
+github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
+github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
+go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
+go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
+go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
+go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
+go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
+go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
+go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
+go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
+go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
+go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
+go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
+go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
+go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
+go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
+golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A=
+golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw=
+golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
+golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 h1:xYJJ3S178yv++9zXV/hnr29plCAGO9vAFG9dorqaFQc=
+golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
+golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
+golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
+golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
+golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
+golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
+golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
+golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY=
+golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
+golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
+golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o=
+golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200513112337-417ce2331b5c h1:kISX68E8gSkNYAFRFiDU8rl5RIn1sJYKYb/r2vMLDrU=
+golang.org/x/sys v0.0.0-20200513112337-417ce2331b5c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200821140526-fda516888d29 h1:mNuhGagCf3lDDm5C0376C/sxh6V7fy9WbdEu/YDNA04=
+golang.org/x/sys v0.0.0-20200821140526-fda516888d29/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201130072748-111129e158e2 h1:zXpk15uCEAaaJcTxBqQacweHUQ0HDhDOzupNGFs4imE=
+golang.org/x/sys v0.0.0-20201130072748-111129e158e2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=
+golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
+golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI=
+golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
+golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191004055002-72853e10c5a3/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200308013534-11ec41452d41 h1:9Di9iYgOt9ThCipBxChBVhgNipDoE5mxO84rQV7D0FE=
+golang.org/x/tools v0.0.0-20200308013534-11ec41452d41/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
+google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
+google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
+google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
+google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
+google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
+google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM=
+google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
+google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
+google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
+google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
+google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
+google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
-gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
+gopkg.in/gorp.v1 v1.7.2 h1:j3DWlAyGVv8whO7AcIWznQ2Yj7yJkn34B8s63GViAAw=
+gopkg.in/gorp.v1 v1.7.2/go.mod h1:Wo3h+DBQZIxATwftsglhdD/62zRFPhGhTiu5jUJmCaw=
+gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
+gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
+gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
+gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
-gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
-gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ=
-gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwyT8=
-gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs=
-gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
+honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
+rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
+sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
+sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
diff --git a/host/docker/Dockerfile b/host/docker/Dockerfile
index 71b3d1fa..e9c949af 100644
--- a/host/docker/Dockerfile
+++ b/host/docker/Dockerfile
@@ -1,40 +1,20 @@
-FROM busybox:glibc
+FROM alpine:latest
-ARG TARGETPLATFORM
-ARG version
+ARG tarballName
+RUN test -n "$tarballName"
-RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM is required" && exit 1)
-RUN test -n "$version" || (echo "version is required" && exit 1)
+# add dependency to execute a golang binary with dynamical linking.
+RUN apk add --no-cache \
+ libc6-compat
-WORKDIR /tmp/tarballs
+WORKDIR dnote
-# Copy all architecture tarballs
-COPY dnote_server_*.tar.gz ./
-
-# Select and extract the correct tarball based on target platform
-RUN case "$TARGETPLATFORM" in \
- "linux/amd64") ARCH="amd64" ;; \
- "linux/arm64") ARCH="arm64" ;; \
- "linux/arm/v7") ARCH="arm" ;; \
- "linux/386") ARCH="386" ;; \
- *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \
- esac && \
- TARBALL="dnote_server_${version}_linux_${ARCH}.tar.gz" && \
- echo "Extracting $TARBALL for $TARGETPLATFORM" && \
- mkdir -p /dnote && \
- tar -xvzf "$TARBALL" -C /dnote
-
-WORKDIR /dnote
-
-# Set default database path for all processes (main server, docker exec, shells)
-ENV DBPath=/data/dnote.db
+COPY "$tarballName" .
+RUN tar -xvzf "$tarballName"
COPY entrypoint.sh .
ENTRYPOINT ["./entrypoint.sh"]
CMD ./dnote-server start
-EXPOSE 3001
-
-HEALTHCHECK --interval=30s --timeout=3s --start-period=10s \
- CMD wget --no-verbose --tries=1 -O /dev/null http://localhost:3001/health || exit 1
+EXPOSE 3000
diff --git a/host/docker/README.md b/host/docker/README.md
new file mode 100644
index 00000000..95c5a469
--- /dev/null
+++ b/host/docker/README.md
@@ -0,0 +1,30 @@
+# Dnote Docker Image
+
+The official Dnote docker image.
+
+## Installing Dnote Server Using Docker
+
+1. Install [Docker](https://docs.docker.com/install/).
+2. Install Docker [Compose](https://docs.docker.com/compose/install/).
+3. Download the [docker-compose.yml](https://raw.githubusercontent.com/dnote/dnote/master/host/docker/docker-compose.yml) file by running:
+
+```
+curl https://raw.githubusercontent.com/dnote/dnote/master/host/docker/docker-compose.yml > docker-compose.yml
+```
+
+4. Run the following to download the images and run the containers
+
+```
+docker-compose pull
+docker-compose up -d
+```
+
+Visit http://localhost:3000 in your browser to see Dnote running.
+
+Please see [the installation guide](https://github.com/dnote/dnote/blob/master/SELF_HOSTING.md) for further configuration.
+
+## Supported platform
+
+Currently, the official Docker image for Dnote supports Linux running AMD64 CPU architecture.
+
+If you run ARM64, please install Dnote server by downloading a binary distribution by following [the guide](https://github.com/dnote/dnote/blob/master/SELF_HOSTING.md).
diff --git a/host/docker/build.sh b/host/docker/build.sh
index add55578..3ea9c143 100755
--- a/host/docker/build.sh
+++ b/host/docker/build.sh
@@ -1,85 +1,13 @@
#!/usr/bin/env bash
-# Build Docker image for local testing
-#
-# Usage:
-# # builds for host platform (auto-detected)
-# ./build.sh 1.0.0
-#
-# # builds arm64
-# ./build.sh 1.0.0 linux/arm64
-#
-# # builds multiple platforms
-# ./build.sh 1.0.0 "linux/amd64,linux/arm64,linux/arm/v7,linux/386"
set -eux
version=$1
-# Detect host platform if not specified
-if [ -z "${2:-}" ]; then
- HOST_ARCH=$(uname -m)
- case "$HOST_ARCH" in
- x86_64) platform="linux/amd64" ;;
- aarch64|arm64) platform="linux/arm64" ;;
- armv7l) platform="linux/arm/v7" ;;
- i386|i686) platform="linux/386" ;;
- *)
- echo "Warning: Unsupported architecture: $HOST_ARCH, defaulting to linux/amd64"
- platform="linux/amd64"
- ;;
- esac
- echo "Auto-detected platform: $platform"
-else
- platform=$2
-fi
-
dir=$(dirname "${BASH_SOURCE[0]}")
projectDir="$dir/../.."
+tarballName="dnote_server_${version}_linux_amd64.tar.gz"
-# Copy all Linux tarballs to Docker build context
-cp "$projectDir/build/server/dnote_server_${version}_linux_amd64.tar.gz" "$dir/"
-cp "$projectDir/build/server/dnote_server_${version}_linux_arm64.tar.gz" "$dir/"
-cp "$projectDir/build/server/dnote_server_${version}_linux_arm.tar.gz" "$dir/"
-cp "$projectDir/build/server/dnote_server_${version}_linux_386.tar.gz" "$dir/"
+# copy over the build artifact to the Docker build context
+cp "$projectDir/build/server/$tarballName" "$dir"
-# Count platforms (check for comma)
-if [[ "$platform" == *","* ]]; then
- echo "Building for multiple platforms: $platform"
-
- # Check if multiarch builder exists, create if not
- if ! docker buildx ls | grep -q "multiarch"; then
- echo "Creating multiarch builder for multi-platform builds..."
- docker buildx create --name multiarch --use
- docker buildx inspect --bootstrap
- else
- echo "Using existing multiarch builder"
- docker buildx use multiarch
- fi
- echo ""
-
- docker buildx build \
- --platform "$platform" \
- -t dnote/dnote:"$version" \
- -t dnote/dnote:latest \
- --build-arg version="$version" \
- "$dir"
-
- # Switch back to default builder
- docker buildx use default
-else
- echo "Building for single platform: $platform"
- echo "Image will be loaded to local Docker daemon"
-
- docker buildx build \
- --platform "$platform" \
- -t dnote/dnote:"$version" \
- -t dnote/dnote:latest \
- --build-arg version="$version" \
- --load \
- "$dir"
-fi
-
-echo ""
-echo "Build complete!"
-if [[ "$platform" != *","* ]]; then
- echo "Test with: docker run --rm dnote/dnote:$version ./dnote-server version"
-fi
+docker build --network=host -t dnote/dnote:"$version" --build-arg tarballName="$tarballName" .
diff --git a/host/docker/compose.yml b/host/docker/compose.yml
deleted file mode 100644
index 2869033a..00000000
--- a/host/docker/compose.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-services:
- dnote:
- image: dnote/dnote:latest
- container_name: dnote
- ports:
- - 3001:3001
- volumes:
- - ./dnote_data:/data
- restart: unless-stopped
diff --git a/host/docker/docker-compose.yml b/host/docker/docker-compose.yml
new file mode 100644
index 00000000..c47d71fe
--- /dev/null
+++ b/host/docker/docker-compose.yml
@@ -0,0 +1,35 @@
+version: "3"
+
+services:
+ postgres:
+ image: postgres:11-alpine
+ environment:
+ POSTGRES_USER: dnote
+ POSTGRES_PASSWORD: dnote
+ POSTGRES_DB: dnote
+ volumes:
+ - ./dnote_data:/var/lib/postgresql/data
+ restart: always
+
+ dnote:
+ image: dnote/dnote:latest
+ environment:
+ GO_ENV: PRODUCTION
+ DBSkipSSL: "true"
+ DBHost: postgres
+ DBPort: 5432
+ DBName: dnote
+ DBUser: dnote
+ DBPassword: dnote
+ WebURL: localhost:3000
+ OnPremise: "true"
+ SmtpHost:
+ SmtpPort:
+ SmtpUsername:
+ SmtpPassword:
+ DisableRegistration: "false"
+ ports:
+ - 3000:3000
+ depends_on:
+ - postgres
+ restart: always
diff --git a/host/docker/entrypoint.sh b/host/docker/entrypoint.sh
index 0fee185c..8fb62de9 100755
--- a/host/docker/entrypoint.sh
+++ b/host/docker/entrypoint.sh
@@ -1,6 +1,25 @@
#!/bin/sh
-# Set default DBPath to /data if not specified
-export DBPath=${DBPath:-/data/dnote.db}
+wait_for_db() {
+ HOST=${DBHost:-postgres}
+ PORT=${DBPort:-5432}
+ echo "Waiting for the database connection..."
+
+ attempts=0
+ max_attempts=10
+ while [ $attempts -lt $max_attempts ]; do
+ nc -z "${HOST}" "${PORT}" 2>/dev/null && break
+ echo "Waiting for db at ${HOST}:${PORT}..."
+ sleep 5
+ attempts=$((attempts+1))
+ done
+
+ if [ $attempts -eq $max_attempts ]; then
+ echo "Timed out while waiting for db at ${HOST}:${PORT}"
+ exit 1
+ fi
+}
+
+wait_for_db
exec "$@"
diff --git a/host/docker/release.sh b/host/docker/release.sh
new file mode 100755
index 00000000..4c2be4af
--- /dev/null
+++ b/host/docker/release.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+set -eux
+
+version=$1
+
+docker login
+
+# tag the release
+docker tag dnote/dnote:"$version" dnote/dnote:latest
+
+# publish
+docker push dnote/dnote:"$version"
+docker push dnote/dnote:latest
diff --git a/host/smoketest/.gitignore b/host/smoketest/.gitignore
new file mode 100644
index 00000000..463ebfd4
--- /dev/null
+++ b/host/smoketest/.gitignore
@@ -0,0 +1 @@
+/volume
diff --git a/host/smoketest/README.md b/host/smoketest/README.md
new file mode 100644
index 00000000..9025f533
--- /dev/null
+++ b/host/smoketest/README.md
@@ -0,0 +1 @@
+This directory contains a smoke test for running a self-hosted instance using a virtual machine.
diff --git a/host/smoketest/Vagrantfile b/host/smoketest/Vagrantfile
new file mode 100644
index 00000000..54b28fcf
--- /dev/null
+++ b/host/smoketest/Vagrantfile
@@ -0,0 +1,9 @@
+# -*- mode: ruby -*-
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "ubuntu/bionic64"
+ config.vm.synced_folder './volume', '/vagrant'
+ config.vm.network "forwarded_port", guest: 2300, host: 2300
+
+ config.vm.provision 'shell', path: './setup.sh', privileged: false
+end
diff --git a/host/smoketest/run_test.sh b/host/smoketest/run_test.sh
new file mode 100755
index 00000000..8137dfcd
--- /dev/null
+++ b/host/smoketest/run_test.sh
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+# run_test.sh builds a fresh server image, and mounts it on a fresh
+# virtual machine and runs a smoke test. If a tarball path is not provided,
+# this script builds a new version and uses it.
+set -ex
+
+# tarballPath is an absolute path to a release tarball containing the dnote server.
+tarballPath=$1
+
+dir=$(dirname "${BASH_SOURCE[0]}")
+projectDir="$dir/../.."
+
+# build
+if [ -z "$tarballPath" ]; then
+ pushd "$projectDir"
+ make version=integration_test build-server
+ popd
+ tarballPath="$projectDir/build/server/dnote_server_integration_test_linux_amd64.tar.gz"
+fi
+
+pushd "$dir"
+
+# start a virtual machine
+volume="$dir/volume"
+rm -rf "$volume"
+mkdir -p "$volume"
+cp "$tarballPath" "$volume"
+cp "$dir/testsuite.sh" "$volume"
+
+vagrant up
+
+# run tests
+set +e
+if ! vagrant ssh -c "/vagrant/testsuite.sh"; then
+ echo "Test failed. Please see the output."
+ vagrant halt
+ exit 1
+fi
+set -e
+
+vagrant halt
+popd
diff --git a/host/smoketest/setup.sh b/host/smoketest/setup.sh
new file mode 100755
index 00000000..3fb44f95
--- /dev/null
+++ b/host/smoketest/setup.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+set -ex
+
+sudo apt-get install wget ca-certificates
+wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
+
+sudo apt-get update
+sudo apt-get install -y postgresql-11
+
+# set up database
+sudo -u postgres createdb dnote
+# allow connection from host and allow to connect without password
+sudo sed -i "/port*/a listen_addresses = '*'" /etc/postgresql/11/main/postgresql.conf
+sudo sed -i 's/host.*all.*.all.*md5/# &/' /etc/postgresql/11/main/pg_hba.conf
+sudo sed -i "$ a host all all all trust" /etc/postgresql/11/main/pg_hba.conf
+sudo service postgresql restart
diff --git a/host/smoketest/testsuite.sh b/host/smoketest/testsuite.sh
new file mode 100755
index 00000000..3e8eab4d
--- /dev/null
+++ b/host/smoketest/testsuite.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+# testsuite.sh runs the smoke tests for a self-hosted instance.
+# It is meant to be run inside a virtual machine which has been
+# set up by an entry script.
+set -eu
+
+echo 'Running a smoke test'
+
+sudo -u postgres dropdb dnote
+sudo -u postgres createdb dnote
+
+cd /vagrant
+
+tar -xvf dnote_server_integration_test_linux_amd64.tar.gz
+
+GO_ENV=PRODUCTION \
+ DBHost=localhost \
+ DBPort=5432 \
+ DBName=dnote \
+ DBUser=postgres \
+ DBPassword="" \
+ WebURL=localhost:3000 \
+ ./dnote-server -port 2300 start & sleep 3
+
+assert_http_status() {
+ url=$1
+ expected=$2
+
+ echo "======== [TEST CASE] asserting response status code for $url ========"
+
+ got=$(curl --write-out %"{http_code}" --silent --output /dev/null "$url")
+
+ if [ "$got" != "$expected" ]; then
+ echo "======== ASSERTION FAILED ========"
+ echo "status code for $url: expected: $expected got: $got"
+ echo "=================================="
+ exit 1
+ fi
+}
+
+assert_http_status http://localhost:2300 "200"
+assert_http_status http://localhost:2300/api/health "200"
+
+echo "======== [SUCCESS] TEST PASSED! ========"
diff --git a/install.sh b/install.sh
index bb09bd8f..6537232e 100755
--- a/install.sh
+++ b/install.sh
@@ -68,14 +68,9 @@ uname_os() {
uname_arch() {
arch=$(uname -m)
- case $arch in
+ case $arch in
x86_64) arch="amd64" ;;
aarch64) arch="arm64" ;;
- arm64) arch="arm64" ;;
- armv7l) arch="arm" ;;
- armv6l) arch="arm" ;;
- armv5l) arch="arm" ;;
- arm) arch="arm" ;;
x86) arch="386" ;;
i686) arch="386" ;;
i386) arch="386" ;;
@@ -91,17 +86,9 @@ check_platform() {
found=1
case "$platform" in
- # Linux
+ darwin/amd64) found=0;;
linux/amd64) found=0 ;;
linux/arm64) found=0 ;;
- linux/arm) found=0 ;;
- # macOS
- darwin/amd64) found=0 ;;
- darwin/arm64) found=0 ;;
- # Windows
- windows/amd64) found=0 ;;
- # FreeBSD
- freebsd/amd64) found=0 ;;
esac
return $found
diff --git a/jslib/.gitignore b/jslib/.gitignore
new file mode 100644
index 00000000..521a8db6
--- /dev/null
+++ b/jslib/.gitignore
@@ -0,0 +1,3 @@
+/dist
+/node_modules
+/coverage
diff --git a/jslib/README.md b/jslib/README.md
new file mode 100644
index 00000000..5e0afb2f
--- /dev/null
+++ b/jslib/README.md
@@ -0,0 +1,3 @@
+# jslib
+
+Code shared between Dnote JavaScript projects.
diff --git a/jslib/jest.config.js b/jslib/jest.config.js
new file mode 100644
index 00000000..99ab01ad
--- /dev/null
+++ b/jslib/jest.config.js
@@ -0,0 +1,4 @@
+module.exports = {
+ preset: 'ts-jest',
+ collectCoverageFrom: ['./src/**/*.ts']
+};
diff --git a/jslib/package-lock.json b/jslib/package-lock.json
new file mode 100644
index 00000000..045f649e
--- /dev/null
+++ b/jslib/package-lock.json
@@ -0,0 +1,4899 @@
+{
+ "name": "jslib",
+ "version": "0.1.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.5.5",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
+ "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.0.0"
+ }
+ },
+ "@babel/core": {
+ "version": "7.7.2",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.7.2.tgz",
+ "integrity": "sha512-eeD7VEZKfhK1KUXGiyPFettgF3m513f8FoBSWiQ1xTvl1RAopLs42Wp9+Ze911I6H0N9lNqJMDgoZT7gHsipeQ==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.5.5",
+ "@babel/generator": "^7.7.2",
+ "@babel/helpers": "^7.7.0",
+ "@babel/parser": "^7.7.2",
+ "@babel/template": "^7.7.0",
+ "@babel/traverse": "^7.7.2",
+ "@babel/types": "^7.7.2",
+ "convert-source-map": "^1.7.0",
+ "debug": "^4.1.0",
+ "json5": "^2.1.0",
+ "lodash": "^4.17.13",
+ "resolve": "^1.3.2",
+ "semver": "^5.4.1",
+ "source-map": "^0.5.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
+ "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
+ "dev": true
+ }
+ }
+ },
+ "@babel/generator": {
+ "version": "7.7.2",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.2.tgz",
+ "integrity": "sha512-WthSArvAjYLz4TcbKOi88me+KmDJdKSlfwwN8CnUYn9jBkzhq0ZEPuBfkAWIvjJ3AdEV1Cf/+eSQTnp3IDJKlQ==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.2",
+ "jsesc": "^2.5.1",
+ "lodash": "^4.17.13",
+ "source-map": "^0.5.0"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
+ "dev": true
+ }
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.0.tgz",
+ "integrity": "sha512-tDsJgMUAP00Ugv8O2aGEua5I2apkaQO7lBGUq1ocwN3G23JE5Dcq0uh3GvFTChPa4b40AWiAsLvCZOA2rdnQ7Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.7.0",
+ "@babel/template": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.0.tgz",
+ "integrity": "sha512-tLdojOTz4vWcEnHWHCuPN5P85JLZWbm5Fx5ZsMEMPhF3Uoe3O7awrbM2nQ04bDOUToH/2tH/ezKEOR8zEYzqyw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-plugin-utils": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz",
+ "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==",
+ "dev": true
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.0.tgz",
+ "integrity": "sha512-HgYSI8rH08neWlAH3CcdkFg9qX9YsZysZI5GD8LjhQib/mM0jGOZOVkoUiiV2Hu978fRtjtsGsW6w0pKHUWtqA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helpers": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.7.0.tgz",
+ "integrity": "sha512-VnNwL4YOhbejHb7x/b5F39Zdg5vIQpUUNzJwx0ww1EcVRt41bbGRZWhAURrfY32T5zTT3qwNOQFWpn+P0i0a2g==",
+ "dev": true,
+ "requires": {
+ "@babel/template": "^7.7.0",
+ "@babel/traverse": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/highlight": {
+ "version": "7.5.0",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz",
+ "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.0.0",
+ "esutils": "^2.0.2",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.7.3",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.3.tgz",
+ "integrity": "sha512-bqv+iCo9i+uLVbI0ILzKkvMorqxouI+GbV13ivcARXn9NNEabi2IEz912IgNpT/60BNXac5dgcfjb94NjsF33A==",
+ "dev": true
+ },
+ "@babel/plugin-syntax-object-rest-spread": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz",
+ "integrity": "sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/runtime": {
+ "version": "7.6.2",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.2.tgz",
+ "integrity": "sha512-EXxN64agfUqqIGeEjI5dL5z0Sw0ZwWo1mLTi4mQowCZ42O59b7DRpZAnTC6OqdF28wMBMFKNb/4uFGrVaigSpg==",
+ "requires": {
+ "regenerator-runtime": "^0.13.2"
+ }
+ },
+ "@babel/template": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.0.tgz",
+ "integrity": "sha512-OKcwSYOW1mhWbnTBgQY5lvg1Fxg+VyfQGjcBduZFljfc044J5iDlnDSfhQ867O17XHiSCxYHUxHg2b7ryitbUQ==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "@babel/parser": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.7.2",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.2.tgz",
+ "integrity": "sha512-TM01cXib2+rgIZrGJOLaHV/iZUAxf4A0dt5auY6KNZ+cm6aschuJGqKJM3ROTt3raPUdIDk9siAufIFEleRwtw==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.5.5",
+ "@babel/generator": "^7.7.2",
+ "@babel/helper-function-name": "^7.7.0",
+ "@babel/helper-split-export-declaration": "^7.7.0",
+ "@babel/parser": "^7.7.2",
+ "@babel/types": "^7.7.2",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.13"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
+ "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/types": {
+ "version": "7.7.2",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.2.tgz",
+ "integrity": "sha512-YTf6PXoh3+eZgRCBzzP25Bugd2ngmpQVrk7kXX0i5N9BO7TFBtIgZYs7WtxtOGs8e6A4ZI7ECkbBCEHeXocvOA==",
+ "dev": true,
+ "requires": {
+ "esutils": "^2.0.2",
+ "lodash": "^4.17.13",
+ "to-fast-properties": "^2.0.0"
+ }
+ },
+ "@cnakazawa/watch": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.3.tgz",
+ "integrity": "sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA==",
+ "dev": true,
+ "requires": {
+ "exec-sh": "^0.3.2",
+ "minimist": "^1.2.0"
+ }
+ },
+ "@jest/console": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz",
+ "integrity": "sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ==",
+ "dev": true,
+ "requires": {
+ "@jest/source-map": "^24.9.0",
+ "chalk": "^2.0.1",
+ "slash": "^2.0.0"
+ }
+ },
+ "@jest/core": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/core/-/core-24.9.0.tgz",
+ "integrity": "sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A==",
+ "dev": true,
+ "requires": {
+ "@jest/console": "^24.7.1",
+ "@jest/reporters": "^24.9.0",
+ "@jest/test-result": "^24.9.0",
+ "@jest/transform": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "ansi-escapes": "^3.0.0",
+ "chalk": "^2.0.1",
+ "exit": "^0.1.2",
+ "graceful-fs": "^4.1.15",
+ "jest-changed-files": "^24.9.0",
+ "jest-config": "^24.9.0",
+ "jest-haste-map": "^24.9.0",
+ "jest-message-util": "^24.9.0",
+ "jest-regex-util": "^24.3.0",
+ "jest-resolve": "^24.9.0",
+ "jest-resolve-dependencies": "^24.9.0",
+ "jest-runner": "^24.9.0",
+ "jest-runtime": "^24.9.0",
+ "jest-snapshot": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "jest-validate": "^24.9.0",
+ "jest-watcher": "^24.9.0",
+ "micromatch": "^3.1.10",
+ "p-each-series": "^1.0.0",
+ "realpath-native": "^1.1.0",
+ "rimraf": "^2.5.4",
+ "slash": "^2.0.0",
+ "strip-ansi": "^5.0.0"
+ }
+ },
+ "@jest/environment": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.9.0.tgz",
+ "integrity": "sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ==",
+ "dev": true,
+ "requires": {
+ "@jest/fake-timers": "^24.9.0",
+ "@jest/transform": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "jest-mock": "^24.9.0"
+ }
+ },
+ "@jest/fake-timers": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-24.9.0.tgz",
+ "integrity": "sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0",
+ "jest-message-util": "^24.9.0",
+ "jest-mock": "^24.9.0"
+ }
+ },
+ "@jest/reporters": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-24.9.0.tgz",
+ "integrity": "sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw==",
+ "dev": true,
+ "requires": {
+ "@jest/environment": "^24.9.0",
+ "@jest/test-result": "^24.9.0",
+ "@jest/transform": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "chalk": "^2.0.1",
+ "exit": "^0.1.2",
+ "glob": "^7.1.2",
+ "istanbul-lib-coverage": "^2.0.2",
+ "istanbul-lib-instrument": "^3.0.1",
+ "istanbul-lib-report": "^2.0.4",
+ "istanbul-lib-source-maps": "^3.0.1",
+ "istanbul-reports": "^2.2.6",
+ "jest-haste-map": "^24.9.0",
+ "jest-resolve": "^24.9.0",
+ "jest-runtime": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "jest-worker": "^24.6.0",
+ "node-notifier": "^5.4.2",
+ "slash": "^2.0.0",
+ "source-map": "^0.6.0",
+ "string-length": "^2.0.0"
+ }
+ },
+ "@jest/source-map": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-24.9.0.tgz",
+ "integrity": "sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg==",
+ "dev": true,
+ "requires": {
+ "callsites": "^3.0.0",
+ "graceful-fs": "^4.1.15",
+ "source-map": "^0.6.0"
+ }
+ },
+ "@jest/test-result": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.9.0.tgz",
+ "integrity": "sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA==",
+ "dev": true,
+ "requires": {
+ "@jest/console": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "@types/istanbul-lib-coverage": "^2.0.0"
+ }
+ },
+ "@jest/test-sequencer": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz",
+ "integrity": "sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A==",
+ "dev": true,
+ "requires": {
+ "@jest/test-result": "^24.9.0",
+ "jest-haste-map": "^24.9.0",
+ "jest-runner": "^24.9.0",
+ "jest-runtime": "^24.9.0"
+ }
+ },
+ "@jest/transform": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-24.9.0.tgz",
+ "integrity": "sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ==",
+ "dev": true,
+ "requires": {
+ "@babel/core": "^7.1.0",
+ "@jest/types": "^24.9.0",
+ "babel-plugin-istanbul": "^5.1.0",
+ "chalk": "^2.0.1",
+ "convert-source-map": "^1.4.0",
+ "fast-json-stable-stringify": "^2.0.0",
+ "graceful-fs": "^4.1.15",
+ "jest-haste-map": "^24.9.0",
+ "jest-regex-util": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "micromatch": "^3.1.10",
+ "pirates": "^4.0.1",
+ "realpath-native": "^1.1.0",
+ "slash": "^2.0.0",
+ "source-map": "^0.6.1",
+ "write-file-atomic": "2.4.1"
+ }
+ },
+ "@jest/types": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz",
+ "integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==",
+ "dev": true,
+ "requires": {
+ "@types/istanbul-lib-coverage": "^2.0.0",
+ "@types/istanbul-reports": "^1.1.1",
+ "@types/yargs": "^13.0.0"
+ }
+ },
+ "@types/babel__core": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.3.tgz",
+ "integrity": "sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA==",
+ "dev": true,
+ "requires": {
+ "@babel/parser": "^7.1.0",
+ "@babel/types": "^7.0.0",
+ "@types/babel__generator": "*",
+ "@types/babel__template": "*",
+ "@types/babel__traverse": "*"
+ }
+ },
+ "@types/babel__generator": {
+ "version": "7.6.0",
+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.0.tgz",
+ "integrity": "sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "@types/babel__template": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.2.tgz",
+ "integrity": "sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg==",
+ "dev": true,
+ "requires": {
+ "@babel/parser": "^7.1.0",
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "@types/babel__traverse": {
+ "version": "7.0.7",
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.7.tgz",
+ "integrity": "sha512-CeBpmX1J8kWLcDEnI3Cl2Eo6RfbGvzUctA+CjZUhOKDFbLfcr7fc4usEqLNWetrlJd7RhAkyYe2czXop4fICpw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.3.0"
+ }
+ },
+ "@types/history": {
+ "version": "4.7.8",
+ "resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.8.tgz",
+ "integrity": "sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA=="
+ },
+ "@types/istanbul-lib-coverage": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz",
+ "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==",
+ "dev": true
+ },
+ "@types/istanbul-lib-report": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz",
+ "integrity": "sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg==",
+ "dev": true,
+ "requires": {
+ "@types/istanbul-lib-coverage": "*"
+ }
+ },
+ "@types/istanbul-reports": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz",
+ "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==",
+ "dev": true,
+ "requires": {
+ "@types/istanbul-lib-coverage": "*",
+ "@types/istanbul-lib-report": "*"
+ }
+ },
+ "@types/jest": {
+ "version": "24.9.1",
+ "resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.9.1.tgz",
+ "integrity": "sha512-Fb38HkXSVA4L8fGKEZ6le5bB8r6MRWlOCZbVuWZcmOMSCd2wCYOwN1ibj8daIoV9naq7aaOZjrLCoCMptKU/4Q==",
+ "dev": true,
+ "requires": {
+ "jest-diff": "^24.3.0"
+ }
+ },
+ "@types/stack-utils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
+ "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==",
+ "dev": true
+ },
+ "@types/yargs": {
+ "version": "13.0.3",
+ "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.3.tgz",
+ "integrity": "sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ==",
+ "dev": true,
+ "requires": {
+ "@types/yargs-parser": "*"
+ }
+ },
+ "@types/yargs-parser": {
+ "version": "13.1.0",
+ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-13.1.0.tgz",
+ "integrity": "sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==",
+ "dev": true
+ },
+ "abab": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.2.tgz",
+ "integrity": "sha512-2scffjvioEmNz0OyDSLGWDfKCVwaKc6l9Pm9kOIREU13ClXZvHpg/nRL5xyjSSSLhOnXqft2HpsAzNEEA8cFFg==",
+ "dev": true
+ },
+ "acorn": {
+ "version": "5.7.4",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz",
+ "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==",
+ "dev": true
+ },
+ "acorn-globals": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz",
+ "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==",
+ "dev": true,
+ "requires": {
+ "acorn": "^6.0.1",
+ "acorn-walk": "^6.0.1"
+ },
+ "dependencies": {
+ "acorn": {
+ "version": "6.4.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
+ "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==",
+ "dev": true
+ }
+ }
+ },
+ "acorn-walk": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz",
+ "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==",
+ "dev": true
+ },
+ "ajv": {
+ "version": "6.10.2",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
+ "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^2.0.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ansi-escapes": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
+ "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
+ "dev": true
+ },
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "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,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "anymatch": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz",
+ "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==",
+ "dev": true,
+ "requires": {
+ "micromatch": "^3.1.4",
+ "normalize-path": "^2.1.1"
+ }
+ },
+ "arr-diff": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
+ "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=",
+ "dev": true
+ },
+ "arr-flatten": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
+ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
+ "dev": true
+ },
+ "arr-union": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz",
+ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
+ "dev": true
+ },
+ "array-equal": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
+ "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=",
+ "dev": true
+ },
+ "array-unique": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
+ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
+ "dev": true
+ },
+ "asn1": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
+ "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
+ "dev": true,
+ "requires": {
+ "safer-buffer": "~2.1.0"
+ }
+ },
+ "assert-plus": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
+ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
+ "dev": true
+ },
+ "assign-symbols": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
+ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
+ "dev": true
+ },
+ "astral-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
+ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
+ "dev": true
+ },
+ "async-limiter": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
+ "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
+ "dev": true
+ },
+ "asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
+ "dev": true
+ },
+ "atob": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
+ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
+ "dev": true
+ },
+ "aws-sign2": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
+ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
+ "dev": true
+ },
+ "aws4": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
+ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==",
+ "dev": true
+ },
+ "babel-jest": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.9.0.tgz",
+ "integrity": "sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw==",
+ "dev": true,
+ "requires": {
+ "@jest/transform": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "@types/babel__core": "^7.1.0",
+ "babel-plugin-istanbul": "^5.1.0",
+ "babel-preset-jest": "^24.9.0",
+ "chalk": "^2.4.2",
+ "slash": "^2.0.0"
+ }
+ },
+ "babel-plugin-istanbul": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz",
+ "integrity": "sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "find-up": "^3.0.0",
+ "istanbul-lib-instrument": "^3.3.0",
+ "test-exclude": "^5.2.3"
+ }
+ },
+ "babel-plugin-jest-hoist": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz",
+ "integrity": "sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw==",
+ "dev": true,
+ "requires": {
+ "@types/babel__traverse": "^7.0.6"
+ }
+ },
+ "babel-preset-jest": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz",
+ "integrity": "sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg==",
+ "dev": true,
+ "requires": {
+ "@babel/plugin-syntax-object-rest-spread": "^7.0.0",
+ "babel-plugin-jest-hoist": "^24.9.0"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "dev": true
+ },
+ "base": {
+ "version": "0.11.2",
+ "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz",
+ "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==",
+ "dev": true,
+ "requires": {
+ "cache-base": "^1.0.1",
+ "class-utils": "^0.3.5",
+ "component-emitter": "^1.2.1",
+ "define-property": "^1.0.0",
+ "isobject": "^3.0.1",
+ "mixin-deep": "^1.2.0",
+ "pascalcase": "^0.1.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "bcrypt-pbkdf": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
+ "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
+ "dev": true,
+ "requires": {
+ "tweetnacl": "^0.14.3"
+ }
+ },
+ "bindings": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "file-uri-to-path": "1.0.0"
+ }
+ },
+ "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"
+ }
+ },
+ "braces": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
+ "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
+ "dev": true,
+ "requires": {
+ "arr-flatten": "^1.1.0",
+ "array-unique": "^0.3.2",
+ "extend-shallow": "^2.0.1",
+ "fill-range": "^4.0.0",
+ "isobject": "^3.0.1",
+ "repeat-element": "^1.1.2",
+ "snapdragon": "^0.8.1",
+ "snapdragon-node": "^2.0.1",
+ "split-string": "^3.0.2",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "browser-process-hrtime": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz",
+ "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==",
+ "dev": true
+ },
+ "browser-resolve": {
+ "version": "1.11.3",
+ "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz",
+ "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==",
+ "dev": true,
+ "requires": {
+ "resolve": "1.1.7"
+ },
+ "dependencies": {
+ "resolve": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
+ "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
+ "dev": true
+ }
+ }
+ },
+ "bs-logger": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz",
+ "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==",
+ "dev": true,
+ "requires": {
+ "fast-json-stable-stringify": "2.x"
+ }
+ },
+ "bser": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz",
+ "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==",
+ "dev": true,
+ "requires": {
+ "node-int64": "^0.4.0"
+ }
+ },
+ "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
+ },
+ "cache-base": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
+ "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==",
+ "dev": true,
+ "requires": {
+ "collection-visit": "^1.0.0",
+ "component-emitter": "^1.2.1",
+ "get-value": "^2.0.6",
+ "has-value": "^1.0.0",
+ "isobject": "^3.0.1",
+ "set-value": "^2.0.0",
+ "to-object-path": "^0.3.0",
+ "union-value": "^1.0.0",
+ "unset-value": "^1.0.0"
+ }
+ },
+ "callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "dev": true
+ },
+ "camelcase": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "dev": true
+ },
+ "capture-exit": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz",
+ "integrity": "sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==",
+ "dev": true,
+ "requires": {
+ "rsvp": "^4.8.4"
+ }
+ },
+ "caseless": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
+ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
+ "dev": true
+ },
+ "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,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "ci-info": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
+ "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==",
+ "dev": true
+ },
+ "class-utils": {
+ "version": "0.3.6",
+ "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
+ "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==",
+ "dev": true,
+ "requires": {
+ "arr-union": "^3.1.0",
+ "define-property": "^0.2.5",
+ "isobject": "^3.0.0",
+ "static-extend": "^0.1.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ }
+ }
+ },
+ "cliui": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+ "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^3.1.0",
+ "strip-ansi": "^5.2.0",
+ "wrap-ansi": "^5.1.0"
+ }
+ },
+ "co": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
+ "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
+ "dev": true
+ },
+ "collection-visit": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
+ "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=",
+ "dev": true,
+ "requires": {
+ "map-visit": "^1.0.0",
+ "object-visit": "^1.0.0"
+ }
+ },
+ "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,
+ "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
+ },
+ "combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dev": true,
+ "requires": {
+ "delayed-stream": "~1.0.0"
+ }
+ },
+ "component-emitter": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
+ "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==",
+ "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
+ },
+ "convert-source-map": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
+ "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.1.1"
+ }
+ },
+ "copy-descriptor": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
+ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
+ "dev": true
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
+ "dev": true
+ },
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "cssom": {
+ "version": "0.3.8",
+ "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz",
+ "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==",
+ "dev": true
+ },
+ "cssstyle": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz",
+ "integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==",
+ "dev": true,
+ "requires": {
+ "cssom": "0.3.x"
+ }
+ },
+ "dashdash": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
+ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "^1.0.0"
+ }
+ },
+ "data-urls": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz",
+ "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==",
+ "dev": true,
+ "requires": {
+ "abab": "^2.0.0",
+ "whatwg-mimetype": "^2.2.0",
+ "whatwg-url": "^7.0.0"
+ },
+ "dependencies": {
+ "whatwg-url": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz",
+ "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==",
+ "dev": true,
+ "requires": {
+ "lodash.sortby": "^4.7.0",
+ "tr46": "^1.0.1",
+ "webidl-conversions": "^4.0.2"
+ }
+ }
+ }
+ },
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
+ "dev": true
+ },
+ "decode-uri-component": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
+ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
+ "dev": true
+ },
+ "deep-is": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
+ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
+ "dev": true
+ },
+ "define-properties": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
+ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
+ "dev": true,
+ "requires": {
+ "object-keys": "^1.0.12"
+ }
+ },
+ "define-property": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
+ "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^1.0.2",
+ "isobject": "^3.0.1"
+ },
+ "dependencies": {
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
+ "dev": true
+ },
+ "detect-newline": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz",
+ "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=",
+ "dev": true
+ },
+ "diff-sequences": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz",
+ "integrity": "sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==",
+ "dev": true
+ },
+ "domexception": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz",
+ "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==",
+ "dev": true,
+ "requires": {
+ "webidl-conversions": "^4.0.2"
+ }
+ },
+ "ecc-jsbn": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
+ "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
+ "dev": true,
+ "requires": {
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.1.0"
+ }
+ },
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "dev": true,
+ "requires": {
+ "once": "^1.4.0"
+ }
+ },
+ "error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "es-abstract": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.0.tgz",
+ "integrity": "sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg==",
+ "dev": true,
+ "requires": {
+ "es-to-primitive": "^1.2.0",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.0",
+ "is-callable": "^1.1.4",
+ "is-regex": "^1.0.4",
+ "object-inspect": "^1.6.0",
+ "object-keys": "^1.1.1",
+ "string.prototype.trimleft": "^2.1.0",
+ "string.prototype.trimright": "^2.1.0"
+ }
+ },
+ "es-to-primitive": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
+ "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
+ "dev": true,
+ "requires": {
+ "is-callable": "^1.1.4",
+ "is-date-object": "^1.0.1",
+ "is-symbol": "^1.0.2"
+ }
+ },
+ "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
+ },
+ "escodegen": {
+ "version": "1.12.0",
+ "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.12.0.tgz",
+ "integrity": "sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg==",
+ "dev": true,
+ "requires": {
+ "esprima": "^3.1.3",
+ "estraverse": "^4.2.0",
+ "esutils": "^2.0.2",
+ "optionator": "^0.8.1",
+ "source-map": "~0.6.1"
+ }
+ },
+ "esprima": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz",
+ "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=",
+ "dev": true
+ },
+ "estraverse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
+ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+ "dev": true
+ },
+ "esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true
+ },
+ "exec-sh": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.4.tgz",
+ "integrity": "sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A==",
+ "dev": true
+ },
+ "execa": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
+ "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
+ "dev": true,
+ "requires": {
+ "cross-spawn": "^6.0.0",
+ "get-stream": "^4.0.0",
+ "is-stream": "^1.1.0",
+ "npm-run-path": "^2.0.0",
+ "p-finally": "^1.0.0",
+ "signal-exit": "^3.0.0",
+ "strip-eof": "^1.0.0"
+ }
+ },
+ "exit": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
+ "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=",
+ "dev": true
+ },
+ "expand-brackets": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
+ "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=",
+ "dev": true,
+ "requires": {
+ "debug": "^2.3.3",
+ "define-property": "^0.2.5",
+ "extend-shallow": "^2.0.1",
+ "posix-character-classes": "^0.1.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "expect": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/expect/-/expect-24.9.0.tgz",
+ "integrity": "sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0",
+ "ansi-styles": "^3.2.0",
+ "jest-get-type": "^24.9.0",
+ "jest-matcher-utils": "^24.9.0",
+ "jest-message-util": "^24.9.0",
+ "jest-regex-util": "^24.9.0"
+ }
+ },
+ "extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+ "dev": true
+ },
+ "extend-shallow": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
+ "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=",
+ "dev": true,
+ "requires": {
+ "assign-symbols": "^1.0.0",
+ "is-extendable": "^1.0.1"
+ },
+ "dependencies": {
+ "is-extendable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
+ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
+ "dev": true,
+ "requires": {
+ "is-plain-object": "^2.0.4"
+ }
+ }
+ }
+ },
+ "extglob": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
+ "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
+ "dev": true,
+ "requires": {
+ "array-unique": "^0.3.2",
+ "define-property": "^1.0.0",
+ "expand-brackets": "^2.1.4",
+ "extend-shallow": "^2.0.1",
+ "fragment-cache": "^0.2.1",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "extsprintf": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
+ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
+ "dev": true
+ },
+ "fast-deep-equal": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
+ "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
+ "dev": true
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
+ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
+ "dev": true
+ },
+ "fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
+ "dev": true
+ },
+ "fb-watchman": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz",
+ "integrity": "sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg=",
+ "dev": true,
+ "requires": {
+ "bser": "^2.0.0"
+ }
+ },
+ "file-uri-to-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+ "dev": true,
+ "optional": true
+ },
+ "fill-range": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
+ "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
+ "dev": true,
+ "requires": {
+ "extend-shallow": "^2.0.1",
+ "is-number": "^3.0.0",
+ "repeat-string": "^1.6.1",
+ "to-regex-range": "^2.1.0"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "find-up": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
+ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^3.0.0"
+ }
+ },
+ "for-in": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
+ "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=",
+ "dev": true
+ },
+ "forever-agent": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
+ "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
+ "dev": true
+ },
+ "form-data": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
+ "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
+ "dev": true,
+ "requires": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.6",
+ "mime-types": "^2.1.12"
+ }
+ },
+ "fragment-cache": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
+ "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=",
+ "dev": true,
+ "requires": {
+ "map-cache": "^0.2.2"
+ }
+ },
+ "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": "1.2.12",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz",
+ "integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "bindings": "^1.5.0",
+ "nan": "^2.12.1",
+ "node-pre-gyp": "*"
+ },
+ "dependencies": {
+ "abbrev": {
+ "version": "1.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "aproba": {
+ "version": "1.2.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "are-we-there-yet": {
+ "version": "1.1.5",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "delegates": "^1.0.0",
+ "readable-stream": "^2.0.6"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "chownr": {
+ "version": "1.1.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "console-control-strings": {
+ "version": "1.1.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "debug": {
+ "version": "3.2.6",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "deep-extend": {
+ "version": "0.6.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "delegates": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "detect-libc": {
+ "version": "1.0.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "fs-minipass": {
+ "version": "1.2.7",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "minipass": "^2.6.0"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "gauge": {
+ "version": "2.7.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "aproba": "^1.0.3",
+ "console-control-strings": "^1.0.0",
+ "has-unicode": "^2.0.0",
+ "object-assign": "^4.1.0",
+ "signal-exit": "^3.0.0",
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wide-align": "^1.1.0"
+ }
+ },
+ "glob": {
+ "version": "7.1.6",
+ "bundled": true,
+ "dev": true,
+ "optional": 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"
+ }
+ },
+ "has-unicode": {
+ "version": "2.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "ignore-walk": {
+ "version": "3.0.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "minimatch": "^3.0.4"
+ }
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "ini": {
+ "version": "1.3.5",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "minipass": {
+ "version": "2.9.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.0"
+ }
+ },
+ "minizlib": {
+ "version": "1.3.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "minipass": "^2.9.0"
+ }
+ },
+ "mkdirp": {
+ "version": "0.5.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "needle": {
+ "version": "2.3.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "debug": "^3.2.6",
+ "iconv-lite": "^0.4.4",
+ "sax": "^1.2.4"
+ }
+ },
+ "node-pre-gyp": {
+ "version": "0.14.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "detect-libc": "^1.0.2",
+ "mkdirp": "^0.5.1",
+ "needle": "^2.2.1",
+ "nopt": "^4.0.1",
+ "npm-packlist": "^1.1.6",
+ "npmlog": "^4.0.2",
+ "rc": "^1.2.7",
+ "rimraf": "^2.6.1",
+ "semver": "^5.3.0",
+ "tar": "^4.4.2"
+ }
+ },
+ "nopt": {
+ "version": "4.0.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "abbrev": "1",
+ "osenv": "^0.1.4"
+ }
+ },
+ "npm-bundled": {
+ "version": "1.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "npm-normalize-package-bin": "^1.0.1"
+ }
+ },
+ "npm-normalize-package-bin": {
+ "version": "1.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "npm-packlist": {
+ "version": "1.4.8",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ignore-walk": "^3.0.1",
+ "npm-bundled": "^1.0.1",
+ "npm-normalize-package-bin": "^1.0.1"
+ }
+ },
+ "npmlog": {
+ "version": "4.1.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "are-we-there-yet": "~1.1.2",
+ "console-control-strings": "~1.1.0",
+ "gauge": "~2.7.3",
+ "set-blocking": "~2.0.0"
+ }
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "os-homedir": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "osenv": {
+ "version": "0.1.5",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "os-homedir": "^1.0.0",
+ "os-tmpdir": "^1.0.0"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "process-nextick-args": {
+ "version": "2.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "rc": {
+ "version": "1.2.8",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ }
+ },
+ "readable-stream": {
+ "version": "2.3.7",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "rimraf": {
+ "version": "2.7.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "sax": {
+ "version": "1.2.4",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "semver": {
+ "version": "5.7.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "tar": {
+ "version": "4.4.13",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "chownr": "^1.1.1",
+ "fs-minipass": "^1.2.5",
+ "minipass": "^2.8.6",
+ "minizlib": "^1.2.1",
+ "mkdirp": "^0.5.0",
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.3"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "wide-align": {
+ "version": "1.1.3",
+ "bundled": true,
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "string-width": "^1.0.2 || 2"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "bundled": true,
+ "dev": true,
+ "optional": true
+ },
+ "yallist": {
+ "version": "3.1.1",
+ "bundled": true,
+ "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-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true
+ },
+ "get-stream": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
+ "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
+ "dev": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ },
+ "get-value": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz",
+ "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=",
+ "dev": true
+ },
+ "getpass": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
+ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "^1.0.0"
+ }
+ },
+ "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"
+ }
+ },
+ "globals": {
+ "version": "11.12.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
+ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz",
+ "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==",
+ "dev": true
+ },
+ "growly": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz",
+ "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=",
+ "dev": true
+ },
+ "har-schema": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
+ "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
+ "dev": true
+ },
+ "har-validator": {
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
+ "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.5.5",
+ "har-schema": "^2.0.0"
+ }
+ },
+ "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
+ },
+ "has-symbols": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
+ "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=",
+ "dev": true
+ },
+ "has-value": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
+ "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=",
+ "dev": true,
+ "requires": {
+ "get-value": "^2.0.6",
+ "has-values": "^1.0.0",
+ "isobject": "^3.0.0"
+ }
+ },
+ "has-values": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz",
+ "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=",
+ "dev": true,
+ "requires": {
+ "is-number": "^3.0.0",
+ "kind-of": "^4.0.0"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
+ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "history": {
+ "version": "4.10.1",
+ "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz",
+ "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==",
+ "requires": {
+ "@babel/runtime": "^7.1.2",
+ "loose-envify": "^1.2.0",
+ "resolve-pathname": "^3.0.0",
+ "tiny-invariant": "^1.0.2",
+ "tiny-warning": "^1.0.0",
+ "value-equal": "^1.0.1"
+ }
+ },
+ "hosted-git-info": {
+ "version": "2.8.5",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
+ "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==",
+ "dev": true
+ },
+ "html-encoding-sniffer": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz",
+ "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==",
+ "dev": true,
+ "requires": {
+ "whatwg-encoding": "^1.0.1"
+ }
+ },
+ "html-escaper": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.1.tgz",
+ "integrity": "sha512-hNX23TjWwD3q56HpWjUHOKj1+4KKlnjv9PcmBUYKVpga+2cnb9nDx/B1o0yO4n+RZXZdiNxzx6B24C9aNMTkkQ==",
+ "dev": true
+ },
+ "http-signature": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
+ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "^1.0.0",
+ "jsprim": "^1.2.2",
+ "sshpk": "^1.7.0"
+ }
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "dev": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "import-local": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz",
+ "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==",
+ "dev": true,
+ "requires": {
+ "pkg-dir": "^3.0.0",
+ "resolve-cwd": "^2.0.0"
+ }
+ },
+ "imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
+ "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
+ },
+ "invariant": {
+ "version": "2.2.4",
+ "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
+ "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
+ "dev": true,
+ "requires": {
+ "loose-envify": "^1.0.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
+ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
+ "dev": true
+ },
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true
+ },
+ "is-callable": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
+ "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",
+ "dev": true
+ },
+ "is-ci": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz",
+ "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==",
+ "dev": true,
+ "requires": {
+ "ci-info": "^2.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
+ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-date-object": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
+ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
+ "dev": true
+ },
+ "is-descriptor": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
+ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^0.1.6",
+ "is-data-descriptor": "^0.1.4",
+ "kind-of": "^5.0.0"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
+ "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "dev": true
+ }
+ }
+ },
+ "is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "is-generator-fn": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz",
+ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==",
+ "dev": true
+ },
+ "is-number": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
+ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-plain-object": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
+ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
+ "dev": true,
+ "requires": {
+ "isobject": "^3.0.1"
+ }
+ },
+ "is-regex": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
+ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.1"
+ }
+ },
+ "is-stream": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
+ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
+ "dev": true
+ },
+ "is-symbol": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz",
+ "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==",
+ "dev": true,
+ "requires": {
+ "has-symbols": "^1.0.0"
+ }
+ },
+ "is-typedarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
+ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
+ "dev": true
+ },
+ "is-windows": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
+ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
+ "dev": true
+ },
+ "is-wsl": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
+ "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=",
+ "dev": true
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
+ "dev": true
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
+ },
+ "isobject": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
+ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
+ "dev": true
+ },
+ "isstream": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
+ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
+ "dev": true
+ },
+ "istanbul-lib-coverage": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz",
+ "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==",
+ "dev": true
+ },
+ "istanbul-lib-instrument": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz",
+ "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==",
+ "dev": true,
+ "requires": {
+ "@babel/generator": "^7.4.0",
+ "@babel/parser": "^7.4.3",
+ "@babel/template": "^7.4.0",
+ "@babel/traverse": "^7.4.3",
+ "@babel/types": "^7.4.0",
+ "istanbul-lib-coverage": "^2.0.5",
+ "semver": "^6.0.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ }
+ }
+ },
+ "istanbul-lib-report": {
+ "version": "2.0.8",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz",
+ "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==",
+ "dev": true,
+ "requires": {
+ "istanbul-lib-coverage": "^2.0.5",
+ "make-dir": "^2.1.0",
+ "supports-color": "^6.1.0"
+ },
+ "dependencies": {
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "istanbul-lib-source-maps": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz",
+ "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==",
+ "dev": true,
+ "requires": {
+ "debug": "^4.1.1",
+ "istanbul-lib-coverage": "^2.0.5",
+ "make-dir": "^2.1.0",
+ "rimraf": "^2.6.3",
+ "source-map": "^0.6.1"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
+ "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ }
+ }
+ },
+ "istanbul-reports": {
+ "version": "2.2.7",
+ "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz",
+ "integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==",
+ "dev": true,
+ "requires": {
+ "html-escaper": "^2.0.0"
+ }
+ },
+ "jest": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest/-/jest-24.9.0.tgz",
+ "integrity": "sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw==",
+ "dev": true,
+ "requires": {
+ "import-local": "^2.0.0",
+ "jest-cli": "^24.9.0"
+ },
+ "dependencies": {
+ "jest-cli": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.9.0.tgz",
+ "integrity": "sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg==",
+ "dev": true,
+ "requires": {
+ "@jest/core": "^24.9.0",
+ "@jest/test-result": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "chalk": "^2.0.1",
+ "exit": "^0.1.2",
+ "import-local": "^2.0.0",
+ "is-ci": "^2.0.0",
+ "jest-config": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "jest-validate": "^24.9.0",
+ "prompts": "^2.0.1",
+ "realpath-native": "^1.1.0",
+ "yargs": "^13.3.0"
+ }
+ }
+ }
+ },
+ "jest-changed-files": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.9.0.tgz",
+ "integrity": "sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0",
+ "execa": "^1.0.0",
+ "throat": "^4.0.0"
+ }
+ },
+ "jest-config": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.9.0.tgz",
+ "integrity": "sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==",
+ "dev": true,
+ "requires": {
+ "@babel/core": "^7.1.0",
+ "@jest/test-sequencer": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "babel-jest": "^24.9.0",
+ "chalk": "^2.0.1",
+ "glob": "^7.1.1",
+ "jest-environment-jsdom": "^24.9.0",
+ "jest-environment-node": "^24.9.0",
+ "jest-get-type": "^24.9.0",
+ "jest-jasmine2": "^24.9.0",
+ "jest-regex-util": "^24.3.0",
+ "jest-resolve": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "jest-validate": "^24.9.0",
+ "micromatch": "^3.1.10",
+ "pretty-format": "^24.9.0",
+ "realpath-native": "^1.1.0"
+ }
+ },
+ "jest-diff": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.9.0.tgz",
+ "integrity": "sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.0.1",
+ "diff-sequences": "^24.9.0",
+ "jest-get-type": "^24.9.0",
+ "pretty-format": "^24.9.0"
+ }
+ },
+ "jest-docblock": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-24.9.0.tgz",
+ "integrity": "sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA==",
+ "dev": true,
+ "requires": {
+ "detect-newline": "^2.1.0"
+ }
+ },
+ "jest-each": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-24.9.0.tgz",
+ "integrity": "sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0",
+ "chalk": "^2.0.1",
+ "jest-get-type": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "pretty-format": "^24.9.0"
+ }
+ },
+ "jest-environment-jsdom": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz",
+ "integrity": "sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA==",
+ "dev": true,
+ "requires": {
+ "@jest/environment": "^24.9.0",
+ "@jest/fake-timers": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "jest-mock": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "jsdom": "^11.5.1"
+ }
+ },
+ "jest-environment-node": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.9.0.tgz",
+ "integrity": "sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA==",
+ "dev": true,
+ "requires": {
+ "@jest/environment": "^24.9.0",
+ "@jest/fake-timers": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "jest-mock": "^24.9.0",
+ "jest-util": "^24.9.0"
+ }
+ },
+ "jest-get-type": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz",
+ "integrity": "sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==",
+ "dev": true
+ },
+ "jest-haste-map": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-24.9.0.tgz",
+ "integrity": "sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0",
+ "anymatch": "^2.0.0",
+ "fb-watchman": "^2.0.0",
+ "fsevents": "^1.2.7",
+ "graceful-fs": "^4.1.15",
+ "invariant": "^2.2.4",
+ "jest-serializer": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "jest-worker": "^24.9.0",
+ "micromatch": "^3.1.10",
+ "sane": "^4.0.3",
+ "walker": "^1.0.7"
+ }
+ },
+ "jest-jasmine2": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz",
+ "integrity": "sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw==",
+ "dev": true,
+ "requires": {
+ "@babel/traverse": "^7.1.0",
+ "@jest/environment": "^24.9.0",
+ "@jest/test-result": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "chalk": "^2.0.1",
+ "co": "^4.6.0",
+ "expect": "^24.9.0",
+ "is-generator-fn": "^2.0.0",
+ "jest-each": "^24.9.0",
+ "jest-matcher-utils": "^24.9.0",
+ "jest-message-util": "^24.9.0",
+ "jest-runtime": "^24.9.0",
+ "jest-snapshot": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "pretty-format": "^24.9.0",
+ "throat": "^4.0.0"
+ }
+ },
+ "jest-leak-detector": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz",
+ "integrity": "sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA==",
+ "dev": true,
+ "requires": {
+ "jest-get-type": "^24.9.0",
+ "pretty-format": "^24.9.0"
+ }
+ },
+ "jest-matcher-utils": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz",
+ "integrity": "sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.0.1",
+ "jest-diff": "^24.9.0",
+ "jest-get-type": "^24.9.0",
+ "pretty-format": "^24.9.0"
+ }
+ },
+ "jest-message-util": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.9.0.tgz",
+ "integrity": "sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "@jest/test-result": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "@types/stack-utils": "^1.0.1",
+ "chalk": "^2.0.1",
+ "micromatch": "^3.1.10",
+ "slash": "^2.0.0",
+ "stack-utils": "^1.0.1"
+ }
+ },
+ "jest-mock": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-24.9.0.tgz",
+ "integrity": "sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0"
+ }
+ },
+ "jest-pnp-resolver": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz",
+ "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==",
+ "dev": true
+ },
+ "jest-regex-util": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.9.0.tgz",
+ "integrity": "sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA==",
+ "dev": true
+ },
+ "jest-resolve": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.9.0.tgz",
+ "integrity": "sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0",
+ "browser-resolve": "^1.11.3",
+ "chalk": "^2.0.1",
+ "jest-pnp-resolver": "^1.2.1",
+ "realpath-native": "^1.1.0"
+ }
+ },
+ "jest-resolve-dependencies": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz",
+ "integrity": "sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0",
+ "jest-regex-util": "^24.3.0",
+ "jest-snapshot": "^24.9.0"
+ }
+ },
+ "jest-runner": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.9.0.tgz",
+ "integrity": "sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg==",
+ "dev": true,
+ "requires": {
+ "@jest/console": "^24.7.1",
+ "@jest/environment": "^24.9.0",
+ "@jest/test-result": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "chalk": "^2.4.2",
+ "exit": "^0.1.2",
+ "graceful-fs": "^4.1.15",
+ "jest-config": "^24.9.0",
+ "jest-docblock": "^24.3.0",
+ "jest-haste-map": "^24.9.0",
+ "jest-jasmine2": "^24.9.0",
+ "jest-leak-detector": "^24.9.0",
+ "jest-message-util": "^24.9.0",
+ "jest-resolve": "^24.9.0",
+ "jest-runtime": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "jest-worker": "^24.6.0",
+ "source-map-support": "^0.5.6",
+ "throat": "^4.0.0"
+ }
+ },
+ "jest-runtime": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.9.0.tgz",
+ "integrity": "sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw==",
+ "dev": true,
+ "requires": {
+ "@jest/console": "^24.7.1",
+ "@jest/environment": "^24.9.0",
+ "@jest/source-map": "^24.3.0",
+ "@jest/transform": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "@types/yargs": "^13.0.0",
+ "chalk": "^2.0.1",
+ "exit": "^0.1.2",
+ "glob": "^7.1.3",
+ "graceful-fs": "^4.1.15",
+ "jest-config": "^24.9.0",
+ "jest-haste-map": "^24.9.0",
+ "jest-message-util": "^24.9.0",
+ "jest-mock": "^24.9.0",
+ "jest-regex-util": "^24.3.0",
+ "jest-resolve": "^24.9.0",
+ "jest-snapshot": "^24.9.0",
+ "jest-util": "^24.9.0",
+ "jest-validate": "^24.9.0",
+ "realpath-native": "^1.1.0",
+ "slash": "^2.0.0",
+ "strip-bom": "^3.0.0",
+ "yargs": "^13.3.0"
+ }
+ },
+ "jest-serializer": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-24.9.0.tgz",
+ "integrity": "sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ==",
+ "dev": true
+ },
+ "jest-snapshot": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.9.0.tgz",
+ "integrity": "sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.0.0",
+ "@jest/types": "^24.9.0",
+ "chalk": "^2.0.1",
+ "expect": "^24.9.0",
+ "jest-diff": "^24.9.0",
+ "jest-get-type": "^24.9.0",
+ "jest-matcher-utils": "^24.9.0",
+ "jest-message-util": "^24.9.0",
+ "jest-resolve": "^24.9.0",
+ "mkdirp": "^0.5.1",
+ "natural-compare": "^1.4.0",
+ "pretty-format": "^24.9.0",
+ "semver": "^6.2.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ }
+ }
+ },
+ "jest-util": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.9.0.tgz",
+ "integrity": "sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg==",
+ "dev": true,
+ "requires": {
+ "@jest/console": "^24.9.0",
+ "@jest/fake-timers": "^24.9.0",
+ "@jest/source-map": "^24.9.0",
+ "@jest/test-result": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "callsites": "^3.0.0",
+ "chalk": "^2.0.1",
+ "graceful-fs": "^4.1.15",
+ "is-ci": "^2.0.0",
+ "mkdirp": "^0.5.1",
+ "slash": "^2.0.0",
+ "source-map": "^0.6.0"
+ }
+ },
+ "jest-validate": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz",
+ "integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0",
+ "camelcase": "^5.3.1",
+ "chalk": "^2.0.1",
+ "jest-get-type": "^24.9.0",
+ "leven": "^3.1.0",
+ "pretty-format": "^24.9.0"
+ }
+ },
+ "jest-watcher": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-24.9.0.tgz",
+ "integrity": "sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw==",
+ "dev": true,
+ "requires": {
+ "@jest/test-result": "^24.9.0",
+ "@jest/types": "^24.9.0",
+ "@types/yargs": "^13.0.0",
+ "ansi-escapes": "^3.0.0",
+ "chalk": "^2.0.1",
+ "jest-util": "^24.9.0",
+ "string-length": "^2.0.0"
+ }
+ },
+ "jest-worker": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz",
+ "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==",
+ "dev": true,
+ "requires": {
+ "merge-stream": "^2.0.0",
+ "supports-color": "^6.1.0"
+ },
+ "dependencies": {
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
+ },
+ "jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
+ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
+ "dev": true
+ },
+ "jsdom": {
+ "version": "11.12.0",
+ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz",
+ "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==",
+ "dev": true,
+ "requires": {
+ "abab": "^2.0.0",
+ "acorn": "^5.5.3",
+ "acorn-globals": "^4.1.0",
+ "array-equal": "^1.0.0",
+ "cssom": ">= 0.3.2 < 0.4.0",
+ "cssstyle": "^1.0.0",
+ "data-urls": "^1.0.0",
+ "domexception": "^1.0.1",
+ "escodegen": "^1.9.1",
+ "html-encoding-sniffer": "^1.0.2",
+ "left-pad": "^1.3.0",
+ "nwsapi": "^2.0.7",
+ "parse5": "4.0.0",
+ "pn": "^1.1.0",
+ "request": "^2.87.0",
+ "request-promise-native": "^1.0.5",
+ "sax": "^1.2.4",
+ "symbol-tree": "^3.2.2",
+ "tough-cookie": "^2.3.4",
+ "w3c-hr-time": "^1.0.1",
+ "webidl-conversions": "^4.0.2",
+ "whatwg-encoding": "^1.0.3",
+ "whatwg-mimetype": "^2.1.0",
+ "whatwg-url": "^6.4.1",
+ "ws": "^5.2.0",
+ "xml-name-validator": "^3.0.0"
+ }
+ },
+ "jsesc": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
+ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+ "dev": true
+ },
+ "json-parse-better-errors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
+ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
+ "dev": true
+ },
+ "json-schema": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
+ "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
+ "dev": true
+ },
+ "json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true
+ },
+ "json-stringify-safe": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
+ "dev": true
+ },
+ "json5": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz",
+ "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.0"
+ }
+ },
+ "jsprim": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
+ "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "1.0.0",
+ "extsprintf": "1.3.0",
+ "json-schema": "0.2.3",
+ "verror": "1.10.0"
+ }
+ },
+ "kind-of": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
+ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
+ "dev": true
+ },
+ "kleur": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
+ "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==",
+ "dev": true
+ },
+ "left-pad": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz",
+ "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==",
+ "dev": true
+ },
+ "leven": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
+ "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==",
+ "dev": true
+ },
+ "levn": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2"
+ }
+ },
+ "load-json-file": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
+ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^4.0.0",
+ "pify": "^3.0.0",
+ "strip-bom": "^3.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
+ "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^3.0.0",
+ "path-exists": "^3.0.0"
+ }
+ },
+ "lodash": {
+ "version": "4.17.20",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
+ "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
+ },
+ "lodash.memoize": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
+ "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
+ "dev": true
+ },
+ "lodash.sortby": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
+ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
+ "dev": true
+ },
+ "loose-envify": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "requires": {
+ "js-tokens": "^3.0.0 || ^4.0.0"
+ }
+ },
+ "make-dir": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
+ "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
+ "dev": true,
+ "requires": {
+ "pify": "^4.0.1",
+ "semver": "^5.6.0"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
+ "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
+ "dev": true
+ }
+ }
+ },
+ "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
+ },
+ "makeerror": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz",
+ "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=",
+ "dev": true,
+ "requires": {
+ "tmpl": "1.0.x"
+ }
+ },
+ "map-cache": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
+ "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=",
+ "dev": true
+ },
+ "map-visit": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
+ "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=",
+ "dev": true,
+ "requires": {
+ "object-visit": "^1.0.0"
+ }
+ },
+ "merge-stream": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "3.1.10",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
+ "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
+ "dev": true,
+ "requires": {
+ "arr-diff": "^4.0.0",
+ "array-unique": "^0.3.2",
+ "braces": "^2.3.1",
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "extglob": "^2.0.4",
+ "fragment-cache": "^0.2.1",
+ "kind-of": "^6.0.2",
+ "nanomatch": "^1.2.9",
+ "object.pick": "^1.3.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.2"
+ }
+ },
+ "mime-db": {
+ "version": "1.40.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
+ "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==",
+ "dev": true
+ },
+ "mime-types": {
+ "version": "2.1.24",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
+ "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
+ "dev": true,
+ "requires": {
+ "mime-db": "1.40.0"
+ }
+ },
+ "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"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "dev": true
+ },
+ "mixin-deep": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
+ "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
+ "dev": true,
+ "requires": {
+ "for-in": "^1.0.2",
+ "is-extendable": "^1.0.1"
+ },
+ "dependencies": {
+ "is-extendable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
+ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
+ "dev": true,
+ "requires": {
+ "is-plain-object": "^2.0.4"
+ }
+ }
+ }
+ },
+ "mkdirp": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
+ "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "nan": {
+ "version": "2.14.1",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
+ "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
+ "dev": true,
+ "optional": true
+ },
+ "nanomatch": {
+ "version": "1.2.13",
+ "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
+ "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==",
+ "dev": true,
+ "requires": {
+ "arr-diff": "^4.0.0",
+ "array-unique": "^0.3.2",
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "fragment-cache": "^0.2.1",
+ "is-windows": "^1.0.2",
+ "kind-of": "^6.0.2",
+ "object.pick": "^1.3.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ }
+ },
+ "natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
+ "dev": true
+ },
+ "nice-try": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
+ "dev": true
+ },
+ "node-int64": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
+ "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=",
+ "dev": true
+ },
+ "node-modules-regexp": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz",
+ "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=",
+ "dev": true
+ },
+ "node-notifier": {
+ "version": "5.4.3",
+ "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.3.tgz",
+ "integrity": "sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q==",
+ "dev": true,
+ "requires": {
+ "growly": "^1.3.0",
+ "is-wsl": "^1.1.0",
+ "semver": "^5.5.0",
+ "shellwords": "^0.1.1",
+ "which": "^1.3.0"
+ }
+ },
+ "normalize-package-data": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
+ "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
+ "dev": true,
+ "requires": {
+ "hosted-git-info": "^2.1.4",
+ "resolve": "^1.10.0",
+ "semver": "2 || 3 || 4 || 5",
+ "validate-npm-package-license": "^3.0.1"
+ }
+ },
+ "normalize-path": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
+ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
+ "dev": true,
+ "requires": {
+ "remove-trailing-separator": "^1.0.1"
+ }
+ },
+ "npm-run-path": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
+ "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
+ "dev": true,
+ "requires": {
+ "path-key": "^2.0.0"
+ }
+ },
+ "nwsapi": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz",
+ "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==",
+ "dev": true
+ },
+ "oauth-sign": {
+ "version": "0.9.0",
+ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
+ "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
+ "dev": true
+ },
+ "object-copy": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
+ "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=",
+ "dev": true,
+ "requires": {
+ "copy-descriptor": "^0.1.0",
+ "define-property": "^0.2.5",
+ "kind-of": "^3.0.3"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "object-inspect": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz",
+ "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==",
+ "dev": true
+ },
+ "object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "dev": true
+ },
+ "object-visit": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
+ "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=",
+ "dev": true,
+ "requires": {
+ "isobject": "^3.0.0"
+ }
+ },
+ "object.getownpropertydescriptors": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz",
+ "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "es-abstract": "^1.5.1"
+ }
+ },
+ "object.pick": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz",
+ "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=",
+ "dev": true,
+ "requires": {
+ "isobject": "^3.0.1"
+ }
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "optionator": {
+ "version": "0.8.3",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
+ "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
+ "dev": true,
+ "requires": {
+ "deep-is": "~0.1.3",
+ "fast-levenshtein": "~2.0.6",
+ "levn": "~0.3.0",
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2",
+ "word-wrap": "~1.2.3"
+ }
+ },
+ "p-each-series": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-1.0.0.tgz",
+ "integrity": "sha1-kw89Et0fUOdDRFeiLNbwSsatf3E=",
+ "dev": true,
+ "requires": {
+ "p-reduce": "^1.0.0"
+ }
+ },
+ "p-finally": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
+ "dev": true
+ },
+ "p-limit": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
+ "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==",
+ "dev": true,
+ "requires": {
+ "p-try": "^2.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
+ "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.0.0"
+ }
+ },
+ "p-reduce": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
+ "integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=",
+ "dev": true
+ },
+ "p-try": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
+ "dev": true
+ },
+ "parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.3.1",
+ "json-parse-better-errors": "^1.0.1"
+ }
+ },
+ "parse5": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz",
+ "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==",
+ "dev": true
+ },
+ "pascalcase": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz",
+ "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=",
+ "dev": true
+ },
+ "path-exists": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
+ "dev": true
+ },
+ "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-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
+ "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
+ },
+ "path-type": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
+ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
+ "dev": true,
+ "requires": {
+ "pify": "^3.0.0"
+ }
+ },
+ "performance-now": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
+ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
+ "dev": true
+ },
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true
+ },
+ "pirates": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz",
+ "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==",
+ "dev": true,
+ "requires": {
+ "node-modules-regexp": "^1.0.0"
+ }
+ },
+ "pkg-dir": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz",
+ "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==",
+ "dev": true,
+ "requires": {
+ "find-up": "^3.0.0"
+ }
+ },
+ "pn": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz",
+ "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==",
+ "dev": true
+ },
+ "posix-character-classes": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
+ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=",
+ "dev": true
+ },
+ "prelude-ls": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
+ "dev": true
+ },
+ "prettier": {
+ "version": "1.19.1",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
+ "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
+ "dev": true
+ },
+ "pretty-format": {
+ "version": "24.9.0",
+ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz",
+ "integrity": "sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^24.9.0",
+ "ansi-regex": "^4.0.0",
+ "ansi-styles": "^3.2.0",
+ "react-is": "^16.8.4"
+ }
+ },
+ "prompts": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.2.1.tgz",
+ "integrity": "sha512-VObPvJiWPhpZI6C5m60XOzTfnYg/xc/an+r9VYymj9WJW3B/DIH+REzjpAACPf8brwPeP+7vz3bIim3S+AaMjw==",
+ "dev": true,
+ "requires": {
+ "kleur": "^3.0.3",
+ "sisteransi": "^1.0.3"
+ }
+ },
+ "psl": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz",
+ "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==",
+ "dev": true
+ },
+ "pump": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+ "dev": true
+ },
+ "qs": {
+ "version": "6.9.4",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
+ "integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
+ },
+ "react-is": {
+ "version": "16.11.0",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.11.0.tgz",
+ "integrity": "sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==",
+ "dev": true
+ },
+ "read-pkg": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
+ "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "^4.0.0",
+ "normalize-package-data": "^2.3.2",
+ "path-type": "^3.0.0"
+ }
+ },
+ "read-pkg-up": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz",
+ "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==",
+ "dev": true,
+ "requires": {
+ "find-up": "^3.0.0",
+ "read-pkg": "^3.0.0"
+ }
+ },
+ "realpath-native": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.1.0.tgz",
+ "integrity": "sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA==",
+ "dev": true,
+ "requires": {
+ "util.promisify": "^1.0.0"
+ }
+ },
+ "regenerator-runtime": {
+ "version": "0.13.3",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz",
+ "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw=="
+ },
+ "regex-not": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
+ "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==",
+ "dev": true,
+ "requires": {
+ "extend-shallow": "^3.0.2",
+ "safe-regex": "^1.1.0"
+ }
+ },
+ "remove-trailing-separator": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
+ "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=",
+ "dev": true
+ },
+ "repeat-element": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz",
+ "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==",
+ "dev": true
+ },
+ "repeat-string": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
+ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
+ "dev": true
+ },
+ "request": {
+ "version": "2.88.0",
+ "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
+ "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
+ "dev": true,
+ "requires": {
+ "aws-sign2": "~0.7.0",
+ "aws4": "^1.8.0",
+ "caseless": "~0.12.0",
+ "combined-stream": "~1.0.6",
+ "extend": "~3.0.2",
+ "forever-agent": "~0.6.1",
+ "form-data": "~2.3.2",
+ "har-validator": "~5.1.0",
+ "http-signature": "~1.2.0",
+ "is-typedarray": "~1.0.0",
+ "isstream": "~0.1.2",
+ "json-stringify-safe": "~5.0.1",
+ "mime-types": "~2.1.19",
+ "oauth-sign": "~0.9.0",
+ "performance-now": "^2.1.0",
+ "qs": "~6.5.2",
+ "safe-buffer": "^5.1.2",
+ "tough-cookie": "~2.4.3",
+ "tunnel-agent": "^0.6.0",
+ "uuid": "^3.3.2"
+ },
+ "dependencies": {
+ "punycode": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
+ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
+ "dev": true
+ },
+ "qs": {
+ "version": "6.5.2",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
+ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
+ "dev": true
+ },
+ "tough-cookie": {
+ "version": "2.4.3",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
+ "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
+ "dev": true,
+ "requires": {
+ "psl": "^1.1.24",
+ "punycode": "^1.4.1"
+ }
+ }
+ }
+ },
+ "request-promise-core": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz",
+ "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==",
+ "dev": true,
+ "requires": {
+ "lodash": "^4.17.15"
+ }
+ },
+ "request-promise-native": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz",
+ "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==",
+ "dev": true,
+ "requires": {
+ "request-promise-core": "1.1.3",
+ "stealthy-require": "^1.1.1",
+ "tough-cookie": "^2.3.3"
+ }
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "dev": true
+ },
+ "require-main-filename": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.12.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
+ "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
+ "dev": true,
+ "requires": {
+ "path-parse": "^1.0.6"
+ }
+ },
+ "resolve-cwd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz",
+ "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=",
+ "dev": true,
+ "requires": {
+ "resolve-from": "^3.0.0"
+ }
+ },
+ "resolve-from": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
+ "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=",
+ "dev": true
+ },
+ "resolve-pathname": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz",
+ "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng=="
+ },
+ "resolve-url": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
+ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=",
+ "dev": true
+ },
+ "ret": {
+ "version": "0.1.15",
+ "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
+ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
+ "dev": true
+ },
+ "rimraf": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
+ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "rsvp": {
+ "version": "4.8.5",
+ "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
+ "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==",
+ "dev": true
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+ "dev": true
+ },
+ "safe-regex": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
+ "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
+ "dev": true,
+ "requires": {
+ "ret": "~0.1.10"
+ }
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
+ "sane": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz",
+ "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==",
+ "dev": true,
+ "requires": {
+ "@cnakazawa/watch": "^1.0.3",
+ "anymatch": "^2.0.0",
+ "capture-exit": "^2.0.0",
+ "exec-sh": "^0.3.2",
+ "execa": "^1.0.0",
+ "fb-watchman": "^2.0.0",
+ "micromatch": "^3.1.4",
+ "minimist": "^1.1.1",
+ "walker": "~1.0.5"
+ }
+ },
+ "sax": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
+ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
+ "dev": true
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
+ "dev": true
+ },
+ "set-value": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
+ "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
+ "dev": true,
+ "requires": {
+ "extend-shallow": "^2.0.1",
+ "is-extendable": "^0.1.1",
+ "is-plain-object": "^2.0.3",
+ "split-string": "^3.0.1"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
+ "dev": true
+ },
+ "shellwords": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz",
+ "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==",
+ "dev": true
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
+ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
+ "dev": true
+ },
+ "sisteransi": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.3.tgz",
+ "integrity": "sha512-SbEG75TzH8G7eVXFSN5f9EExILKfly7SUvVY5DhhYLvfhKqhDFY0OzevWa/zwak0RLRfWS5AvfMWpd9gJvr5Yg==",
+ "dev": true
+ },
+ "slash": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz",
+ "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==",
+ "dev": true
+ },
+ "snapdragon": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
+ "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==",
+ "dev": true,
+ "requires": {
+ "base": "^0.11.1",
+ "debug": "^2.2.0",
+ "define-property": "^0.2.5",
+ "extend-shallow": "^2.0.1",
+ "map-cache": "^0.2.2",
+ "source-map": "^0.5.6",
+ "source-map-resolve": "^0.5.0",
+ "use": "^3.1.0"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ },
+ "source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
+ "dev": true
+ }
+ }
+ },
+ "snapdragon-node": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz",
+ "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==",
+ "dev": true,
+ "requires": {
+ "define-property": "^1.0.0",
+ "isobject": "^3.0.0",
+ "snapdragon-util": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "snapdragon-util": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz",
+ "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.2.0"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "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-resolve": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz",
+ "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==",
+ "dev": true,
+ "requires": {
+ "atob": "^2.1.1",
+ "decode-uri-component": "^0.2.0",
+ "resolve-url": "^0.2.1",
+ "source-map-url": "^0.4.0",
+ "urix": "^0.1.0"
+ }
+ },
+ "source-map-support": {
+ "version": "0.5.16",
+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz",
+ "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==",
+ "dev": true,
+ "requires": {
+ "buffer-from": "^1.0.0",
+ "source-map": "^0.6.0"
+ }
+ },
+ "source-map-url": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
+ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
+ "dev": true
+ },
+ "spdx-correct": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz",
+ "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==",
+ "dev": true,
+ "requires": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-exceptions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz",
+ "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==",
+ "dev": true
+ },
+ "spdx-expression-parse": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
+ "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
+ "dev": true,
+ "requires": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-license-ids": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz",
+ "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==",
+ "dev": true
+ },
+ "split-string": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
+ "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==",
+ "dev": true,
+ "requires": {
+ "extend-shallow": "^3.0.0"
+ }
+ },
+ "sshpk": {
+ "version": "1.16.1",
+ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
+ "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
+ "dev": true,
+ "requires": {
+ "asn1": "~0.2.3",
+ "assert-plus": "^1.0.0",
+ "bcrypt-pbkdf": "^1.0.0",
+ "dashdash": "^1.12.0",
+ "ecc-jsbn": "~0.1.1",
+ "getpass": "^0.1.1",
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.0.2",
+ "tweetnacl": "~0.14.0"
+ }
+ },
+ "stack-utils": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz",
+ "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==",
+ "dev": true
+ },
+ "static-extend": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
+ "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=",
+ "dev": true,
+ "requires": {
+ "define-property": "^0.2.5",
+ "object-copy": "^0.1.0"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ }
+ }
+ },
+ "stealthy-require": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
+ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=",
+ "dev": true
+ },
+ "string-length": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz",
+ "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=",
+ "dev": true,
+ "requires": {
+ "astral-regex": "^1.0.0",
+ "strip-ansi": "^4.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
+ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
+ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^3.0.0"
+ }
+ }
+ }
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ },
+ "string.prototype.trimleft": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
+ "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "function-bind": "^1.1.1"
+ }
+ },
+ "string.prototype.trimright": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz",
+ "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "function-bind": "^1.1.1"
+ }
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ },
+ "strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
+ "dev": true
+ },
+ "strip-eof": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
+ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
+ "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,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "symbol-tree": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
+ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
+ "dev": true
+ },
+ "test-exclude": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz",
+ "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3",
+ "minimatch": "^3.0.4",
+ "read-pkg-up": "^4.0.0",
+ "require-main-filename": "^2.0.0"
+ }
+ },
+ "throat": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz",
+ "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=",
+ "dev": true
+ },
+ "tiny-invariant": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.0.6.tgz",
+ "integrity": "sha512-FOyLWWVjG+aC0UqG76V53yAWdXfH8bO6FNmyZOuUrzDzK8DI3/JRY25UD7+g49JWM1LXwymsKERB+DzI0dTEQA=="
+ },
+ "tiny-warning": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
+ "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
+ },
+ "tmpl": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",
+ "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=",
+ "dev": true
+ },
+ "to-fast-properties": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
+ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
+ "dev": true
+ },
+ "to-object-path": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz",
+ "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "to-regex": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz",
+ "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==",
+ "dev": true,
+ "requires": {
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "regex-not": "^1.0.2",
+ "safe-regex": "^1.1.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
+ "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=",
+ "dev": true,
+ "requires": {
+ "is-number": "^3.0.0",
+ "repeat-string": "^1.6.1"
+ }
+ },
+ "tough-cookie": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
+ "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
+ "dev": true,
+ "requires": {
+ "psl": "^1.1.28",
+ "punycode": "^2.1.1"
+ }
+ },
+ "tr46": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz",
+ "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=",
+ "dev": true,
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "ts-jest": {
+ "version": "24.3.0",
+ "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-24.3.0.tgz",
+ "integrity": "sha512-Hb94C/+QRIgjVZlJyiWwouYUF+siNJHJHknyspaOcZ+OQAIdFG/UrdQVXw/0B8Z3No34xkUXZJpOTy9alOWdVQ==",
+ "dev": true,
+ "requires": {
+ "bs-logger": "0.x",
+ "buffer-from": "1.x",
+ "fast-json-stable-stringify": "2.x",
+ "json5": "2.x",
+ "lodash.memoize": "4.x",
+ "make-error": "1.x",
+ "mkdirp": "0.x",
+ "resolve": "1.x",
+ "semver": "^5.5",
+ "yargs-parser": "10.x"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
+ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
+ "dev": true
+ },
+ "yargs-parser": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
+ "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^4.1.0"
+ }
+ }
+ }
+ },
+ "tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "tweetnacl": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
+ "dev": true
+ },
+ "type-check": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2"
+ }
+ },
+ "typescript": {
+ "version": "3.9.7",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
+ "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
+ "dev": true
+ },
+ "union-value": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
+ "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
+ "dev": true,
+ "requires": {
+ "arr-union": "^3.1.0",
+ "get-value": "^2.0.6",
+ "is-extendable": "^0.1.1",
+ "set-value": "^2.0.1"
+ }
+ },
+ "unset-value": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",
+ "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=",
+ "dev": true,
+ "requires": {
+ "has-value": "^0.3.1",
+ "isobject": "^3.0.0"
+ },
+ "dependencies": {
+ "has-value": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz",
+ "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=",
+ "dev": true,
+ "requires": {
+ "get-value": "^2.0.3",
+ "has-values": "^0.1.4",
+ "isobject": "^2.0.0"
+ },
+ "dependencies": {
+ "isobject": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
+ "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
+ "dev": true,
+ "requires": {
+ "isarray": "1.0.0"
+ }
+ }
+ }
+ },
+ "has-values": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz",
+ "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=",
+ "dev": true
+ }
+ }
+ },
+ "uri-js": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
+ "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
+ "dev": true,
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "urix": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",
+ "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=",
+ "dev": true
+ },
+ "use": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
+ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==",
+ "dev": true
+ },
+ "util.promisify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz",
+ "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "object.getownpropertydescriptors": "^2.0.3"
+ }
+ },
+ "uuid": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
+ "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
+ "dev": true
+ },
+ "validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "dev": true,
+ "requires": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
+ "value-equal": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz",
+ "integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw=="
+ },
+ "verror": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
+ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "^1.0.0",
+ "core-util-is": "1.0.2",
+ "extsprintf": "^1.2.0"
+ }
+ },
+ "w3c-hr-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz",
+ "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=",
+ "dev": true,
+ "requires": {
+ "browser-process-hrtime": "^0.1.2"
+ }
+ },
+ "walker": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz",
+ "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=",
+ "dev": true,
+ "requires": {
+ "makeerror": "1.0.x"
+ }
+ },
+ "webidl-conversions": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
+ "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==",
+ "dev": true
+ },
+ "whatwg-encoding": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz",
+ "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==",
+ "dev": true,
+ "requires": {
+ "iconv-lite": "0.4.24"
+ }
+ },
+ "whatwg-mimetype": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz",
+ "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==",
+ "dev": true
+ },
+ "whatwg-url": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz",
+ "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==",
+ "dev": true,
+ "requires": {
+ "lodash.sortby": "^4.7.0",
+ "tr46": "^1.0.1",
+ "webidl-conversions": "^4.0.2"
+ }
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "which-module": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
+ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
+ "dev": true
+ },
+ "word-wrap": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
+ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+ "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "string-width": "^3.0.0",
+ "strip-ansi": "^5.0.0"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ },
+ "write-file-atomic": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.1.tgz",
+ "integrity": "sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.11",
+ "imurmurhash": "^0.1.4",
+ "signal-exit": "^3.0.2"
+ }
+ },
+ "ws": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
+ "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
+ "dev": true,
+ "requires": {
+ "async-limiter": "~1.0.0"
+ }
+ },
+ "xml-name-validator": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
+ "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
+ "dev": true
+ },
+ "y18n": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
+ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
+ "dev": true
+ },
+ "yargs": {
+ "version": "13.3.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz",
+ "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==",
+ "dev": true,
+ "requires": {
+ "cliui": "^5.0.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^3.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.1.1"
+ }
+ },
+ "yargs-parser": {
+ "version": "13.1.2",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
+ "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+}
diff --git a/jslib/package.json b/jslib/package.json
new file mode 100644
index 00000000..ad602990
--- /dev/null
+++ b/jslib/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "jslib",
+ "repository": "https://github.com/dnote/dnote",
+ "version": "0.1.0",
+ "description": "An internal JavaScript SDK for Dnote",
+ "types": "dist/types/index.d.ts",
+ "scripts": {
+ "clean": "rm -rf ./dist",
+ "build": "tsc",
+ "build:watch": "tsc --watch",
+ "test": "jest --coverage",
+ "test:watch": "jest --watch",
+ "lint": "../node_modules/.bin/eslint ./src --ext .ts,.tsx,.js",
+ "lint:fix": "../node_modules/.bin/eslint ./src --fix --ext .ts,.tsx,.js"
+ },
+ "author": "Monomax Software Pty Ltd",
+ "license": "AGPL-3.0-or-later",
+ "dependencies": {
+ "@types/history": "^4.7.8",
+ "history": "^4.10.1",
+ "lodash": "^4.17.20",
+ "qs": "^6.9.4"
+ },
+ "devDependencies": {
+ "@types/jest": "^24.9.1",
+ "jest": "^24.9.0",
+ "prettier": "^1.19.1",
+ "ts-jest": "^24.3.0",
+ "typescript": "^3.9.7"
+ }
+}
diff --git a/jslib/src/helpers/arr.spec.ts b/jslib/src/helpers/arr.spec.ts
new file mode 100644
index 00000000..51ded98c
--- /dev/null
+++ b/jslib/src/helpers/arr.spec.ts
@@ -0,0 +1,42 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { getRange } from './arr';
+
+describe('getRange', () => {
+ const testCases = [
+ {
+ input: 1,
+ expected: [1]
+ },
+ {
+ input: 3,
+ expected: [1, 2, 3]
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; ++i) {
+ const tc = testCases[i];
+
+ test(`generates a range for ${tc.input}`, () => {
+ const result = getRange(tc.input);
+
+ expect(result).toStrictEqual(tc.expected);
+ });
+ }
+});
diff --git a/jslib/src/helpers/arr.ts b/jslib/src/helpers/arr.ts
new file mode 100644
index 00000000..cd2b72da
--- /dev/null
+++ b/jslib/src/helpers/arr.ts
@@ -0,0 +1,29 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// // getRange returns an array with an incrementing integers from
+// 1 to the given number. e.g. [1, 2, 3, ..., 10]
+export function getRange(n: number): number[] {
+ const ret = [];
+
+ for (let i = 1; i <= n; i++) {
+ ret.push(i);
+ }
+
+ return ret;
+}
diff --git a/jslib/src/helpers/books.spec.ts b/jslib/src/helpers/books.spec.ts
new file mode 100644
index 00000000..3356e95a
--- /dev/null
+++ b/jslib/src/helpers/books.spec.ts
@@ -0,0 +1,183 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ validateBookName,
+ checkDuplicate,
+ errBookNameNumeric,
+ errBookNameHasSpace,
+ errBookNameReserved,
+ errBookNameHasComma
+} from './books';
+
+describe('books lib', () => {
+ describe('validateBookName', () => {
+ const testCases = [
+ {
+ input: 'javascript',
+ expectedErr: null
+ },
+ {
+ input: 'node.js',
+ expectedErr: null
+ },
+ {
+ input: 'foo bar',
+ expectedErr: errBookNameHasSpace
+ },
+ {
+ input: '123',
+ expectedErr: errBookNameNumeric
+ },
+ {
+ input: '+123',
+ expectedErr: null
+ },
+ {
+ input: '-123',
+ expectedErr: null
+ },
+ {
+ input: '+javascript',
+ expectedErr: null
+ },
+ {
+ input: '0',
+ expectedErr: errBookNameNumeric
+ },
+ {
+ input: '0333',
+ expectedErr: errBookNameNumeric
+ },
+ {
+ input: ' javascript',
+ expectedErr: errBookNameHasSpace
+ },
+ {
+ input: 'java script',
+ expectedErr: errBookNameHasSpace
+ },
+ {
+ input: 'javascript (1)',
+ expectedErr: errBookNameHasSpace
+ },
+ {
+ input: 'javascript ',
+ expectedErr: errBookNameHasSpace
+ },
+ {
+ input: 'javascript (1) (2) (3)',
+ expectedErr: errBookNameHasSpace
+ },
+ {
+ input: ',',
+ expectedErr: errBookNameHasComma
+ },
+ {
+ input: 'foo,bar',
+ expectedErr: errBookNameHasComma
+ },
+ {
+ input: ',,,',
+ expectedErr: errBookNameHasComma
+ },
+
+ // reserved book names
+ {
+ input: 'trash',
+ expectedErr: errBookNameReserved
+ },
+ {
+ input: 'conflicts',
+ expectedErr: errBookNameReserved
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; ++i) {
+ const tc = testCases[i];
+
+ test(`validates ${tc.input}`, () => {
+ const base = expect(() => validateBookName(tc.input));
+
+ if (tc.expectedErr) {
+ base.toThrow(tc.expectedErr);
+ } else {
+ base.not.toThrow();
+ }
+ });
+ }
+ });
+
+ describe('checkDuplicate', () => {
+ const golangBook = {
+ label: 'golang',
+ uuid: '04a0ead6-a450-44c2-b952-4d8ddsfdc70j',
+ usn: 10,
+ created_at: '2019-08-20T05:13:54.690438Z',
+ updated_at: '2019-08-20T05:13:54.690438Z'
+ };
+ const fooBook = {
+ label: 'foo',
+ uuid: '14a0ead6-a450-44c2-b952-4d8ddsfdc70j',
+ usn: 10,
+ created_at: '2019-08-20T05:13:54.690438Z',
+ updated_at: '2019-08-20T05:13:54.690438Z'
+ };
+ const barBook = {
+ label: 'bar',
+ uuid: '24a0ead6-a450-44c2-b952-4d8ddsfdc70j',
+ usn: 10,
+ created_at: '2019-08-20T05:13:54.690438Z',
+ updated_at: '2019-08-20T05:13:54.690438Z'
+ };
+ const fooBarBook = {
+ label: 'foo_bar',
+ uuid: '34a0ead6-a450-44c2-b952-4d8ddsfdc70j',
+ usn: 10,
+ created_at: '2019-08-20T05:13:54.690438Z',
+ updated_at: '2019-08-20T05:13:54.690438Z'
+ };
+
+ const testCases = [
+ {
+ books: [],
+ bookName: 'javascript',
+ expected: false
+ },
+ {
+ books: [golangBook, fooBarBook, fooBook],
+ bookName: 'bar1',
+ expected: false
+ },
+ {
+ books: [golangBook, fooBook, barBook],
+ bookName: 'bar',
+ expected: true
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; ++i) {
+ const tc = testCases[i];
+
+ test(`checks duplicate for the test case ${i}`, () => {
+ const result = checkDuplicate(tc.books, tc.bookName);
+ expect(result).toBe(tc.expected);
+ });
+ }
+ });
+});
diff --git a/jslib/src/helpers/books.ts b/jslib/src/helpers/books.ts
new file mode 100644
index 00000000..8b10b714
--- /dev/null
+++ b/jslib/src/helpers/books.ts
@@ -0,0 +1,72 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { BookData } from '../operations/types';
+
+// errBookNameNumeric is an error for book names that only contain numbers
+export const errBookNameNumeric = new Error(
+ 'The book name cannot contain only numbers'
+);
+
+// errBookNameHasSpace is an error for book names that have any space
+export const errBookNameHasSpace = new Error(
+ 'The book name cannot contain spaces'
+);
+
+// errBookNameHasComma is an error for book names that have any comma
+export const errBookNameHasComma = new Error('The book name has comma');
+
+// errBookNameReserved is an error incidating that the specified book name is reserved
+export const errBookNameReserved = new Error('The book name is reserved');
+
+const numberRegex = /^\d+$/;
+
+const reservedBookNames = ['trash', 'conflicts'];
+
+// validateBookName validates the given book name and throws error if not valid
+export function validateBookName(bookName: string) {
+ if (reservedBookNames.indexOf(bookName) > -1) {
+ throw errBookNameReserved;
+ }
+
+ if (numberRegex.test(bookName)) {
+ throw errBookNameNumeric;
+ }
+
+ if (bookName.indexOf(' ') > -1) {
+ throw errBookNameHasSpace;
+ }
+
+ if (bookName.indexOf(',') > -1) {
+ throw errBookNameHasComma;
+ }
+}
+
+// checkDuplicate checks if the given book name has a duplicate in the given array
+// of books
+export function checkDuplicate(books: BookData[], bookName: string): boolean {
+ for (let i = 0; i < books.length; i++) {
+ const book = books[i];
+
+ if (book.label === bookName) {
+ return true;
+ }
+ }
+
+ return false;
+}
diff --git a/jslib/src/helpers/filters.ts b/jslib/src/helpers/filters.ts
new file mode 100644
index 00000000..9dbcacfe
--- /dev/null
+++ b/jslib/src/helpers/filters.ts
@@ -0,0 +1,95 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { parseSearchString } from './url';
+import { Queries } from './queries';
+
+export interface Filters {
+ queries: Queries;
+ page: number;
+}
+
+function compareBookArr(a1: string[], a2: string[]) {
+ if (a1.length !== a2.length) {
+ return false;
+ }
+
+ const a1Sorted = a1.sort();
+ const a2Sorted = a2.sort();
+
+ for (let i = 0; i < a1Sorted.length; ++i) {
+ if (a1Sorted[i] !== a2Sorted[i]) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// getFiltersFromSearchStr unmarshals the given search string from the URL
+// into an object
+export function getFiltersFromSearchStr(search: string): Filters {
+ const searchObj = parseSearchString(search);
+
+ let bookVal;
+ if (typeof searchObj.book === 'string') {
+ bookVal = [searchObj.book];
+ } else if (searchObj.book === undefined) {
+ bookVal = [];
+ } else {
+ bookVal = searchObj.book;
+ }
+
+ const ret: Filters = {
+ queries: {
+ q: searchObj.q || '',
+ book: bookVal
+ },
+ page: parseInt(searchObj.page, 10) || 1
+ };
+
+ return ret;
+}
+
+// checkFilterEqual checks that the two given filters are equal
+export function checkFilterEqual(a: Filters, b: Filters): boolean {
+ return (
+ a.page === b.page &&
+ a.queries.q === b.queries.q &&
+ compareBookArr(a.queries.book, b.queries.book)
+ );
+}
+
+// toSearchObj transforms the filters into a search obj to be marshaled to a URL search string
+export function toSearchObj(filters: Filters): any {
+ const ret: any = {};
+
+ const { queries } = filters;
+
+ if (filters.page) {
+ ret.page = filters.page;
+ }
+ if (queries.q !== '') {
+ ret.q = queries.q;
+ }
+ if (queries.book.length > 0) {
+ ret.book = queries.book;
+ }
+
+ return ret;
+}
diff --git a/jslib/src/helpers/http.ts b/jslib/src/helpers/http.ts
new file mode 100644
index 00000000..1134d98c
--- /dev/null
+++ b/jslib/src/helpers/http.ts
@@ -0,0 +1,135 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// module https.ts provides an interface to make HTTP requests and receive responses
+
+class ResponseError extends Error {
+ response: Response;
+}
+
+function checkStatus(response: Response): Response | Promise {
+ if (response.status >= 200 && response.status < 300) {
+ return response;
+ }
+
+ return response.text().then(body => {
+ const error = new ResponseError(body);
+ error.response = response;
+
+ throw error;
+ });
+}
+
+function parseJSON(response: Response): Promise {
+ if (response.headers.get('Content-Type') === 'application/json') {
+ return response.json() as Promise;
+ }
+
+ return Promise.resolve(null);
+}
+
+function request(path: string, options: RequestInit) {
+ return fetch(path, {
+ ...options
+ })
+ .then(checkStatus)
+ .then(res => {
+ return parseJSON(res);
+ });
+}
+
+function get(path: string, options = {}): Promise {
+ return request(path, {
+ method: 'GET',
+ ...options
+ });
+}
+
+function post(path: string, data: any, options = {}): Promise {
+ return request(path, {
+ method: 'POST',
+ body: JSON.stringify(data),
+ ...options
+ });
+}
+
+function patch(path: string, data: any, options = {}) {
+ return request(path, {
+ method: 'PATCH',
+ body: JSON.stringify(data),
+ ...options
+ });
+}
+
+function put(path: string, data: any, options = {}) {
+ return request(path, {
+ method: 'PUT',
+ body: JSON.stringify(data),
+ ...options
+ });
+}
+
+function del(path: string, data: any, options = {}) {
+ return request(path, {
+ method: 'DELETE',
+ body: JSON.stringify(data),
+ ...options
+ });
+}
+
+export interface HttpClientConfig {
+ pathPrefix: string;
+ baseUrl: string;
+}
+
+// getHttpClient returns an http client
+export function getHttpClient(c: HttpClientConfig) {
+ function transformPath(path: string): string {
+ let ret = path;
+
+ if (c.pathPrefix !== '') {
+ ret = `${c.pathPrefix}${ret}`;
+ }
+ if (c.baseUrl !== '') {
+ ret = `${c.baseUrl}${ret}`;
+ }
+
+ return ret;
+ }
+
+ return {
+ get: (path: string, options = {}) => {
+ return get(transformPath(path), options);
+ },
+ post: (path: string, data = {}, options = {}) => {
+ return post(transformPath(path), data, options).then(resp => {
+ console.log('check', resp);
+ return resp;
+ });
+ },
+ patch: (path: string, data, options = {}) => {
+ return patch(transformPath(path), data, options);
+ },
+ put: (path: string, data, options = {}) => {
+ return put(transformPath(path), data, options);
+ },
+ del: (path: string, data = {}, options = {}) => {
+ return del(transformPath(path), data, options);
+ }
+ };
+}
diff --git a/jslib/src/helpers/index.ts b/jslib/src/helpers/index.ts
new file mode 100644
index 00000000..f7c60a43
--- /dev/null
+++ b/jslib/src/helpers/index.ts
@@ -0,0 +1,37 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import * as BooksHelpers from './books';
+import * as FiltersHelpers from './filters';
+import * as HttpHelpers from './http';
+import * as ObjHelpers from './obj';
+import * as QueriesHelpers from './queries';
+import * as SearchHelpers from './search';
+import * as SelectHelpers from './select';
+import * as UrlHelpers from './url';
+
+export {
+ BooksHelpers,
+ FiltersHelpers,
+ HttpHelpers,
+ ObjHelpers,
+ QueriesHelpers,
+ SearchHelpers,
+ SelectHelpers,
+ UrlHelpers
+};
diff --git a/jslib/src/helpers/keyboard.ts b/jslib/src/helpers/keyboard.ts
new file mode 100644
index 00000000..59af8198
--- /dev/null
+++ b/jslib/src/helpers/keyboard.ts
@@ -0,0 +1,33 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export const KEYCODE_DOWN = 40;
+export const KEYCODE_UP = 38;
+export const KEYCODE_ENTER = 13;
+export const KEYCODE_ESC = 27;
+export const KEYCODE_SPACE = 32;
+export const KEYCODE_TAB = 9;
+export const KEYCODE_BACKSPACE = 8;
+
+// alphabet
+export const KEYCODE_LOWERCASE_B = 66;
+
+// isPrintableKey returns if the key represented in the given event is printable.
+export function isPrintableKey(e: KeyboardEvent) {
+ return e.key.length === 1;
+}
diff --git a/jslib/src/helpers/obj.ts b/jslib/src/helpers/obj.ts
new file mode 100644
index 00000000..886de4e7
--- /dev/null
+++ b/jslib/src/helpers/obj.ts
@@ -0,0 +1,67 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+type FilterFn = (val: any, key: any) => boolean;
+
+export function filterObjKeys(obj: object, filterFn: FilterFn) {
+ return Object.keys(obj)
+ .filter(key => {
+ const val = obj[key];
+ return filterFn(val, key);
+ })
+ .reduce((ret, key) => {
+ return {
+ ...ret,
+ [key]: obj[key]
+ };
+ }, {});
+}
+
+// whitelist returns a new object whose keys are whitelisted by the given array
+// of keys
+export function whitelist(obj, keys) {
+ return filterObjKeys(obj, (val, key) => {
+ return keys.indexOf(key) > -1;
+ });
+}
+
+// blacklist returns a new object where key-val pairs are filtered out by keys
+export function blacklist(obj, keys) {
+ return filterObjKeys(obj, (val, key) => {
+ return keys.indexOf(key) === -1;
+ });
+}
+
+// isEmptyObj checks that an object does not have any properties of its own
+export function isEmptyObj(obj) {
+ return Object.getOwnPropertyNames(obj).length === 0;
+}
+
+// removeKey returns a new object with the given key removed
+export function removeKey(obj: object, deleteKey: string) {
+ const keys = Object.keys(obj).filter(key => key !== deleteKey);
+
+ const ret = {};
+
+ for (let i = 0; i < keys.length; ++i) {
+ const key = keys[i];
+ ret[key] = obj[key];
+ }
+
+ return ret;
+}
diff --git a/jslib/src/helpers/perf.ts b/jslib/src/helpers/perf.ts
new file mode 100644
index 00000000..8889d0de
--- /dev/null
+++ b/jslib/src/helpers/perf.ts
@@ -0,0 +1,37 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export function debounce(func: Function, wait: number, immediate?: boolean) {
+ let timeout;
+
+ return (...args) => {
+ const later = () => {
+ timeout = null;
+ if (!immediate) func.apply(this, args);
+ };
+
+ const callNow = immediate && !timeout;
+
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+
+ if (callNow) {
+ func.apply(this, args);
+ }
+ };
+}
diff --git a/jslib/src/helpers/queries.ts b/jslib/src/helpers/queries.ts
new file mode 100644
index 00000000..ec7d21ce
--- /dev/null
+++ b/jslib/src/helpers/queries.ts
@@ -0,0 +1,80 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import * as searchLib from './search';
+
+export interface Queries {
+ q: string;
+ book: string[];
+}
+
+function encodeQuery(keyword: string, value: string): string {
+ return `${keyword}:${value}`;
+}
+
+export const keywordBook = 'book';
+
+export const keywords = [keywordBook];
+
+// parse unmarshals the given string represesntation of the queries into an object
+export function parse(s: string): Queries {
+ const result = searchLib.parse(s, keywords);
+
+ let bookValue: string[];
+ const { book } = result.filters;
+ if (!book) {
+ bookValue = [];
+ } else if (typeof book === 'string') {
+ bookValue = [book];
+ } else {
+ bookValue = book;
+ }
+
+ let qValue: string;
+ if (result.text) {
+ qValue = result.text;
+ } else {
+ qValue = '';
+ }
+
+ return {
+ q: qValue,
+ book: bookValue
+ };
+}
+
+// stringify marshals the givne queries into a string format
+export function stringify(queries: Queries): string {
+ let ret = '';
+
+ if (queries.book.length > 0) {
+ for (let i = 0; i < queries.book.length; i++) {
+ const book = queries.book[i];
+
+ ret += encodeQuery(keywordBook, book);
+ ret += ' ';
+ }
+ }
+
+ if (queries.q !== '') {
+ const result = searchLib.parse(queries.q, keywords);
+ ret += result.text;
+ }
+
+ return ret;
+}
diff --git a/jslib/src/helpers/search.spec.ts b/jslib/src/helpers/search.spec.ts
new file mode 100644
index 00000000..b6c28f16
--- /dev/null
+++ b/jslib/src/helpers/search.spec.ts
@@ -0,0 +1,455 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { TokenKind, tokenize, parse } from './search';
+
+describe('search.ts', () => {
+ describe('tokenize', () => {
+ const testCases = [
+ {
+ input: 'foo',
+ tokens: [
+ {
+ kind: TokenKind.id,
+ value: 'foo'
+ },
+ {
+ kind: TokenKind.eof
+ }
+ ]
+ },
+ {
+ input: '123',
+ tokens: [
+ {
+ kind: TokenKind.id,
+ value: '123'
+ },
+ {
+ kind: TokenKind.eof
+ }
+ ]
+ },
+ {
+ input: 'foo123',
+ tokens: [
+ {
+ kind: TokenKind.id,
+ value: 'foo123'
+ },
+ {
+ kind: TokenKind.eof
+ }
+ ]
+ },
+ {
+ input: 'foo\tbar',
+ tokens: [
+ {
+ kind: TokenKind.id,
+ value: 'foo'
+ },
+ {
+ kind: TokenKind.id,
+ value: 'bar'
+ },
+ {
+ kind: TokenKind.eof
+ }
+ ]
+ },
+ {
+ input: ' foo \tbar\t',
+ tokens: [
+ {
+ kind: TokenKind.id,
+ value: 'foo'
+ },
+ {
+ kind: TokenKind.id,
+ value: 'bar'
+ },
+ {
+ kind: TokenKind.eof
+ }
+ ]
+ },
+ {
+ input: 'foo:bar',
+ tokens: [
+ {
+ kind: TokenKind.id,
+ value: 'foo'
+ },
+ {
+ kind: TokenKind.colon
+ },
+ {
+ kind: TokenKind.id,
+ value: 'bar'
+ },
+ {
+ kind: TokenKind.eof
+ }
+ ]
+ },
+ {
+ input: '"foo" bar',
+ tokens: [
+ {
+ kind: TokenKind.id,
+ value: '"foo"'
+ },
+ {
+ kind: TokenKind.id,
+ value: 'bar'
+ },
+ {
+ kind: TokenKind.eof
+ }
+ ]
+ },
+ {
+ input: '"foo:bar"',
+ tokens: [
+ {
+ kind: TokenKind.id,
+ value: '"foo'
+ },
+ {
+ kind: TokenKind.colon
+ },
+ {
+ kind: TokenKind.id,
+ value: 'bar"'
+ },
+ {
+ kind: TokenKind.eof
+ }
+ ]
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; i++) {
+ const tc = testCases[i];
+
+ test(`tokenizes ${tc.input}`, () => {
+ const result = tokenize(tc.input);
+
+ expect(result).toEqual(tc.tokens);
+ });
+ }
+ });
+
+ describe('parse', () => {
+ function run(testCases) {
+ for (let i = 0; i < testCases.length; i++) {
+ const tc = testCases[i];
+
+ test(`keyword [${tc.keywords}] - parses ${tc.input} `, () => {
+ const result = parse(tc.input, tc.keywords);
+
+ expect(result).toEqual(tc.result);
+ });
+ }
+ }
+
+ describe('text only', () => {
+ const testCases = [
+ {
+ input: 'foo',
+ keywords: [],
+ result: {
+ text: 'foo',
+ filters: {}
+ }
+ },
+ {
+ input: '123',
+ keywords: [],
+ result: {
+ text: '123',
+ filters: {}
+ }
+ },
+ {
+ input: 'foo123',
+ keywords: [],
+ result: {
+ text: 'foo123',
+ filters: {}
+ }
+ },
+ {
+ input: '"',
+ keywords: [],
+ result: {
+ text: '"',
+ filters: {}
+ }
+ },
+ {
+ input: '""',
+ keywords: [],
+ result: {
+ text: '""',
+ filters: {}
+ }
+ },
+ {
+ input: `'`,
+ keywords: [],
+ result: {
+ text: `'`,
+ filters: {}
+ }
+ },
+ {
+ input: `''`,
+ keywords: [],
+ result: {
+ text: `''`,
+ filters: {}
+ }
+ },
+ {
+ input: `'foo:bar'`,
+ keywords: [],
+ result: {
+ text: `'foo:bar'`,
+ filters: {}
+ }
+ },
+ {
+ input: 'foo bar',
+ keywords: [],
+ result: {
+ text: 'foo bar',
+ filters: {}
+ }
+ },
+ {
+ input: ' foo \t bar ',
+ keywords: [],
+ result: {
+ text: 'foo bar',
+ filters: {}
+ }
+ },
+ {
+ input: '"foo:bar"',
+ keywords: ['foo'],
+ result: {
+ text: '"foo:bar"',
+ filters: {}
+ }
+ },
+ {
+ input: '"foo:bar""',
+ keywords: ['foo'],
+ result: {
+ text: '"foo:bar""',
+ filters: {}
+ }
+ },
+ {
+ input: '"foo:bar""""',
+ keywords: ['foo'],
+ result: {
+ text: '"foo:bar""""',
+ filters: {}
+ }
+ }
+ ];
+
+ run(testCases);
+ });
+
+ describe('filter only', () => {
+ const testCases = [
+ {
+ input: 'foo:bar',
+ keywords: ['foo'],
+ result: {
+ text: '',
+ filters: {
+ foo: 'bar'
+ }
+ }
+ },
+ {
+ input: '123:bar',
+ keywords: ['123'],
+ result: {
+ text: '',
+ filters: {
+ '123': 'bar'
+ }
+ }
+ },
+ {
+ input: 'foo123:bar',
+ keywords: ['foo123'],
+ result: {
+ text: '',
+ filters: {
+ foo123: 'bar'
+ }
+ }
+ },
+ {
+ input: '123:456',
+ keywords: ['123'],
+ result: {
+ text: '',
+ filters: {
+ '123': '456'
+ }
+ }
+ },
+ {
+ input: 'foo:bar baz:quz 123:qux',
+ keywords: ['foo'],
+ result: {
+ text: 'baz:quz 123:qux',
+ filters: {
+ foo: 'bar'
+ }
+ }
+ },
+ {
+ input: 'foo:bar baz:quz',
+ keywords: ['foo'],
+ result: {
+ text: 'baz:quz',
+ filters: {
+ foo: 'bar'
+ }
+ }
+ },
+ {
+ input: 'foo:bar baz:quz',
+ keywords: ['bar'],
+ result: {
+ text: 'foo:bar baz:quz',
+ filters: {}
+ }
+ },
+ {
+ input: 'foo:bar baz:quz',
+ keywords: ['foo', 'baz'],
+ result: {
+ text: '',
+ filters: {
+ foo: 'bar',
+ baz: 'quz'
+ }
+ }
+ },
+ {
+ input: 'foo:bar',
+ keywords: [],
+ result: {
+ text: 'foo:bar',
+ filters: {}
+ }
+ },
+ {
+ input: 'foo:bar baz:quz',
+ keywords: [],
+ result: {
+ text: 'foo:bar baz:quz',
+ filters: {}
+ }
+ },
+ {
+ input: 'foo:bar foo:baz',
+ keywords: ['foo'],
+ result: {
+ text: '',
+ filters: {
+ foo: ['bar', 'baz']
+ }
+ }
+ }
+ ];
+
+ run(testCases);
+ });
+
+ describe('text and filter', () => {
+ const testCases = [
+ {
+ input: 'foo:bar baz',
+ keywords: ['foo'],
+ result: {
+ text: 'baz',
+ filters: {
+ foo: 'bar'
+ }
+ }
+ },
+ {
+ input: 'foo:bar baz quz:qux1 ',
+ keywords: ['foo', 'quz'],
+ result: {
+ text: 'baz',
+ filters: {
+ foo: 'bar',
+ quz: 'qux1'
+ }
+ }
+ },
+ {
+ input: 'foo:bar baz quz:qux1 qux',
+ keywords: ['foo', 'quz'],
+ result: {
+ text: 'baz qux',
+ filters: {
+ foo: 'bar',
+ quz: 'qux1'
+ }
+ }
+ },
+ {
+ input: 'foo:bar baz quz:qux1 qux "quux:fooz"',
+ keywords: ['foo', 'quz'],
+ result: {
+ text: 'baz qux "quux:fooz"',
+ filters: {
+ foo: 'bar',
+ quz: 'qux1'
+ }
+ }
+ },
+ {
+ input: 'foo:bar baz quz:qux1 qux "quux:fooz"',
+ keywords: ['foo', 'quux'],
+ result: {
+ text: 'baz quz:qux1 qux "quux:fooz"',
+ filters: {
+ foo: 'bar'
+ }
+ }
+ }
+ ];
+
+ run(testCases);
+ });
+ });
+});
diff --git a/jslib/src/helpers/search.ts b/jslib/src/helpers/search.ts
new file mode 100644
index 00000000..a34b8eb4
--- /dev/null
+++ b/jslib/src/helpers/search.ts
@@ -0,0 +1,280 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export enum TokenKind {
+ colon = 'COLON',
+ id = 'ID',
+ eof = 'EOF'
+}
+
+interface Token {
+ kind: TokenKind;
+ value?: string;
+}
+
+export enum NodeKind {
+ text = 'text',
+ filter = 'filter'
+}
+
+interface TextNode {
+ kind: NodeKind.text;
+ value: string;
+}
+
+interface FilterNode {
+ kind: NodeKind.filter;
+ keyword: string;
+ value: string;
+}
+
+type Node = TextNode | FilterNode;
+
+function nodeToString(node: Node): string {
+ if (node.kind === NodeKind.text) {
+ return node.value;
+ }
+ if (node.kind === NodeKind.filter) {
+ return `${node.keyword}:${node.value}`;
+ }
+
+ throw new Error('unknown node kind');
+}
+
+const whitespaceRegex = /^\s*$/;
+const charRegex = /^((?![\s:]).)*$/;
+
+function isSpace(c: string): boolean {
+ return whitespaceRegex.test(c);
+}
+
+function isChar(c: string): boolean {
+ return charRegex.test(c);
+}
+
+export function tokenize(s: string): Token[] {
+ const ret: Token[] = [];
+ let cursor = 0;
+
+ function colon() {
+ ret.push({ kind: TokenKind.colon });
+ cursor++;
+ }
+ function id() {
+ let text = '';
+ while (cursor <= s.length - 1 && isChar(s[cursor])) {
+ text += s[cursor];
+ cursor++;
+ }
+
+ ret.push({ kind: TokenKind.id, value: text });
+ }
+
+ while (cursor <= s.length - 1) {
+ const currentChar = s[cursor];
+
+ if (isSpace(currentChar)) {
+ cursor++;
+ } else if (currentChar === ':') {
+ colon();
+ } else if (isChar(currentChar)) {
+ id();
+ } else {
+ throw new Error(`invalid character ${currentChar}`);
+ }
+ }
+
+ ret.push({ kind: TokenKind.eof });
+
+ return ret;
+}
+
+class Parser {
+ toks: Token[];
+ cursor: number;
+ currentToken: Token;
+
+ constructor(s: string) {
+ this.toks = tokenize(s);
+ this.cursor = 0;
+ }
+
+ do(): Node[] {
+ /*
+ * expr: term (term)*
+ *
+ * term: filter | text
+ *
+ * filter: text COLON text
+ *
+ * text: ID | EOF
+ */
+ return this.expr();
+ }
+
+ eat(kind: TokenKind) {
+ const currentToken = this.getCurrentToken();
+
+ if (currentToken.kind !== kind) {
+ throw new Error(
+ `invalid syntax. Expected ${kind} got: ${currentToken.kind}`
+ );
+ }
+
+ this.cursor++;
+ }
+
+ getCurrentToken() {
+ return this.toks[this.cursor];
+ }
+
+ expr(): Node[] {
+ const nodes: Node[] = [];
+
+ while (this.getCurrentToken().kind !== TokenKind.eof) {
+ const n = this.term();
+ nodes.push(n);
+ }
+
+ return nodes;
+ }
+
+ term(): Node | null {
+ // try to parse filter and backtrack if not match
+ const n = this.filter();
+ if (n !== null) {
+ return n;
+ }
+
+ return this.str();
+ }
+
+ filter(): Node | null {
+ // save the current cursor for backtracking
+ const cursor = this.cursor;
+
+ const keyword = this.text({ maybe: true });
+ if (keyword === null) {
+ this.cursor = cursor;
+ return null;
+ }
+ if (this.getCurrentToken().kind === TokenKind.colon) {
+ this.eat(TokenKind.colon);
+ } else {
+ this.cursor = cursor;
+ return null;
+ }
+ const value = this.text({ maybe: true });
+ if (value === null) {
+ this.cursor = cursor;
+ return null;
+ }
+
+ return {
+ kind: NodeKind.filter,
+ keyword,
+ value
+ };
+ }
+
+ str(): Node | null {
+ const value = this.text();
+ if (value === null) {
+ return null;
+ }
+
+ return {
+ kind: NodeKind.text,
+ value
+ };
+ }
+
+ // text parses and returns a text. If 'maybe' option is true, it returns null
+ // if the current token cannot be parsed as a text (such scenario can happen when
+ // backtracking)
+ text(opts = { maybe: false }): string | null {
+ const currentToken = this.getCurrentToken();
+
+ if (currentToken.kind === TokenKind.eof) {
+ return null;
+ }
+
+ if (opts.maybe) {
+ if (currentToken.kind !== TokenKind.id) {
+ return null;
+ }
+ }
+
+ this.eat(TokenKind.id);
+
+ return currentToken.value;
+ }
+}
+
+interface Search {
+ text: string;
+ filters: {
+ [key: string]: string | string[];
+ };
+}
+
+export function parse(s: string, keywords: string[]): Search {
+ const p = new Parser(s);
+
+ const ret: Search = {
+ text: '',
+ filters: {}
+ };
+
+ function addText(t: string) {
+ if (ret.text !== '') {
+ ret.text += ' ';
+ }
+ ret.text += t;
+ }
+
+ function addFilter(key: string, val: string) {
+ const currentVal = ret.filters[key];
+
+ if (typeof currentVal === 'undefined') {
+ ret.filters[key] = val;
+ } else if (typeof currentVal === 'string') {
+ ret.filters[key] = [currentVal, val];
+ } else {
+ ret.filters[key] = [...currentVal, val];
+ }
+ }
+
+ const nodes = p.do();
+ for (let i = 0; i < nodes.length; i++) {
+ const n = nodes[i];
+
+ if (n.kind === NodeKind.text) {
+ addText(n.value);
+ } else if (n.kind === NodeKind.filter) {
+ // if keyword was not specified, treat as a text
+ if (keywords.indexOf(n.keyword) > -1) {
+ addFilter(n.keyword, n.value);
+ } else {
+ addText(nodeToString(n));
+ }
+ }
+ }
+
+ return ret;
+}
diff --git a/jslib/src/helpers/select.ts b/jslib/src/helpers/select.ts
new file mode 100644
index 00000000..acc9e8ee
--- /dev/null
+++ b/jslib/src/helpers/select.ts
@@ -0,0 +1,80 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { BookData } from '../operations/types';
+
+// Option represents an option in a selection list
+export interface Option {
+ label: string;
+ value: string;
+}
+
+// optionValueCreate is the value of the option for creating a new option
+export const optionValueCreate = 'create-new-option';
+
+// filterOptions returns a new array of options based on the given filter criteria
+export function filterOptions(
+ options: Option[],
+ term: string,
+ creatable: boolean
+): Option[] {
+ if (!term) {
+ return options;
+ }
+
+ const ret = [];
+ const searchReg = new RegExp(`${term}`, 'i');
+ let hit = null;
+
+ for (let i = 0; i < options.length; i++) {
+ const option = options[i];
+
+ if (option.label === term) {
+ hit = option;
+ } else if (searchReg.test(option.label) && option.value !== '') {
+ ret.push(option);
+ }
+ }
+
+ // if there is an exact match, display the option at the top
+ // otherwise, display a creatable option at the bottom
+ if (hit) {
+ ret.unshift(hit);
+ } else if (creatable) {
+ // creatable option has a value of an empty string
+ ret.push({ label: term, value: '' });
+ }
+
+ return ret;
+}
+
+// booksToOptions returns an array of options for select ui, given an array of books
+export function booksToOptions(books: BookData[]): Option[] {
+ const ret = [];
+
+ for (let i = 0; i < books.length; ++i) {
+ const book = books[i];
+
+ ret.push({
+ label: book.label,
+ value: book.uuid
+ });
+ }
+
+ return ret;
+}
diff --git a/jslib/src/helpers/url.ts b/jslib/src/helpers/url.ts
new file mode 100644
index 00000000..ef93cee0
--- /dev/null
+++ b/jslib/src/helpers/url.ts
@@ -0,0 +1,145 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import qs from 'qs';
+import isArray from 'lodash/isArray';
+import omitBy from 'lodash/omitBy';
+import { Location } from 'history';
+
+// getPath returns a path optionally suffixed by query string
+export function getPath(path, queryObj): string {
+ const queryStr = qs.stringify(queryObj, { arrayFormat: 'repeat' });
+
+ if (!queryStr) {
+ return path;
+ }
+
+ return `${path}?${queryStr}`;
+}
+
+// getPathFromLocation returns a full path based on the location object used by
+// React Router
+export function getPathFromLocation(location): string {
+ const { pathname, search } = location;
+
+ return `${pathname}${search}`;
+}
+
+// parseSearchString parses the 'search' string in `location` object provided
+// by React Router.
+export function parseSearchString(search: string): any {
+ if (!search || search === '') {
+ return {};
+ }
+
+ // drop the leading '?'
+ const queryStr = search.substring(1);
+ return qs.parse(queryStr);
+}
+
+// addQueryToLocation returns a new location object for react-router given the
+// new `queryKey` and `val` to be set in loation.query.
+// If there exists the given key in the query object, addQueryToLocation sets its
+// value to be an array containing the old value and the new value.
+// Otherwise the value for the key is set to the `val`.
+export function addQueryToLocation(
+ location: Location,
+ queryKey: string,
+ val: string,
+ override = true
+): Location {
+ const queryObj = parseSearchString(location.search);
+ const existingParam = queryObj[queryKey];
+
+ let updatedQueryVal;
+ if (existingParam && !override) {
+ if (isArray(existingParam)) {
+ updatedQueryVal = [...existingParam, val];
+ } else {
+ updatedQueryVal = [existingParam, val];
+ }
+ } else {
+ updatedQueryVal = val;
+ }
+
+ const newQueryObj = {
+ ...queryObj,
+ [queryKey]: updatedQueryVal
+ };
+
+ return {
+ ...location,
+ search: `?${qs.stringify(newQueryObj)}`
+ };
+}
+
+// removeQueryFromLocation returns a new location object without the queryKey
+// and val
+export function removeQueryFromLocation(
+ location: Location,
+ queryKey: string,
+ val?: string
+): Location {
+ const queryObj = parseSearchString(location.search);
+ const existingParam = queryObj[queryKey];
+ if (!existingParam) {
+ return location;
+ }
+
+ let newQueryObj;
+ if (val === undefined) {
+ newQueryObj = omitBy(queryObj, (v, k) => k === queryKey);
+ } else {
+ const queryVal = val.toString(); // stringify because query params only store string
+
+ if (isArray(existingParam)) {
+ const updatedQueryVal = existingParam.filter(elm => elm !== queryVal);
+ newQueryObj = {
+ ...queryObj,
+ [queryKey]: updatedQueryVal
+ };
+ } else {
+ newQueryObj = omitBy(
+ queryObj,
+ (v, k) => k === queryKey && queryVal === v
+ );
+ }
+ }
+
+ return {
+ ...location,
+ search: `?${qs.stringify(newQueryObj)}`
+ };
+}
+
+export function getReferrer(location: Location): string {
+ const queryObj = parseSearchString(location.search);
+ const { referrer } = queryObj;
+
+ if (referrer) {
+ return decodeURIComponent(referrer);
+ }
+
+ const s = location.state as any;
+
+ if (s && s.referrer) {
+ return s.referrer;
+ }
+
+ return '';
+}
diff --git a/jslib/src/index.ts b/jslib/src/index.ts
new file mode 100644
index 00000000..07df74b8
--- /dev/null
+++ b/jslib/src/index.ts
@@ -0,0 +1,22 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import * as Helpers from './helpers';
+import * as Operations from './helpers';
+
+export { Helpers, Operations };
diff --git a/jslib/src/operations/books.ts b/jslib/src/operations/books.ts
new file mode 100644
index 00000000..1f955de5
--- /dev/null
+++ b/jslib/src/operations/books.ts
@@ -0,0 +1,52 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import initBooksService from '../services/books';
+import { HttpClientConfig } from '../helpers/http';
+import { BookData } from './types';
+
+export interface CreateParams {
+ name: string;
+}
+
+export default function init(c: HttpClientConfig) {
+ const booksService = initBooksService(c);
+
+ return {
+ get: (bookUUID: string) => {
+ return booksService.get(bookUUID);
+ },
+
+ // create creates an encrypted book. It returns a promise that resolves with
+ // a decrypted book.
+ create: (payload: CreateParams): Promise => {
+ return booksService.create(payload).then(res => {
+ return res.book;
+ });
+ },
+
+ fetch: (params = {}) => {
+ return booksService.fetch(params);
+ },
+
+ // remove deletes the book with the given uuid
+ remove: (bookUUID: string) => {
+ return booksService.remove(bookUUID);
+ }
+ };
+}
diff --git a/jslib/src/operations/docs.ts b/jslib/src/operations/docs.ts
new file mode 100644
index 00000000..49d8965c
--- /dev/null
+++ b/jslib/src/operations/docs.ts
@@ -0,0 +1,20 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// This module provides interfaces to perform operations. It abstarcts
+// the backend implementation and thus unifies the API for different clients.
diff --git a/jslib/src/operations/index.ts b/jslib/src/operations/index.ts
new file mode 100644
index 00000000..7a13f93f
--- /dev/null
+++ b/jslib/src/operations/index.ts
@@ -0,0 +1,33 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { HttpClientConfig } from '../helpers/http';
+import initBooksOperation from './books';
+import initNotesOperation from './notes';
+
+// init initializes operations with the given http configuration
+// and returns an object of all services.
+export default function initOperations(c: HttpClientConfig) {
+ const booksOperation = initBooksOperation(c);
+ const notesOperation = initNotesOperation(c);
+
+ return {
+ books: booksOperation,
+ notes: notesOperation
+ };
+}
diff --git a/jslib/src/operations/notes.ts b/jslib/src/operations/notes.ts
new file mode 100644
index 00000000..8e7b03e8
--- /dev/null
+++ b/jslib/src/operations/notes.ts
@@ -0,0 +1,65 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import initNotesService from '../services/notes';
+import { HttpClientConfig } from '../helpers/http';
+import { NoteData } from './types';
+import { Filters } from '../helpers/filters';
+
+export interface FetchOneParams {
+ q?: string;
+}
+
+export interface CreateParams {
+ bookUUID: string;
+ content: string;
+}
+
+export interface UpdateParams {
+ book_uuid?: string;
+ content?: string;
+ public?: boolean;
+}
+
+export default function init(c: HttpClientConfig) {
+ const notesService = initNotesService(c);
+
+ return {
+ fetch: (params: Filters) => {
+ return notesService.fetch(params);
+ },
+
+ fetchOne: (noteUUID: string, params: FetchOneParams = {}) => {
+ return notesService.fetchOne(noteUUID, params);
+ },
+
+ create: ({ bookUUID, content }: CreateParams) => {
+ return notesService.create({ book_uuid: bookUUID, content });
+ },
+
+ update: (noteUUID: string, input: UpdateParams): Promise => {
+ return notesService.update(noteUUID, input).then(res => {
+ return res.result;
+ });
+ },
+
+ remove: noteUUID => {
+ return notesService.remove(noteUUID);
+ }
+ };
+}
diff --git a/jslib/src/operations/types.ts b/jslib/src/operations/types.ts
new file mode 100644
index 00000000..9a26d0a8
--- /dev/null
+++ b/jslib/src/operations/types.ts
@@ -0,0 +1,57 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// NoteData represents a data for a note as returned by services.
+// The response from services need to conform to this interface.
+export interface NoteData {
+ uuid: string;
+ createdAt: string;
+ updatedAt: string;
+ content: string;
+ addedOn: number;
+ public: boolean;
+ usn: number;
+ book: {
+ uuid: string;
+ label: string;
+ };
+ user: {
+ name: string;
+ uuid: string;
+ };
+}
+
+export interface EmailPrefData {
+ inactiveReminder: boolean;
+ productUpdate: boolean;
+}
+
+export interface UserData {
+ uuid: string;
+ email: string;
+ emailVerified: boolean;
+ pro: boolean;
+}
+
+export type BookData = {
+ uuid: string;
+ usn: number;
+ created_at: string;
+ updated_at: string;
+ label: string;
+};
diff --git a/jslib/src/services/books.ts b/jslib/src/services/books.ts
new file mode 100644
index 00000000..1940f04a
--- /dev/null
+++ b/jslib/src/services/books.ts
@@ -0,0 +1,81 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import qs from 'qs';
+import { getHttpClient, HttpClientConfig } from '../helpers/http';
+
+export interface BookFetchParams {
+ name?: string;
+ encrypted?: boolean;
+}
+
+export interface CreateParams {
+ name: string;
+}
+
+export interface CreatePayload {
+ book: {
+ uuid: string;
+ usn: number;
+ created_at: string;
+ updated_at: string;
+ label: string;
+ };
+}
+
+// TODO: type
+type updateParams = any;
+
+export default function init(config: HttpClientConfig) {
+ const client = getHttpClient(config);
+
+ return {
+ fetch: (queryObj: BookFetchParams = {}, opts = {}) => {
+ const baseURL = '/v3/books';
+
+ const queryStr = qs.stringify(queryObj);
+
+ let endpoint;
+ if (queryStr) {
+ endpoint = `${baseURL}?${queryStr}`;
+ } else {
+ endpoint = baseURL;
+ }
+
+ return client.get(endpoint, opts);
+ },
+
+ create: (payload: CreateParams, opts = {}) => {
+ return client.post('/v3/books', payload, opts);
+ },
+
+ remove: (uuid: string) => {
+ return client.del(`/v3/books/${uuid}`);
+ },
+
+ update: (uuid: string, payload: updateParams) => {
+ return client.patch(`/v3/books/${uuid}`, payload);
+ },
+
+ get: (bookUUID: string) => {
+ const endpoint = `/v3/books/${bookUUID}`;
+
+ return client.get(endpoint);
+ }
+ };
+}
diff --git a/jslib/src/services/index.ts b/jslib/src/services/index.ts
new file mode 100644
index 00000000..ec403fcc
--- /dev/null
+++ b/jslib/src/services/index.ts
@@ -0,0 +1,36 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { HttpClientConfig } from '../helpers/http';
+import initUsersService from './users';
+import initBooksService from './books';
+import initNotesService from './notes';
+
+// init initializes service helpers with the given http configuration
+// and returns an object of all services.
+export default function initServices(c: HttpClientConfig) {
+ const usersService = initUsersService(c);
+ const booksService = initBooksService(c);
+ const notesService = initNotesService(c);
+
+ return {
+ users: usersService,
+ books: booksService,
+ notes: notesService
+ };
+}
diff --git a/jslib/src/services/notes.ts b/jslib/src/services/notes.ts
new file mode 100644
index 00000000..08da0f9a
--- /dev/null
+++ b/jslib/src/services/notes.ts
@@ -0,0 +1,177 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { getPath } from '../helpers/url';
+import { getHttpClient, HttpClientConfig } from '../helpers/http';
+import { NoteData } from '../operations/types';
+import { Filters } from '../helpers/filters';
+
+export interface PresentedNote {
+ uuid: string;
+ content: string;
+ updated_at: string;
+ created_at: string;
+ user: {
+ name: '';
+ uuid: '';
+ };
+ public: boolean;
+ book: {
+ label: '';
+ uuid: '';
+ };
+ usn: number;
+ added_on: number;
+}
+
+export function mapNote(item: PresentedNote): NoteData {
+ return {
+ uuid: item.uuid,
+ content: item.content,
+ createdAt: item.created_at,
+ updatedAt: item.updated_at,
+ public: item.public,
+ user: {
+ name: item.user.name,
+ uuid: item.user.uuid
+ },
+ book: {
+ label: item.book.label,
+ uuid: item.book.uuid
+ },
+ usn: item.usn,
+ addedOn: item.added_on
+ };
+}
+
+export interface CreateParams {
+ book_uuid: string;
+ content: string;
+}
+
+export interface CreateResponse {
+ result: PresentedNote;
+}
+
+export interface CreateResult {
+ result: NoteData;
+}
+
+export interface UpdateParams {
+ book_uuid?: string;
+ content?: string;
+ public?: boolean;
+}
+
+export interface UpdateResponse {
+ status: number;
+ result: PresentedNote;
+}
+
+export interface UpdateResult {
+ status: number;
+ result: NoteData;
+}
+
+export interface FetchResponse {
+ notes: PresentedNote[];
+ total: number;
+}
+
+export interface FetchResult {
+ notes: NoteData[];
+ total: number;
+}
+
+export interface FetchOneQuery {
+ q?: string;
+}
+
+type FetchOneResponse = PresentedNote;
+type FetchOneResult = NoteData;
+
+export default function init(config: HttpClientConfig) {
+ const client = getHttpClient(config);
+
+ return {
+ create: (params: CreateParams, opts = {}): Promise => {
+ return client
+ .post('/v3/notes', params, opts)
+ .then(res => {
+ return {
+ result: mapNote(res.result)
+ };
+ });
+ },
+
+ update: (noteUUID: string, params: UpdateParams): Promise => {
+ const endpoint = `/v3/notes/${noteUUID}`;
+
+ return client.patch(endpoint, params).then(res => {
+ return {
+ status: res.status,
+ result: mapNote(res.result)
+ };
+ });
+ },
+
+ remove: (noteUUID: string) => {
+ const endpoint = `/v3/notes/${noteUUID}`;
+
+ return client.del(endpoint, {});
+ },
+
+ fetch: (filters: Filters): Promise => {
+ const params: any = {
+ page: filters.page
+ };
+
+ const { queries } = filters;
+ if (queries.q) {
+ params.q = queries.q;
+ }
+ if (queries.book) {
+ params.book = queries.book;
+ }
+
+ const endpoint = getPath('/notes', params);
+
+ return client.get(endpoint, {}).then(res => {
+ return {
+ total: res.total,
+ notes: res.notes.map(mapNote)
+ };
+ });
+ },
+
+ fetchOne: (
+ noteUUID: string,
+ params: FetchOneQuery
+ ): Promise => {
+ const endpoint = getPath(`/notes/${noteUUID}`, params);
+
+ return client.get(endpoint, {}).then(mapNote);
+ },
+
+ classicFetch: () => {
+ const endpoint = '/classic/notes';
+
+ return client.get(endpoint, { credentials: 'include' });
+ }
+ };
+}
diff --git a/jslib/src/services/types.ts b/jslib/src/services/types.ts
new file mode 100644
index 00000000..c9532a27
--- /dev/null
+++ b/jslib/src/services/types.ts
@@ -0,0 +1,22 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// Config is the configuration for the services
+export interface Config {
+ baseUrl: string;
+}
diff --git a/jslib/src/services/users.ts b/jslib/src/services/users.ts
new file mode 100644
index 00000000..ed2cd0c6
--- /dev/null
+++ b/jslib/src/services/users.ts
@@ -0,0 +1,212 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { getHttpClient, HttpClientConfig } from '../helpers/http';
+import { EmailPrefData, UserData } from '../operations/types';
+
+export interface UpdateProfileParams {
+ email: string;
+ password: string;
+}
+
+export interface UpdatePasswordParams {
+ oldPassword: string;
+ newPassword: string;
+}
+
+export interface RegisterParams {
+ email: string;
+ password: string;
+}
+
+export interface SigninParams {
+ email: string;
+ password: string;
+}
+
+export interface SigninResponse {
+ key: string;
+ expires_at: number;
+}
+
+export interface GetEmailPreferenceParams {
+ // if not logged in, users can optionally make an authenticated request using a token
+ token?: string;
+}
+
+export interface GetEmailPreferenceResponse {
+ inactive_reminder: boolean;
+ product_update: boolean;
+}
+
+export interface UpdateEmailPreferenceParams {
+ token?: string;
+ inactiveReminder?: boolean;
+ productUpdate?: boolean;
+}
+
+export interface ResetPasswordParams {
+ token: string;
+ password: string;
+}
+
+export interface GetMeResponse {
+ user: {
+ uuid: string;
+ email: string;
+ email_verified: boolean;
+ pro: boolean;
+ };
+}
+
+export default function init(config: HttpClientConfig) {
+ const client = getHttpClient(config);
+
+ return {
+ updateUser: ({ name }) => {
+ const payload = { name };
+
+ return client.patch('/account/profile', payload);
+ },
+
+ updateProfile: ({ email, password }: UpdateProfileParams) => {
+ const payload = {
+ email,
+ password
+ };
+
+ return client.patch('/account/profile', payload);
+ },
+
+ updatePassword: ({ oldPassword, newPassword }: UpdatePasswordParams) => {
+ const payload = {
+ old_password: oldPassword,
+ new_password: newPassword
+ };
+
+ return client.patch('/account/password', payload);
+ },
+
+ register: (params: RegisterParams) => {
+ const payload = {
+ email: params.email,
+ password: params.password
+ };
+
+ return client.post('/v3/register', payload);
+ },
+
+ signin: (params: SigninParams) => {
+ const payload = {
+ email: params.email,
+ password: params.password
+ };
+
+ return client.post('/v3/signin', payload).then(resp => {
+ return {
+ key: resp.key,
+ expiresAt: resp.expires_at
+ };
+ });
+ },
+
+ signout: () => {
+ return client.post('/v3/signout');
+ },
+
+ sendResetPasswordEmail: ({ email }) => {
+ const payload = { email };
+
+ return client.post('/reset-token', payload);
+ },
+
+ sendEmailVerificationEmail: () => {
+ return client.post('/verification-token');
+ },
+
+ verifyEmail: ({ token }) => {
+ const payload = { token };
+
+ return client.patch('/verify-email', payload);
+ },
+
+ updateEmailPreference: ({
+ token,
+ inactiveReminder,
+ productUpdate
+ }: UpdateEmailPreferenceParams): Promise => {
+ const payload: any = {};
+
+ if (inactiveReminder !== undefined) {
+ payload.inactive_reminder = inactiveReminder;
+ }
+ if (productUpdate !== undefined) {
+ payload.product_update = productUpdate;
+ }
+
+ let endpoint = '/account/email-preference';
+ if (token) {
+ endpoint = `${endpoint}?token=${token}`;
+ }
+
+ return client
+ .patch(endpoint, payload)
+ .then(res => {
+ return {
+ inactiveReminder: res.inactive_reminder,
+ productUpdate: res.product_update
+ };
+ });
+ },
+
+ getEmailPreference: ({
+ token
+ }: GetEmailPreferenceParams): Promise => {
+ let endpoint = '/account/email-preference';
+ if (token) {
+ endpoint = `${endpoint}?token=${token}`;
+ }
+
+ return client.get(endpoint).then(res => {
+ return {
+ inactiveReminder: res.inactive_reminder,
+ productUpdate: res.product_update
+ };
+ });
+ },
+
+ getMe: (): Promise => {
+ return client.get('/me').then(res => {
+ const { user } = res;
+
+ return {
+ uuid: user.uuid,
+ email: user.email,
+ emailVerified: user.email_verified,
+ pro: user.pro
+ };
+ });
+ },
+
+ resetPassword: ({ token, password }: ResetPasswordParams) => {
+ const payload = { token, password };
+
+ return client.patch('/reset-password', payload);
+ }
+ };
+}
diff --git a/jslib/tsconfig.json b/jslib/tsconfig.json
new file mode 100644
index 00000000..cb7d0f64
--- /dev/null
+++ b/jslib/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "compilerOptions": {
+ "sourceMap": true,
+ "noImplicitAny": false,
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "target": "es6",
+ "jsx": "react",
+ "esModuleInterop": true,
+ "outDir": "dist",
+ "declaration": true,
+ "declarationDir": "dist/types"
+ }
+}
diff --git a/licenses/AGPLv3.txt b/licenses/AGPLv3.txt
new file mode 100644
index 00000000..0ad25db4
--- /dev/null
+++ b/licenses/AGPLv3.txt
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+ .
diff --git a/licenses/GPLv3.txt b/licenses/GPLv3.txt
new file mode 100644
index 00000000..f288702d
--- /dev/null
+++ b/licenses/GPLv3.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+ .
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 00000000..c931f6b4
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,2285 @@
+{
+ "name": "dnote",
+ "version": "0.1.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.5.5",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
+ "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.0.0"
+ }
+ },
+ "@babel/generator": {
+ "version": "7.9.0",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.0.tgz",
+ "integrity": "sha512-onl4Oy46oGCzymOXtKMQpI7VXtCbTSHK1kqBydZ6AmzuNcacEVqGk9tZtAS+48IA9IstZcDCgIg8hQKnb7suRw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.9.0",
+ "jsesc": "^2.5.1",
+ "lodash": "^4.17.13",
+ "source-map": "^0.5.0"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz",
+ "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.8.3",
+ "@babel/template": "^7.8.3",
+ "@babel/types": "^7.8.3"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz",
+ "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.8.3"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz",
+ "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.8.3"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.9.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz",
+ "integrity": "sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.5.0",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz",
+ "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.0.0",
+ "esutils": "^2.0.2",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.9.0",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.0.tgz",
+ "integrity": "sha512-Iwyp00CZsypoNJcpXCbq3G4tcDgphtlMwMVrMhhZ//XBkqjXF7LW6V511yk0+pBX3ZwwGnPea+pTKNJiqA7pUg==",
+ "dev": true
+ },
+ "@babel/runtime": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz",
+ "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==",
+ "dev": true,
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "@babel/runtime-corejs3": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.12.5.tgz",
+ "integrity": "sha512-roGr54CsTmNPPzZoCP1AmDXuBoNao7tnSA83TXTwt+UK5QVyh1DIJnrgYRPWKCF2flqZQXwa7Yr8v7VmLzF0YQ==",
+ "dev": true,
+ "requires": {
+ "core-js-pure": "^3.0.0",
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "@babel/template": {
+ "version": "7.8.6",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz",
+ "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.8.3",
+ "@babel/parser": "^7.8.6",
+ "@babel/types": "^7.8.6"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz",
+ "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.8.3"
+ }
+ },
+ "@babel/highlight": {
+ "version": "7.9.0",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz",
+ "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.9.0",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ }
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.9.0",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.0.tgz",
+ "integrity": "sha512-jAZQj0+kn4WTHO5dUZkZKhbFrqZE7K5LAQ5JysMnmvGij+wOdr+8lWqPeW0BcF4wFwrEXXtdGO7wcV6YPJcf3w==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.8.3",
+ "@babel/generator": "^7.9.0",
+ "@babel/helper-function-name": "^7.8.3",
+ "@babel/helper-split-export-declaration": "^7.8.3",
+ "@babel/parser": "^7.9.0",
+ "@babel/types": "^7.9.0",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.13"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz",
+ "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.8.3"
+ }
+ },
+ "@babel/highlight": {
+ "version": "7.9.0",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz",
+ "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.9.0",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ }
+ }
+ },
+ "@babel/types": {
+ "version": "7.9.0",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.0.tgz",
+ "integrity": "sha512-BS9JKfXkzzJl8RluW4JGknzpiUV7ZrvTayM6yfqLTVBEnFtyowVIOu6rqxRd5cVO6yGoWf4T8u8dgK9oB+GCng==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.9.0",
+ "lodash": "^4.17.13",
+ "to-fast-properties": "^2.0.0"
+ }
+ },
+ "@types/eslint-visitor-keys": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
+ "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==",
+ "dev": true
+ },
+ "@types/json-schema": {
+ "version": "7.0.5",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.5.tgz",
+ "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==",
+ "dev": true
+ },
+ "@types/json5": {
+ "version": "0.0.29",
+ "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
+ "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
+ "dev": true
+ },
+ "@typescript-eslint/eslint-plugin": {
+ "version": "2.34.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz",
+ "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/experimental-utils": "2.34.0",
+ "functional-red-black-tree": "^1.0.1",
+ "regexpp": "^3.0.0",
+ "tsutils": "^3.17.1"
+ }
+ },
+ "@typescript-eslint/experimental-utils": {
+ "version": "2.34.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz",
+ "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==",
+ "dev": true,
+ "requires": {
+ "@types/json-schema": "^7.0.3",
+ "@typescript-eslint/typescript-estree": "2.34.0",
+ "eslint-scope": "^5.0.0",
+ "eslint-utils": "^2.0.0"
+ },
+ "dependencies": {
+ "eslint-utils": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
+ "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
+ "dev": true,
+ "requires": {
+ "eslint-visitor-keys": "^1.1.0"
+ }
+ }
+ }
+ },
+ "@typescript-eslint/parser": {
+ "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": {
+ "@types/eslint-visitor-keys": "^1.0.0",
+ "@typescript-eslint/experimental-utils": "2.34.0",
+ "@typescript-eslint/typescript-estree": "2.34.0",
+ "eslint-visitor-keys": "^1.1.0"
+ }
+ },
+ "@typescript-eslint/typescript-estree": {
+ "version": "2.34.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz",
+ "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==",
+ "dev": true,
+ "requires": {
+ "debug": "^4.1.1",
+ "eslint-visitor-keys": "^1.1.0",
+ "glob": "^7.1.6",
+ "is-glob": "^4.0.1",
+ "lodash": "^4.17.15",
+ "semver": "^7.3.2",
+ "tsutils": "^3.17.1"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "7.3.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
+ "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
+ "dev": true
+ }
+ }
+ },
+ "acorn": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
+ "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==",
+ "dev": true
+ },
+ "acorn-jsx": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz",
+ "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==",
+ "dev": true
+ },
+ "ajv": {
+ "version": "6.11.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz",
+ "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ansi-escapes": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz",
+ "integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==",
+ "dev": true,
+ "requires": {
+ "type-fest": "^0.8.1"
+ }
+ },
+ "ansi-regex": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
+ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "dev": true
+ },
+ "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,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "aria-query": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz",
+ "integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==",
+ "dev": true,
+ "requires": {
+ "@babel/runtime": "^7.10.2",
+ "@babel/runtime-corejs3": "^7.10.2"
+ }
+ },
+ "array-includes": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.2.tgz",
+ "integrity": "sha512-w2GspexNQpx+PutG3QpT437/BenZBj0M/MZGn5mzv/MofYqo0xmRHzn4lFsoDlWJ+THYsGJmFlW68WlDFx7VRw==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.18.0-next.1",
+ "get-intrinsic": "^1.0.1",
+ "is-string": "^1.0.5"
+ }
+ },
+ "array.prototype.flat": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz",
+ "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.18.0-next.1"
+ }
+ },
+ "array.prototype.flatmap": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.2.4.tgz",
+ "integrity": "sha512-r9Z0zYoxqHz60vvQbWEdXIEtCwHF0yxaWfno9qzXeNHvfyl3BZqygmGzb84dsubyaXLH4husF+NFgMSdpZhk2Q==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.18.0-next.1",
+ "function-bind": "^1.1.1"
+ }
+ },
+ "ast-types-flow": {
+ "version": "0.0.7",
+ "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz",
+ "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=",
+ "dev": true
+ },
+ "astral-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
+ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
+ "dev": true
+ },
+ "axe-core": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.1.1.tgz",
+ "integrity": "sha512-5Kgy8Cz6LPC9DJcNb3yjAXTu3XihQgEdnIg50c//zOC/MyLP0Clg+Y8Sh9ZjjnvBrDZU4DgXS9C3T9r4/scGZQ==",
+ "dev": true
+ },
+ "axobject-query": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz",
+ "integrity": "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==",
+ "dev": true
+ },
+ "babel-eslint": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz",
+ "integrity": "sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "@babel/parser": "^7.7.0",
+ "@babel/traverse": "^7.7.0",
+ "@babel/types": "^7.7.0",
+ "eslint-visitor-keys": "^1.0.0",
+ "resolve": "^1.12.0"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "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"
+ }
+ },
+ "call-bind": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz",
+ "integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1",
+ "get-intrinsic": "^1.0.0"
+ }
+ },
+ "callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "dev": true
+ },
+ "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,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "chardet": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
+ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
+ "dev": true
+ },
+ "cli-cursor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
+ "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
+ "dev": true,
+ "requires": {
+ "restore-cursor": "^3.1.0"
+ }
+ },
+ "cli-width": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
+ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",
+ "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,
+ "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
+ },
+ "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
+ },
+ "confusing-browser-globals": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz",
+ "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==",
+ "dev": true
+ },
+ "contains-path": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz",
+ "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=",
+ "dev": true
+ },
+ "core-js-pure": {
+ "version": "3.8.0",
+ "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.8.0.tgz",
+ "integrity": "sha512-fRjhg3NeouotRoIV0L1FdchA6CK7ZD+lyINyMoz19SyV+ROpC4noS1xItWHFtwZdlqfMfVPJEyEGdfri2bD1pA==",
+ "dev": true
+ },
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
+ }
+ },
+ "damerau-levenshtein": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.6.tgz",
+ "integrity": "sha512-JVrozIeElnj3QzfUIt8tB8YMluBJom4Vw9qTPpjGYQ9fYlB3D/rb6OordUxf3xeFB35LKWs0xqcO5U6ySvBtug==",
+ "dev": true
+ },
+ "debug": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
+ "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "deep-is": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
+ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
+ "dev": true
+ },
+ "define-properties": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
+ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
+ "dev": true,
+ "requires": {
+ "object-keys": "^1.0.12"
+ }
+ },
+ "doctrine": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
+ "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
+ "dev": true,
+ "requires": {
+ "esutils": "^2.0.2"
+ }
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "es-abstract": {
+ "version": "1.18.0-next.1",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz",
+ "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==",
+ "dev": true,
+ "requires": {
+ "es-to-primitive": "^1.2.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.1",
+ "is-callable": "^1.2.2",
+ "is-negative-zero": "^2.0.0",
+ "is-regex": "^1.1.1",
+ "object-inspect": "^1.8.0",
+ "object-keys": "^1.1.1",
+ "object.assign": "^4.1.1",
+ "string.prototype.trimend": "^1.0.1",
+ "string.prototype.trimstart": "^1.0.1"
+ }
+ },
+ "es-to-primitive": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
+ "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
+ "dev": true,
+ "requires": {
+ "is-callable": "^1.1.4",
+ "is-date-object": "^1.0.1",
+ "is-symbol": "^1.0.2"
+ }
+ },
+ "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
+ },
+ "eslint": {
+ "version": "6.8.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz",
+ "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "ajv": "^6.10.0",
+ "chalk": "^2.1.0",
+ "cross-spawn": "^6.0.5",
+ "debug": "^4.0.1",
+ "doctrine": "^3.0.0",
+ "eslint-scope": "^5.0.0",
+ "eslint-utils": "^1.4.3",
+ "eslint-visitor-keys": "^1.1.0",
+ "espree": "^6.1.2",
+ "esquery": "^1.0.1",
+ "esutils": "^2.0.2",
+ "file-entry-cache": "^5.0.1",
+ "functional-red-black-tree": "^1.0.1",
+ "glob-parent": "^5.0.0",
+ "globals": "^12.1.0",
+ "ignore": "^4.0.6",
+ "import-fresh": "^3.0.0",
+ "imurmurhash": "^0.1.4",
+ "inquirer": "^7.0.0",
+ "is-glob": "^4.0.0",
+ "js-yaml": "^3.13.1",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "levn": "^0.3.0",
+ "lodash": "^4.17.14",
+ "minimatch": "^3.0.4",
+ "mkdirp": "^0.5.1",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.8.3",
+ "progress": "^2.0.0",
+ "regexpp": "^2.0.1",
+ "semver": "^6.1.2",
+ "strip-ansi": "^5.2.0",
+ "strip-json-comments": "^3.0.1",
+ "table": "^5.2.3",
+ "text-table": "^0.2.0",
+ "v8-compile-cache": "^2.0.3"
+ },
+ "dependencies": {
+ "globals": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-12.3.0.tgz",
+ "integrity": "sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==",
+ "dev": true,
+ "requires": {
+ "type-fest": "^0.8.1"
+ }
+ },
+ "regexpp": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz",
+ "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==",
+ "dev": true
+ }
+ }
+ },
+ "eslint-config-airbnb": {
+ "version": "18.2.1",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-18.2.1.tgz",
+ "integrity": "sha512-glZNDEZ36VdlZWoxn/bUR1r/sdFKPd1mHPbqUtkctgNG4yT2DLLtJ3D+yCV+jzZCc2V1nBVkmdknOJBZ5Hc0fg==",
+ "dev": true,
+ "requires": {
+ "eslint-config-airbnb-base": "^14.2.1",
+ "object.assign": "^4.1.2",
+ "object.entries": "^1.1.2"
+ }
+ },
+ "eslint-config-airbnb-base": {
+ "version": "14.2.1",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz",
+ "integrity": "sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==",
+ "dev": true,
+ "requires": {
+ "confusing-browser-globals": "^1.0.10",
+ "object.assign": "^4.1.2",
+ "object.entries": "^1.1.2"
+ }
+ },
+ "eslint-config-prettier": {
+ "version": "6.15.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz",
+ "integrity": "sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw==",
+ "dev": true,
+ "requires": {
+ "get-stdin": "^6.0.0"
+ }
+ },
+ "eslint-import-resolver-node": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz",
+ "integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==",
+ "dev": true,
+ "requires": {
+ "debug": "^2.6.9",
+ "resolve": "^1.13.1"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
+ "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==",
+ "dev": true,
+ "requires": {
+ "is-core-module": "^2.1.0",
+ "path-parse": "^1.0.6"
+ }
+ }
+ }
+ },
+ "eslint-module-utils": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz",
+ "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==",
+ "dev": true,
+ "requires": {
+ "debug": "^2.6.9",
+ "pkg-dir": "^2.0.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ }
+ }
+ },
+ "eslint-plugin-import": {
+ "version": "2.22.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz",
+ "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==",
+ "dev": true,
+ "requires": {
+ "array-includes": "^3.1.1",
+ "array.prototype.flat": "^1.2.3",
+ "contains-path": "^0.1.0",
+ "debug": "^2.6.9",
+ "doctrine": "1.5.0",
+ "eslint-import-resolver-node": "^0.3.4",
+ "eslint-module-utils": "^2.6.0",
+ "has": "^1.0.3",
+ "minimatch": "^3.0.4",
+ "object.values": "^1.1.1",
+ "read-pkg-up": "^2.0.0",
+ "resolve": "^1.17.0",
+ "tsconfig-paths": "^3.9.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "doctrine": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz",
+ "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=",
+ "dev": true,
+ "requires": {
+ "esutils": "^2.0.2",
+ "isarray": "^1.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
+ "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==",
+ "dev": true,
+ "requires": {
+ "is-core-module": "^2.1.0",
+ "path-parse": "^1.0.6"
+ }
+ }
+ }
+ },
+ "eslint-plugin-jsx-a11y": {
+ "version": "6.4.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.4.1.tgz",
+ "integrity": "sha512-0rGPJBbwHoGNPU73/QCLP/vveMlM1b1Z9PponxO87jfr6tuH5ligXbDT6nHSSzBC8ovX2Z+BQu7Bk5D/Xgq9zg==",
+ "dev": true,
+ "requires": {
+ "@babel/runtime": "^7.11.2",
+ "aria-query": "^4.2.2",
+ "array-includes": "^3.1.1",
+ "ast-types-flow": "^0.0.7",
+ "axe-core": "^4.0.2",
+ "axobject-query": "^2.2.0",
+ "damerau-levenshtein": "^1.0.6",
+ "emoji-regex": "^9.0.0",
+ "has": "^1.0.3",
+ "jsx-ast-utils": "^3.1.0",
+ "language-tags": "^1.0.5"
+ },
+ "dependencies": {
+ "emoji-regex": {
+ "version": "9.2.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.0.tgz",
+ "integrity": "sha512-DNc3KFPK18bPdElMJnf/Pkv5TXhxFU3YFDEuGLDRtPmV4rkmCjBkCSEp22u6rBHdSN9Vlp/GK7k98prmE1Jgug==",
+ "dev": true
+ }
+ }
+ },
+ "eslint-plugin-prettier": {
+ "version": "3.1.4",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz",
+ "integrity": "sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==",
+ "dev": true,
+ "requires": {
+ "prettier-linter-helpers": "^1.0.0"
+ }
+ },
+ "eslint-plugin-react": {
+ "version": "7.21.5",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.21.5.tgz",
+ "integrity": "sha512-8MaEggC2et0wSF6bUeywF7qQ46ER81irOdWS4QWxnnlAEsnzeBevk1sWh7fhpCghPpXb+8Ks7hvaft6L/xsR6g==",
+ "dev": true,
+ "requires": {
+ "array-includes": "^3.1.1",
+ "array.prototype.flatmap": "^1.2.3",
+ "doctrine": "^2.1.0",
+ "has": "^1.0.3",
+ "jsx-ast-utils": "^2.4.1 || ^3.0.0",
+ "object.entries": "^1.1.2",
+ "object.fromentries": "^2.0.2",
+ "object.values": "^1.1.1",
+ "prop-types": "^15.7.2",
+ "resolve": "^1.18.1",
+ "string.prototype.matchall": "^4.0.2"
+ },
+ "dependencies": {
+ "doctrine": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
+ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
+ "dev": true,
+ "requires": {
+ "esutils": "^2.0.2"
+ }
+ },
+ "resolve": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
+ "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==",
+ "dev": true,
+ "requires": {
+ "is-core-module": "^2.1.0",
+ "path-parse": "^1.0.6"
+ }
+ }
+ }
+ },
+ "eslint-plugin-react-hooks": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.5.1.tgz",
+ "integrity": "sha512-Y2c4b55R+6ZzwtTppKwSmK/Kar8AdLiC2f9NADCuxbcTgPPg41Gyqa6b9GppgXSvCtkRw43ZE86CT5sejKC6/g==",
+ "dev": true
+ },
+ "eslint-scope": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz",
+ "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==",
+ "dev": true,
+ "requires": {
+ "esrecurse": "^4.1.0",
+ "estraverse": "^4.1.1"
+ }
+ },
+ "eslint-utils": {
+ "version": "1.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz",
+ "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==",
+ "dev": true,
+ "requires": {
+ "eslint-visitor-keys": "^1.1.0"
+ }
+ },
+ "eslint-visitor-keys": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz",
+ "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==",
+ "dev": true
+ },
+ "espree": {
+ "version": "6.1.2",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz",
+ "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==",
+ "dev": true,
+ "requires": {
+ "acorn": "^7.1.0",
+ "acorn-jsx": "^5.1.0",
+ "eslint-visitor-keys": "^1.1.0"
+ }
+ },
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "dev": true
+ },
+ "esquery": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz",
+ "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^4.0.0"
+ }
+ },
+ "esrecurse": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz",
+ "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^4.1.0"
+ }
+ },
+ "estraverse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
+ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+ "dev": true
+ },
+ "esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true
+ },
+ "external-editor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz",
+ "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==",
+ "dev": true,
+ "requires": {
+ "chardet": "^0.7.0",
+ "iconv-lite": "^0.4.24",
+ "tmp": "^0.0.33"
+ }
+ },
+ "fast-deep-equal": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
+ "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==",
+ "dev": true
+ },
+ "fast-diff": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz",
+ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==",
+ "dev": true
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true
+ },
+ "fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
+ "dev": true
+ },
+ "figures": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz",
+ "integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==",
+ "dev": true,
+ "requires": {
+ "escape-string-regexp": "^1.0.5"
+ }
+ },
+ "file-entry-cache": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz",
+ "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==",
+ "dev": true,
+ "requires": {
+ "flat-cache": "^2.0.1"
+ }
+ },
+ "find-up": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
+ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
+ "dev": true,
+ "requires": {
+ "locate-path": "^2.0.0"
+ }
+ },
+ "flat-cache": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
+ "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==",
+ "dev": true,
+ "requires": {
+ "flatted": "^2.0.0",
+ "rimraf": "2.6.3",
+ "write": "1.0.3"
+ }
+ },
+ "flatted": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz",
+ "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==",
+ "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
+ },
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
+ "functional-red-black-tree": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
+ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
+ "dev": true
+ },
+ "get-intrinsic": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz",
+ "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.1"
+ }
+ },
+ "get-stdin": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz",
+ "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==",
+ "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"
+ }
+ },
+ "glob-parent": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz",
+ "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==",
+ "dev": true,
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "globals": {
+ "version": "11.12.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
+ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "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
+ },
+ "has-symbols": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
+ "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
+ "dev": true
+ },
+ "hosted-git-info": {
+ "version": "2.8.8",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
+ "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
+ "dev": true
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "dev": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "ignore": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
+ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
+ "dev": true
+ },
+ "import-fresh": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",
+ "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==",
+ "dev": true,
+ "requires": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ }
+ },
+ "imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
+ "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
+ },
+ "inquirer": {
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.4.tgz",
+ "integrity": "sha512-Bu5Td5+j11sCkqfqmUTiwv+tWisMtP0L7Q8WrqA2C/BbBhy1YTdFrvjjlrKq8oagA/tLQBski2Gcx/Sqyi2qSQ==",
+ "dev": true,
+ "requires": {
+ "ansi-escapes": "^4.2.1",
+ "chalk": "^2.4.2",
+ "cli-cursor": "^3.1.0",
+ "cli-width": "^2.0.0",
+ "external-editor": "^3.0.3",
+ "figures": "^3.0.0",
+ "lodash": "^4.17.15",
+ "mute-stream": "0.0.8",
+ "run-async": "^2.2.0",
+ "rxjs": "^6.5.3",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^5.1.0",
+ "through": "^2.3.6"
+ }
+ },
+ "internal-slot": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.2.tgz",
+ "integrity": "sha512-2cQNfwhAfJIkU4KZPkDI+Gj5yNNnbqi40W9Gge6dfnk4TocEVm00B3bdiL+JINrbGJil2TeHvM4rETGzk/f/0g==",
+ "dev": true,
+ "requires": {
+ "es-abstract": "^1.17.0-next.1",
+ "has": "^1.0.3",
+ "side-channel": "^1.0.2"
+ },
+ "dependencies": {
+ "es-abstract": {
+ "version": "1.17.7",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz",
+ "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==",
+ "dev": true,
+ "requires": {
+ "es-to-primitive": "^1.2.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.1",
+ "is-callable": "^1.2.2",
+ "is-regex": "^1.1.1",
+ "object-inspect": "^1.8.0",
+ "object-keys": "^1.1.1",
+ "object.assign": "^4.1.1",
+ "string.prototype.trimend": "^1.0.1",
+ "string.prototype.trimstart": "^1.0.1"
+ }
+ }
+ }
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
+ "dev": true
+ },
+ "is-callable": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz",
+ "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==",
+ "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-date-object": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz",
+ "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==",
+ "dev": true
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true
+ },
+ "is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-negative-zero": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz",
+ "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=",
+ "dev": true
+ },
+ "is-promise": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
+ "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",
+ "dev": true
+ },
+ "is-regex": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz",
+ "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==",
+ "dev": true,
+ "requires": {
+ "has-symbols": "^1.0.1"
+ }
+ },
+ "is-string": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz",
+ "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==",
+ "dev": true
+ },
+ "is-symbol": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
+ "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==",
+ "dev": true,
+ "requires": {
+ "has-symbols": "^1.0.1"
+ }
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
+ "dev": true
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
+ },
+ "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
+ },
+ "js-yaml": {
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
+ "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
+ "dev": true,
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "jsesc": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
+ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+ "dev": true
+ },
+ "json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true
+ },
+ "json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
+ "dev": true
+ },
+ "json5": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
+ "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.0"
+ }
+ },
+ "jsx-ast-utils": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.1.0.tgz",
+ "integrity": "sha512-d4/UOjg+mxAWxCiF0c5UTSwyqbchkbqCvK87aBovhnh8GtysTjWmgC63tY0cJx/HzGgm9qnA147jVBdpOiQ2RA==",
+ "dev": true,
+ "requires": {
+ "array-includes": "^3.1.1",
+ "object.assign": "^4.1.1"
+ }
+ },
+ "language-subtag-registry": {
+ "version": "0.3.21",
+ "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.21.tgz",
+ "integrity": "sha512-L0IqwlIXjilBVVYKFT37X9Ih11Um5NEl9cbJIuU/SwP/zEEAbBPOnEeeuxVMf45ydWQRDQN3Nqc96OgbH1K+Pg==",
+ "dev": true
+ },
+ "language-tags": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/language-tags/-/language-tags-1.0.5.tgz",
+ "integrity": "sha1-0yHbxNowuovzAk4ED6XBRmH5GTo=",
+ "dev": true,
+ "requires": {
+ "language-subtag-registry": "~0.3.2"
+ }
+ },
+ "levn": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2"
+ }
+ },
+ "load-json-file": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
+ "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^2.2.0",
+ "pify": "^2.0.0",
+ "strip-bom": "^3.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
+ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
+ "dev": true,
+ "requires": {
+ "p-locate": "^2.0.0",
+ "path-exists": "^3.0.0"
+ }
+ },
+ "lodash": {
+ "version": "4.17.20",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
+ "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
+ "dev": true
+ },
+ "loose-envify": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "dev": true,
+ "requires": {
+ "js-tokens": "^3.0.0 || ^4.0.0"
+ }
+ },
+ "mimic-fn": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
+ "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"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "dev": true
+ },
+ "mkdirp": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
+ "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "mute-stream": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
+ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
+ "dev": true
+ },
+ "natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
+ "dev": true
+ },
+ "nice-try": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
+ "dev": true
+ },
+ "normalize-package-data": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
+ "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
+ "dev": true,
+ "requires": {
+ "hosted-git-info": "^2.1.4",
+ "resolve": "^1.10.0",
+ "semver": "2 || 3 || 4 || 5",
+ "validate-npm-package-license": "^3.0.1"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
+ }
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
+ "dev": true
+ },
+ "object-inspect": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz",
+ "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==",
+ "dev": true
+ },
+ "object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "dev": true
+ },
+ "object.assign": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz",
+ "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3",
+ "has-symbols": "^1.0.1",
+ "object-keys": "^1.1.1"
+ }
+ },
+ "object.entries": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.3.tgz",
+ "integrity": "sha512-ym7h7OZebNS96hn5IJeyUmaWhaSM4SVtAPPfNLQEI2MYWCO2egsITb9nab2+i/Pwibx+R0mtn+ltKJXRSeTMGg==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.18.0-next.1",
+ "has": "^1.0.3"
+ }
+ },
+ "object.fromentries": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.3.tgz",
+ "integrity": "sha512-IDUSMXs6LOSJBWE++L0lzIbSqHl9KDCfff2x/JSEIDtEUavUnyMYC2ZGay/04Zq4UT8lvd4xNhU4/YHKibAOlw==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.18.0-next.1",
+ "has": "^1.0.3"
+ }
+ },
+ "object.values": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.2.tgz",
+ "integrity": "sha512-MYC0jvJopr8EK6dPBiO8Nb9mvjdypOachO5REGk6MXzujbBrAisKo3HmdEI6kZDL6fC31Mwee/5YbtMebixeag==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.18.0-next.1",
+ "has": "^1.0.3"
+ }
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "onetime": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz",
+ "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==",
+ "dev": true,
+ "requires": {
+ "mimic-fn": "^2.1.0"
+ }
+ },
+ "optionator": {
+ "version": "0.8.3",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
+ "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
+ "dev": true,
+ "requires": {
+ "deep-is": "~0.1.3",
+ "fast-levenshtein": "~2.0.6",
+ "levn": "~0.3.0",
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2",
+ "word-wrap": "~1.2.3"
+ }
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
+ "dev": true
+ },
+ "p-limit": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
+ "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
+ "dev": true,
+ "requires": {
+ "p-try": "^1.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
+ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
+ "dev": true,
+ "requires": {
+ "p-limit": "^1.1.0"
+ }
+ },
+ "p-try": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
+ "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",
+ "dev": true
+ },
+ "parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dev": true,
+ "requires": {
+ "callsites": "^3.0.0"
+ }
+ },
+ "parse-json": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
+ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.2.0"
+ }
+ },
+ "path-exists": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
+ "dev": true
+ },
+ "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-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
+ "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
+ },
+ "path-type": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
+ "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
+ "dev": true,
+ "requires": {
+ "pify": "^2.0.0"
+ }
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ },
+ "pkg-dir": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz",
+ "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=",
+ "dev": true,
+ "requires": {
+ "find-up": "^2.1.0"
+ }
+ },
+ "prelude-ls": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
+ "dev": true
+ },
+ "prettier": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz",
+ "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==",
+ "dev": true
+ },
+ "prettier-linter-helpers": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
+ "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
+ "dev": true,
+ "requires": {
+ "fast-diff": "^1.1.2"
+ }
+ },
+ "progress": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
+ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
+ "dev": true
+ },
+ "prop-types": {
+ "version": "15.7.2",
+ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz",
+ "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
+ "dev": true,
+ "requires": {
+ "loose-envify": "^1.4.0",
+ "object-assign": "^4.1.1",
+ "react-is": "^16.8.1"
+ }
+ },
+ "punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+ "dev": true
+ },
+ "react-is": {
+ "version": "16.13.1",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
+ "dev": true
+ },
+ "read-pkg": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
+ "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "^2.0.0",
+ "normalize-package-data": "^2.3.2",
+ "path-type": "^2.0.0"
+ }
+ },
+ "read-pkg-up": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
+ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
+ "dev": true,
+ "requires": {
+ "find-up": "^2.0.0",
+ "read-pkg": "^2.0.0"
+ }
+ },
+ "regenerator-runtime": {
+ "version": "0.13.7",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz",
+ "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==",
+ "dev": true
+ },
+ "regexp.prototype.flags": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz",
+ "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.0-next.1"
+ },
+ "dependencies": {
+ "es-abstract": {
+ "version": "1.17.7",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz",
+ "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==",
+ "dev": true,
+ "requires": {
+ "es-to-primitive": "^1.2.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.1",
+ "is-callable": "^1.2.2",
+ "is-regex": "^1.1.1",
+ "object-inspect": "^1.8.0",
+ "object-keys": "^1.1.1",
+ "object.assign": "^4.1.1",
+ "string.prototype.trimend": "^1.0.1",
+ "string.prototype.trimstart": "^1.0.1"
+ }
+ }
+ }
+ },
+ "regexpp": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
+ "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.12.2",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.2.tgz",
+ "integrity": "sha512-cAVTI2VLHWYsGOirfeYVVQ7ZDejtQ9fp4YhYckWDEkFfqbVjaT11iM8k6xSAfGFMM+gDpZjMnFssPu8we+mqFw==",
+ "dev": true,
+ "requires": {
+ "path-parse": "^1.0.6"
+ }
+ },
+ "resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "dev": true
+ },
+ "restore-cursor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
+ "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
+ "dev": true,
+ "requires": {
+ "onetime": "^5.1.0",
+ "signal-exit": "^3.0.2"
+ }
+ },
+ "rimraf": {
+ "version": "2.6.3",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
+ "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "run-async": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
+ "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=",
+ "dev": true,
+ "requires": {
+ "is-promise": "^2.1.0"
+ }
+ },
+ "rxjs": {
+ "version": "6.5.4",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz",
+ "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
+ "dev": true
+ },
+ "side-channel": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.3.tgz",
+ "integrity": "sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g==",
+ "dev": true,
+ "requires": {
+ "es-abstract": "^1.18.0-next.0",
+ "object-inspect": "^1.8.0"
+ }
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
+ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
+ "dev": true
+ },
+ "slice-ansi": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
+ "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "astral-regex": "^1.0.0",
+ "is-fullwidth-code-point": "^2.0.0"
+ },
+ "dependencies": {
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ }
+ }
+ },
+ "source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
+ "dev": true
+ },
+ "spdx-correct": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
+ "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "dev": true,
+ "requires": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-exceptions": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
+ "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==",
+ "dev": true
+ },
+ "spdx-expression-parse": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
+ "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
+ "dev": true,
+ "requires": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-license-ids": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz",
+ "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==",
+ "dev": true
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true
+ },
+ "string-width": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
+ "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "dependencies": {
+ "strip-ansi": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
+ "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.0"
+ }
+ }
+ }
+ },
+ "string.prototype.matchall": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.3.tgz",
+ "integrity": "sha512-OBxYDA2ifZQ2e13cP82dWFMaCV9CGF8GzmN4fljBVw5O5wep0lu4gacm1OL6MjROoUnB8VbkWRThqkV2YFLNxw==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.18.0-next.1",
+ "has-symbols": "^1.0.1",
+ "internal-slot": "^1.0.2",
+ "regexp.prototype.flags": "^1.3.0",
+ "side-channel": "^1.0.3"
+ }
+ },
+ "string.prototype.trimend": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz",
+ "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3"
+ }
+ },
+ "string.prototype.trimstart": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz",
+ "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3"
+ }
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ }
+ }
+ },
+ "strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
+ "dev": true
+ },
+ "strip-json-comments": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz",
+ "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==",
+ "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,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "table": {
+ "version": "5.4.6",
+ "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
+ "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.10.2",
+ "lodash": "^4.17.14",
+ "slice-ansi": "^2.1.0",
+ "string-width": "^3.0.0"
+ },
+ "dependencies": {
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ }
+ }
+ },
+ "text-table": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
+ "dev": true
+ },
+ "through": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
+ "dev": true
+ },
+ "tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "dev": true,
+ "requires": {
+ "os-tmpdir": "~1.0.2"
+ }
+ },
+ "to-fast-properties": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
+ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
+ "dev": true
+ },
+ "tsconfig-paths": {
+ "version": "3.9.0",
+ "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz",
+ "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==",
+ "dev": true,
+ "requires": {
+ "@types/json5": "^0.0.29",
+ "json5": "^1.0.1",
+ "minimist": "^1.2.0",
+ "strip-bom": "^3.0.0"
+ }
+ },
+ "tslib": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+ "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+ "dev": true
+ },
+ "tsutils": {
+ "version": "3.17.1",
+ "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz",
+ "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.8.1"
+ }
+ },
+ "type-check": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2"
+ }
+ },
+ "type-fest": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
+ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
+ "dev": true
+ },
+ "typescript": {
+ "version": "3.9.7",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
+ "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
+ "dev": true
+ },
+ "uri-js": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
+ "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
+ "dev": true,
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "v8-compile-cache": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz",
+ "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==",
+ "dev": true
+ },
+ "validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "dev": true,
+ "requires": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "word-wrap": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
+ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
+ "dev": true
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ },
+ "write": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz",
+ "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==",
+ "dev": true,
+ "requires": {
+ "mkdirp": "^0.5.1"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 00000000..ee45be2d
--- /dev/null
+++ b/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "dnote",
+ "repository": "https://github.com/dnote/dnote",
+ "version": "0.1.0",
+ "description": "Dnote monorepo",
+ "license": "SEE LICENSE IN LICENSE",
+ "devDependencies": {
+ "@typescript-eslint/eslint-plugin": "^2.34.0",
+ "@typescript-eslint/parser": "^2.34.0",
+ "babel-eslint": "^10.1.0",
+ "eslint": "^6.8.0",
+ "eslint-config-airbnb": "^18.2.1",
+ "eslint-config-prettier": "^6.15.0",
+ "eslint-plugin-import": "^2.22.1",
+ "eslint-plugin-jsx-a11y": "^6.4.1",
+ "eslint-plugin-prettier": "^3.1.4",
+ "eslint-plugin-react": "^7.21.5",
+ "eslint-plugin-react-hooks": "^2.5.1",
+ "prettier": "^2.2.1",
+ "typescript": "^3.9.7"
+ }
+}
diff --git a/pkg/assert/assert.go b/pkg/assert/assert.go
index bb98fce0..24c65bd7 100644
--- a/pkg/assert/assert.go
+++ b/pkg/assert/assert.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package assert provides functions to assert a condition in tests
@@ -19,7 +22,7 @@ package assert
import (
"encoding/json"
"fmt"
- "io"
+ "io/ioutil"
"net/http"
"reflect"
"runtime/debug"
@@ -135,7 +138,7 @@ func EqualJSON(t *testing.T, a, b, message string) {
// expected
func StatusCodeEquals(t *testing.T, res *http.Response, expected int, message string) {
if res.StatusCode != expected {
- body, err := io.ReadAll(res.Body)
+ body, err := ioutil.ReadAll(res.Body)
if err != nil {
t.Fatal(errors.Wrap(err, "reading body"))
}
diff --git a/pkg/assert/prompt.go b/pkg/assert/prompt.go
deleted file mode 100644
index c21e6a42..00000000
--- a/pkg/assert/prompt.go
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package assert
-
-import (
- "bufio"
- "io"
- "strings"
- "time"
-
- "github.com/pkg/errors"
-)
-
-// WaitForPrompt waits for an expected prompt to appear in stdout with a timeout.
-// Returns an error if the prompt is not found within the timeout period.
-// Handles prompts with or without newlines by reading character by character.
-func WaitForPrompt(stdout io.Reader, expectedPrompt string, timeout time.Duration) error {
- type result struct {
- found bool
- err error
- }
- resultCh := make(chan result, 1)
-
- go func() {
- reader := bufio.NewReader(stdout)
- var buffer strings.Builder
- found := false
-
- for {
- b, err := reader.ReadByte()
- if err != nil {
- resultCh <- result{found: found, err: err}
- return
- }
-
- buffer.WriteByte(b)
- if strings.Contains(buffer.String(), expectedPrompt) {
- found = true
- break
- }
- }
-
- resultCh <- result{found: found, err: nil}
- }()
-
- select {
- case res := <-resultCh:
- if res.err != nil && res.err != io.EOF {
- return errors.Wrap(res.err, "reading stdout")
- }
- if !res.found {
- return errors.Errorf("expected prompt '%s' not found in stdout", expectedPrompt)
- }
- return nil
- case <-time.After(timeout):
- return errors.Errorf("timeout waiting for prompt '%s'", expectedPrompt)
- }
-}
-
-// RespondToPrompt is a helper that waits for a prompt and sends a response.
-func RespondToPrompt(stdout io.Reader, stdin io.WriteCloser, expectedPrompt, response string, timeout time.Duration) error {
- if err := WaitForPrompt(stdout, expectedPrompt, timeout); err != nil {
- return err
- }
-
- if _, err := io.WriteString(stdin, response); err != nil {
- return errors.Wrap(err, "writing response to stdin")
- }
-
- return nil
-}
diff --git a/pkg/cli/COMMANDS.md b/pkg/cli/COMMANDS.md
index c3402152..1bdcadb6 100644
--- a/pkg/cli/COMMANDS.md
+++ b/pkg/cli/COMMANDS.md
@@ -94,14 +94,20 @@ dnote find "merge sort" -b algorithm
## dnote sync
+_Dnote Pro only_
+
_alias: s_
-Sync notes with Dnote server.
+Sync notes with Dnote server. All your data is encrypted before being sent to the server.
## dnote login
+_Dnote Pro only_
+
Start a login prompt.
## dnote logout
+_Dnote Pro only_
+
Log out of Dnote.
diff --git a/pkg/cli/client/client.go b/pkg/cli/client/client.go
index 2be0006d..dfca8067 100644
--- a/pkg/cli/client/client.go
+++ b/pkg/cli/client/client.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package client provides interfaces for interacting with the Dnote server
@@ -20,7 +23,7 @@ package client
import (
"encoding/json"
"fmt"
- "io"
+ "io/ioutil"
"net/http"
"net/url"
"strconv"
@@ -30,7 +33,6 @@ import (
"github.com/dnote/dnote/pkg/cli/context"
"github.com/dnote/dnote/pkg/cli/log"
"github.com/pkg/errors"
- "golang.org/x/time/rate"
)
// ErrInvalidLogin is an error for invalid credentials for login
@@ -39,84 +41,18 @@ var ErrInvalidLogin = errors.New("wrong credentials")
// ErrContentTypeMismatch is an error for invalid credentials for login
var ErrContentTypeMismatch = errors.New("content type mismatch")
-// HTTPError represents an HTTP error response from the server
-type HTTPError struct {
- StatusCode int
- Message string
-}
-
-func (e *HTTPError) Error() string {
- return fmt.Sprintf(`response %d "%s"`, e.StatusCode, e.Message)
-}
-
-// IsConflict returns true if the error is a 409 Conflict error
-func (e *HTTPError) IsConflict() bool {
- return e.StatusCode == 409
-}
-
var contentTypeApplicationJSON = "application/json"
var contentTypeNone = ""
-// requestOptions contains options for requests
+// requestOptions contians options for requests
type requestOptions struct {
HTTPClient *http.Client
// ExpectedContentType is the Content-Type that the client is expecting from the server
ExpectedContentType *string
}
-const (
- // clientRateLimitPerSecond is the max requests per second the client will make
- clientRateLimitPerSecond = 50
- // clientRateLimitBurst is the burst capacity for rate limiting
- clientRateLimitBurst = 100
-)
-
-// rateLimitedTransport wraps an http.RoundTripper with rate limiting
-type rateLimitedTransport struct {
- transport http.RoundTripper
- limiter *rate.Limiter
-}
-
-func (t *rateLimitedTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- // Wait for rate limiter to allow the request
- if err := t.limiter.Wait(req.Context()); err != nil {
- return nil, err
- }
- return t.transport.RoundTrip(req)
-}
-
-// NewRateLimitedHTTPClient creates an HTTP client with rate limiting
-func NewRateLimitedHTTPClient() *http.Client {
- // Calculate interval from rate: 1 second / requests per second
- interval := time.Second / time.Duration(clientRateLimitPerSecond)
-
- transport := &rateLimitedTransport{
- transport: http.DefaultTransport,
- limiter: rate.NewLimiter(rate.Every(interval), clientRateLimitBurst),
- }
- return &http.Client{
- Transport: transport,
- }
-}
-
-func getHTTPClient(ctx context.DnoteCtx, options *requestOptions) *http.Client {
- if options != nil && options.HTTPClient != nil {
- return options.HTTPClient
- }
-
- if ctx.HTTPClient != nil {
- return ctx.HTTPClient
- }
-
- return &http.Client{}
-}
-
-func getExpectedContentType(options *requestOptions) string {
- if options != nil && options.ExpectedContentType != nil {
- return *options.ExpectedContentType
- }
-
- return contentTypeApplicationJSON
+var defaultRequestOptions = requestOptions{
+ ExpectedContentType: &contentTypeApplicationJSON,
}
func getReq(ctx context.DnoteCtx, path, method, body string) (*http.Request, error) {
@@ -136,6 +72,22 @@ func getReq(ctx context.DnoteCtx, path, method, body string) (*http.Request, err
return req, nil
}
+func getHTTPClient(options *requestOptions) http.Client {
+ if options != nil && options.HTTPClient != nil {
+ return *options.HTTPClient
+ }
+
+ return http.Client{}
+}
+
+func getExpectedContentType(options *requestOptions) string {
+ if options != nil && options.ExpectedContentType != nil {
+ return *options.ExpectedContentType
+ }
+
+ return contentTypeApplicationJSON
+}
+
// checkRespErr checks if the given http response indicates an error. It returns a boolean indicating
// if the response is an error, and a decoded error message.
func checkRespErr(res *http.Response) error {
@@ -143,16 +95,13 @@ func checkRespErr(res *http.Response) error {
return nil
}
- body, err := io.ReadAll(res.Body)
+ body, err := ioutil.ReadAll(res.Body)
if err != nil {
return errors.Wrapf(err, "server responded with %d but client could not read the response body", res.StatusCode)
}
bodyStr := string(body)
- return &HTTPError{
- StatusCode: res.StatusCode,
- Message: strings.TrimRight(bodyStr, "\n"),
- }
+ return errors.Errorf(`response %d "%s"`, res.StatusCode, strings.TrimRight(bodyStr, "\n"))
}
func checkContentType(res *http.Response, options *requestOptions) error {
@@ -173,15 +122,15 @@ func doReq(ctx context.DnoteCtx, method, path, body string, options *requestOpti
return nil, errors.Wrap(err, "getting request")
}
- log.Debug("HTTP %s %s\n", method, path)
+ log.Debug("HTTP request: %+v\n", req)
- hc := getHTTPClient(ctx, options)
+ hc := getHTTPClient(options)
res, err := hc.Do(req)
if err != nil {
return res, errors.Wrap(err, "making http request")
}
- log.Debug("HTTP %d %s\n", res.StatusCode, res.Status)
+ log.Debug("HTTP response: %+v\n", res)
if err = checkRespErr(res); err != nil {
return res, errors.Wrap(err, "server responded with an error")
@@ -220,7 +169,7 @@ func GetSyncState(ctx context.DnoteCtx) (GetSyncStateResp, error) {
return ret, errors.Wrap(err, "constructing http request")
}
- body, err := io.ReadAll(res.Body)
+ body, err := ioutil.ReadAll(res.Body)
if err != nil {
return ret, errors.Wrap(err, "reading the response body")
}
@@ -243,6 +192,7 @@ type SyncFragNote struct {
AddedOn int64 `json:"added_on"`
EditedOn int64 `json:"edited_on"`
Body string `json:"content"`
+ Public bool `json:"public"`
Deleted bool `json:"deleted"`
}
@@ -282,11 +232,8 @@ func GetSyncFragment(ctx context.DnoteCtx, afterUSN int) (GetSyncFragmentResp, e
path := fmt.Sprintf("/v3/sync/fragment?%s", queryStr)
res, err := doAuthorizedReq(ctx, "GET", path, "", nil)
- if err != nil {
- return GetSyncFragmentResp{}, errors.Wrap(err, "making the request")
- }
- body, err := io.ReadAll(res.Body)
+ body, err := ioutil.ReadAll(res.Body)
if err != nil {
return GetSyncFragmentResp{}, errors.Wrap(err, "reading the response body")
}
@@ -457,6 +404,7 @@ func CreateNote(ctx context.DnoteCtx, bookUUID, content string) (CreateNoteResp,
type updateNotePayload struct {
BookUUID *string `json:"book_uuid"`
Body *string `json:"content"`
+ Public *bool `json:"public"`
}
// UpdateNoteResp is the response from create book api
@@ -466,10 +414,11 @@ type UpdateNoteResp struct {
}
// UpdateNote updates a note in the server
-func UpdateNote(ctx context.DnoteCtx, uuid, bookUUID, content string) (UpdateNoteResp, error) {
+func UpdateNote(ctx context.DnoteCtx, uuid, bookUUID, content string, public bool) (UpdateNoteResp, error) {
payload := updateNotePayload{
BookUUID: &bookUUID,
Body: &content,
+ Public: &public,
}
b, err := json.Marshal(payload)
if err != nil {
@@ -576,12 +525,10 @@ func Signin(ctx context.DnoteCtx, email, password string) (SigninResponse, error
return SigninResponse{}, errors.Wrap(err, "marshaling payload")
}
res, err := doReq(ctx, "POST", "/v3/signin", string(b), nil)
- if err != nil {
- // Check if this is a 401 Unauthorized error
- var httpErr *HTTPError
- if errors.As(err, &httpErr) && httpErr.StatusCode == http.StatusUnauthorized {
- return SigninResponse{}, ErrInvalidLogin
- }
+
+ if res.StatusCode == http.StatusUnauthorized {
+ return SigninResponse{}, ErrInvalidLogin
+ } else if err != nil {
return SigninResponse{}, errors.Wrap(err, "making http request")
}
@@ -595,27 +542,15 @@ func Signin(ctx context.DnoteCtx, email, password string) (SigninResponse, error
// Signout deletes a user session on the server side
func Signout(ctx context.DnoteCtx, sessionKey string) error {
- // Create a client that shares the transport (and thus rate limiter) from ctx.HTTPClient
- // but doesn't follow redirects
- var hc *http.Client
- if ctx.HTTPClient != nil {
- hc = &http.Client{
- Transport: ctx.HTTPClient.Transport,
- CheckRedirect: func(req *http.Request, via []*http.Request) error {
- return http.ErrUseLastResponse
- },
- }
- } else {
- log.Warnf("No HTTP client configured for signout - falling back\n")
- hc = &http.Client{
- CheckRedirect: func(req *http.Request, via []*http.Request) error {
- return http.ErrUseLastResponse
- },
- }
+ hc := http.Client{
+ // No need to follow redirect
+ CheckRedirect: func(req *http.Request, via []*http.Request) error {
+ return http.ErrUseLastResponse
+ },
}
opts := requestOptions{
- HTTPClient: hc,
+ HTTPClient: &hc,
ExpectedContentType: &contentTypeNone,
}
_, err := doAuthorizedReq(ctx, "POST", "/v3/signout", "", &opts)
diff --git a/pkg/cli/client/client_test.go b/pkg/cli/client/client_test.go
index f83a0e6f..e54644a8 100644
--- a/pkg/cli/client/client_test.go
+++ b/pkg/cli/client/client_test.go
@@ -1,18 +1,3 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package client
import (
@@ -20,15 +5,12 @@ import (
"fmt"
"net/http"
"net/http/httptest"
- "sync/atomic"
"testing"
- "time"
"github.com/dnote/dnote/pkg/assert"
"github.com/dnote/dnote/pkg/cli/context"
"github.com/dnote/dnote/pkg/cli/testutils"
"github.com/pkg/errors"
- "golang.org/x/time/rate"
)
// startCommonTestServer starts a test HTTP server that simulates a common set of senarios
@@ -57,7 +39,7 @@ func TestSignIn(t *testing.T) {
err := json.NewDecoder(r.Body).Decode(&payload)
if err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload in the test server").Error())
+ t.Fatalf(errors.Wrap(err, "decoding payload in the test server").Error())
return
}
@@ -82,10 +64,9 @@ func TestSignIn(t *testing.T) {
defer commonTs.Close()
correctEndpoint := fmt.Sprintf("%s/api", ts.URL)
- testClient := NewRateLimitedHTTPClient()
t.Run("success", func(t *testing.T) {
- result, err := Signin(context.DnoteCtx{APIEndpoint: correctEndpoint, HTTPClient: testClient}, "alice@example.com", "pass1234")
+ result, err := Signin(context.DnoteCtx{APIEndpoint: correctEndpoint}, "alice@example.com", "pass1234")
if err != nil {
t.Errorf("got signin request error: %+v", err.Error())
}
@@ -95,7 +76,7 @@ func TestSignIn(t *testing.T) {
})
t.Run("failure", func(t *testing.T) {
- result, err := Signin(context.DnoteCtx{APIEndpoint: correctEndpoint, HTTPClient: testClient}, "alice@example.com", "incorrectpassword")
+ result, err := Signin(context.DnoteCtx{APIEndpoint: correctEndpoint}, "alice@example.com", "incorrectpassword")
assert.Equal(t, err, ErrInvalidLogin, "err mismatch")
assert.Equal(t, result.Key, "", "Key mismatch")
@@ -104,7 +85,7 @@ func TestSignIn(t *testing.T) {
t.Run("server error", func(t *testing.T) {
endpoint := fmt.Sprintf("%s/bad-api", ts.URL)
- result, err := Signin(context.DnoteCtx{APIEndpoint: endpoint, HTTPClient: testClient}, "alice@example.com", "pass1234")
+ result, err := Signin(context.DnoteCtx{APIEndpoint: endpoint}, "alice@example.com", "pass1234")
if err == nil {
t.Error("error should have been returned")
}
@@ -115,24 +96,12 @@ func TestSignIn(t *testing.T) {
t.Run("accidentally pointing to a catch-all handler", func(t *testing.T) {
endpoint := fmt.Sprintf("%s", ts.URL)
- result, err := Signin(context.DnoteCtx{APIEndpoint: endpoint, HTTPClient: testClient}, "alice@example.com", "pass1234")
+ result, err := Signin(context.DnoteCtx{APIEndpoint: endpoint}, "alice@example.com", "pass1234")
assert.Equal(t, errors.Cause(err), ErrContentTypeMismatch, "error cause mismatch")
assert.Equal(t, result.Key, "", "Key mismatch")
assert.Equal(t, result.ExpiresAt, int64(0), "ExpiresAt mismatch")
})
-
- t.Run("network error", func(t *testing.T) {
- // Use an invalid endpoint that will fail to connect
- endpoint := "http://localhost:99999/api"
- result, err := Signin(context.DnoteCtx{APIEndpoint: endpoint, HTTPClient: testClient}, "alice@example.com", "pass1234")
-
- if err == nil {
- t.Error("error should have been returned for network failure")
- }
- assert.Equal(t, result.Key, "", "Key mismatch")
- assert.Equal(t, result.ExpiresAt, int64(0), "ExpiresAt mismatch")
- })
}
func TestSignOut(t *testing.T) {
@@ -147,18 +116,17 @@ func TestSignOut(t *testing.T) {
defer commonTs.Close()
correctEndpoint := fmt.Sprintf("%s/api", ts.URL)
- testClient := NewRateLimitedHTTPClient()
t.Run("success", func(t *testing.T) {
- err := Signout(context.DnoteCtx{SessionKey: "somekey", APIEndpoint: correctEndpoint, HTTPClient: testClient}, "alice@example.com")
+ err := Signout(context.DnoteCtx{SessionKey: "somekey", APIEndpoint: correctEndpoint}, "alice@example.com")
if err != nil {
- t.Errorf("got signout request error: %+v", err.Error())
+ t.Errorf("got signin request error: %+v", err.Error())
}
})
t.Run("server error", func(t *testing.T) {
endpoint := fmt.Sprintf("%s/bad-api", commonTs.URL)
- err := Signout(context.DnoteCtx{SessionKey: "somekey", APIEndpoint: endpoint, HTTPClient: testClient}, "alice@example.com")
+ err := Signout(context.DnoteCtx{SessionKey: "somekey", APIEndpoint: endpoint}, "alice@example.com")
if err == nil {
t.Error("error should have been returned")
}
@@ -166,69 +134,8 @@ func TestSignOut(t *testing.T) {
t.Run("accidentally pointing to a catch-all handler", func(t *testing.T) {
endpoint := fmt.Sprintf("%s", commonTs.URL)
- err := Signout(context.DnoteCtx{SessionKey: "somekey", APIEndpoint: endpoint, HTTPClient: testClient}, "alice@example.com")
+ err := Signout(context.DnoteCtx{SessionKey: "somekey", APIEndpoint: endpoint}, "alice@example.com")
assert.Equal(t, errors.Cause(err), ErrContentTypeMismatch, "error cause mismatch")
})
-
- // Gracefully handle a case where http client was not initialized in the context.
- t.Run("nil HTTPClient", func(t *testing.T) {
- err := Signout(context.DnoteCtx{SessionKey: "somekey", APIEndpoint: correctEndpoint}, "alice@example.com")
- if err != nil {
- t.Errorf("got signout request error: %+v", err.Error())
- }
- })
-}
-
-func TestRateLimitedTransport(t *testing.T) {
- var requestCount atomic.Int32
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- requestCount.Add(1)
- w.WriteHeader(http.StatusOK)
- }))
- defer ts.Close()
-
- transport := &rateLimitedTransport{
- transport: http.DefaultTransport,
- limiter: rate.NewLimiter(10, 5),
- }
- client := &http.Client{Transport: transport}
-
- // Make 10 requests
- start := time.Now()
- numRequests := 10
- for i := range numRequests {
- req, _ := http.NewRequest("GET", ts.URL, nil)
- resp, err := client.Do(req)
- if err != nil {
- t.Fatalf("Request %d failed: %v", i, err)
- }
- resp.Body.Close()
- }
- elapsed := time.Since(start)
-
- // Burst of 5, then 5 more at 10 req/s = 500ms minimum
- if elapsed < 500*time.Millisecond {
- t.Errorf("Rate limit not enforced: 10 requests took %v, expected >= 500ms", elapsed)
- }
-
- assert.Equal(t, int(requestCount.Load()), 10, "request count mismatch")
-}
-
-func TestHTTPError(t *testing.T) {
- t.Run("IsConflict returns true for 409", func(t *testing.T) {
- conflictErr := &HTTPError{
- StatusCode: 409,
- Message: "Conflict",
- }
-
- assert.Equal(t, conflictErr.IsConflict(), true, "IsConflict() should return true for 409")
-
- notFoundErr := &HTTPError{
- StatusCode: 404,
- Message: "Not Found",
- }
-
- assert.Equal(t, notFoundErr.IsConflict(), false, "IsConflict() should return false for 404")
- })
}
diff --git a/pkg/cli/cmd/add/add.go b/pkg/cli/cmd/add/add.go
index 3e6d089d..aee6e8de 100644
--- a/pkg/cli/cmd/add/add.go
+++ b/pkg/cli/cmd/add/add.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package add
@@ -18,7 +21,6 @@ package add
import (
"database/sql"
"time"
- "os"
"github.com/dnote/dnote/pkg/cli/context"
"github.com/dnote/dnote/pkg/cli/database"
@@ -40,14 +42,7 @@ var example = `
dnote add git
* Skip the editor by providing content directly
- dnote add git -c "time is a part of the commit hash"
-
- * Send stdin content to a note
- echo "a branch is just a pointer to a commit" | dnote add git
- # or
- dnote add git << EOF
- pull is fetch with a merge
- EOF`
+ dnote add git -c "time is a part of the commit hash"`
func preRun(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
@@ -79,16 +74,6 @@ func getContent(ctx context.DnoteCtx) (string, error) {
return contentFlag, nil
}
- // check for piped content
- fInfo, _ := os.Stdin.Stat()
- if fInfo.Mode() & os.ModeCharDevice == 0 {
- c, err := ui.ReadStdInput()
- if err != nil {
- return "", errors.Wrap(err, "Failed to get piped input")
- }
- return c, nil
- }
-
fpath, err := ui.GetTmpContentPath(ctx)
if err != nil {
return "", errors.Wrap(err, "getting temporarily content file path")
@@ -131,7 +116,7 @@ func newRun(ctx context.DnoteCtx) infra.RunEFunc {
return err
}
- output.NoteInfo(os.Stdout, info)
+ output.NoteInfo(info)
if err := upgrade.Check(ctx); err != nil {
log.Error(errors.Wrap(err, "automatically checking updates").Error())
@@ -170,7 +155,7 @@ func writeNote(ctx context.DnoteCtx, bookLabel string, content string, ts int64)
return 0, errors.Wrap(err, "generating uuid")
}
- n := database.NewNote(noteUUID, bookUUID, content, ts, 0, 0, false, true)
+ n := database.NewNote(noteUUID, bookUUID, content, ts, 0, 0, false, false, true)
err = n.Insert(tx)
if err != nil {
diff --git a/pkg/cli/cmd/cat/cat.go b/pkg/cli/cmd/cat/cat.go
new file mode 100644
index 00000000..ebc0f6a0
--- /dev/null
+++ b/pkg/cli/cmd/cat/cat.go
@@ -0,0 +1,94 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+package cat
+
+import (
+ "strconv"
+
+ "github.com/dnote/dnote/pkg/cli/context"
+ "github.com/dnote/dnote/pkg/cli/database"
+ "github.com/dnote/dnote/pkg/cli/infra"
+ "github.com/dnote/dnote/pkg/cli/log"
+ "github.com/dnote/dnote/pkg/cli/output"
+ "github.com/pkg/errors"
+ "github.com/spf13/cobra"
+)
+
+var example = `
+ * See the notes with index 2 from a book 'javascript'
+ dnote cat javascript 2
+ `
+
+var deprecationWarning = `and "view" will replace it in the future version.
+
+ Run "dnote view --help" for more information.
+`
+
+func preRun(cmd *cobra.Command, args []string) error {
+ if len(args) != 2 {
+ return errors.New("Incorrect number of arguments")
+ }
+
+ return nil
+}
+
+// NewCmd returns a new cat command
+func NewCmd(ctx context.DnoteCtx) *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "cat ",
+ Aliases: []string{"c"},
+ Short: "See a note",
+ Example: example,
+ RunE: NewRun(ctx),
+ PreRunE: preRun,
+ Deprecated: deprecationWarning,
+ }
+
+ return cmd
+}
+
+// NewRun returns a new run function
+func NewRun(ctx context.DnoteCtx) infra.RunEFunc {
+ return func(cmd *cobra.Command, args []string) error {
+ var noteRowIDArg string
+
+ if len(args) == 2 {
+ log.Plain(log.ColorYellow.Sprintf("DEPRECATED: you no longer need to pass book name to the view command. e.g. `dnote view 123`.\n\n"))
+
+ noteRowIDArg = args[1]
+ } else {
+ noteRowIDArg = args[0]
+ }
+
+ noteRowID, err := strconv.Atoi(noteRowIDArg)
+ if err != nil {
+ return errors.Wrap(err, "invalid rowid")
+ }
+
+ db := ctx.DB
+ info, err := database.GetNoteInfo(db, noteRowID)
+ if err != nil {
+ return err
+ }
+
+ output.NoteInfo(info)
+
+ return nil
+ }
+}
diff --git a/pkg/cli/cmd/edit/book.go b/pkg/cli/cmd/edit/book.go
index ab326e7f..b6371ae8 100644
--- a/pkg/cli/cmd/edit/book.go
+++ b/pkg/cli/cmd/edit/book.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package edit
diff --git a/pkg/cli/cmd/edit/edit.go b/pkg/cli/cmd/edit/edit.go
index 16a7c413..55087ee4 100644
--- a/pkg/cli/cmd/edit/edit.go
+++ b/pkg/cli/cmd/edit/edit.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package edit
diff --git a/pkg/cli/cmd/edit/note.go b/pkg/cli/cmd/edit/note.go
index cb837e11..8c06ea4d 100644
--- a/pkg/cli/cmd/edit/note.go
+++ b/pkg/cli/cmd/edit/note.go
@@ -1,23 +1,26 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package edit
import (
"database/sql"
- "os"
+ "io/ioutil"
"strconv"
"github.com/dnote/dnote/pkg/cli/context"
@@ -42,7 +45,7 @@ func waitEditorNoteContent(ctx context.DnoteCtx, note database.Note) (string, er
return "", errors.Wrap(err, "getting temporarily content file path")
}
- if err := os.WriteFile(fpath, []byte(note.Body), 0644); err != nil {
+ if err := ioutil.WriteFile(fpath, []byte(note.Body), 0644); err != nil {
return "", errors.Wrap(err, "preparing tmp content file")
}
@@ -166,7 +169,7 @@ func runNote(ctx context.DnoteCtx, rowIDArg string) error {
}
log.Success("edited the note\n")
- output.NoteInfo(os.Stdout, noteInfo)
+ output.NoteInfo(noteInfo)
return nil
}
diff --git a/pkg/cli/cmd/find/find.go b/pkg/cli/cmd/find/find.go
index 4723bcb4..91d143d4 100644
--- a/pkg/cli/cmd/find/find.go
+++ b/pkg/cli/cmd/find/find.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package find
diff --git a/pkg/cli/cmd/find/lexer.go b/pkg/cli/cmd/find/lexer.go
index 6115becc..00438c0a 100644
--- a/pkg/cli/cmd/find/lexer.go
+++ b/pkg/cli/cmd/find/lexer.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package find
diff --git a/pkg/cli/cmd/find/lexer_test.go b/pkg/cli/cmd/find/lexer_test.go
index 3a74ad5a..98ff8257 100644
--- a/pkg/cli/cmd/find/lexer_test.go
+++ b/pkg/cli/cmd/find/lexer_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package find
diff --git a/pkg/cli/cmd/login/login.go b/pkg/cli/cmd/login/login.go
index c9b1dfd5..bc68657a 100644
--- a/pkg/cli/cmd/login/login.go
+++ b/pkg/cli/cmd/login/login.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package login
@@ -34,7 +37,7 @@ import (
var example = `
dnote login`
-var usernameFlag, passwordFlag, apiEndpointFlag string
+var usernameFlag, passwordFlag string
// NewCmd returns a new login command
func NewCmd(ctx context.DnoteCtx) *cobra.Command {
@@ -48,7 +51,6 @@ func NewCmd(ctx context.DnoteCtx) *cobra.Command {
f := cmd.Flags()
f.StringVarP(&usernameFlag, "username", "u", "", "email address for authentication")
f.StringVarP(&passwordFlag, "password", "p", "", "password for authentication")
- f.StringVar(&apiEndpointFlag, "apiEndpoint", "", "API endpoint to connect to (defaults to value in config)")
return cmd
}
@@ -124,6 +126,10 @@ func getBaseURL(rawURL string) (string, error) {
}
func getServerDisplayURL(ctx context.DnoteCtx) string {
+ if ctx.APIEndpoint == "https://api.getdnote.com" {
+ return "https://www.getdnote.com"
+ }
+
baseURL, err := getBaseURL(ctx.APIEndpoint)
if err != nil {
return ""
@@ -133,7 +139,7 @@ func getServerDisplayURL(ctx context.DnoteCtx) string {
}
func getGreeting(ctx context.DnoteCtx) string {
- base := "Welcome to Dnote"
+ base := "Welcome to Dnote Pro"
serverURL := getServerDisplayURL(ctx)
if serverURL == "" {
@@ -145,11 +151,6 @@ func getGreeting(ctx context.DnoteCtx) string {
func newRun(ctx context.DnoteCtx) infra.RunEFunc {
return func(cmd *cobra.Command, args []string) error {
- // Override APIEndpoint if flag was provided
- if apiEndpointFlag != "" {
- ctx.APIEndpoint = apiEndpointFlag
- }
-
greeting := getGreeting(ctx)
log.Plain(greeting)
diff --git a/pkg/cli/cmd/login/login_test.go b/pkg/cli/cmd/login/login_test.go
index 6d5917cc..d48202ce 100644
--- a/pkg/cli/cmd/login/login_test.go
+++ b/pkg/cli/cmd/login/login_test.go
@@ -1,18 +1,3 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package login
import (
@@ -28,6 +13,10 @@ func TestGetServerDisplayURL(t *testing.T) {
apiEndpoint string
expected string
}{
+ {
+ apiEndpoint: "https://api.getdnote.com",
+ expected: "https://www.getdnote.com",
+ },
{
apiEndpoint: "https://dnote.mydomain.com/api",
expected: "https://dnote.mydomain.com",
diff --git a/pkg/cli/cmd/logout/logout.go b/pkg/cli/cmd/logout/logout.go
index 98cd69eb..635034b6 100644
--- a/pkg/cli/cmd/logout/logout.go
+++ b/pkg/cli/cmd/logout/logout.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package logout
@@ -34,8 +37,6 @@ var ErrNotLoggedIn = errors.New("not logged in")
var example = `
dnote logout`
-var apiEndpointFlag string
-
// NewCmd returns a new logout command
func NewCmd(ctx context.DnoteCtx) *cobra.Command {
cmd := &cobra.Command{
@@ -45,9 +46,6 @@ func NewCmd(ctx context.DnoteCtx) *cobra.Command {
RunE: newRun(ctx),
}
- f := cmd.Flags()
- f.StringVar(&apiEndpointFlag, "apiEndpoint", "", "API endpoint to connect to (defaults to value in config)")
-
return cmd
}
@@ -86,11 +84,6 @@ func Do(ctx context.DnoteCtx) error {
func newRun(ctx context.DnoteCtx) infra.RunEFunc {
return func(cmd *cobra.Command, args []string) error {
- // Override APIEndpoint if flag was provided
- if apiEndpointFlag != "" {
- ctx.APIEndpoint = apiEndpointFlag
- }
-
err := Do(ctx)
if err == ErrNotLoggedIn {
log.Error("not logged in\n")
diff --git a/pkg/cli/cmd/view/book.go b/pkg/cli/cmd/ls/ls.go
similarity index 50%
rename from pkg/cli/cmd/view/book.go
rename to pkg/cli/cmd/ls/ls.go
index 698a7de5..86294856 100644
--- a/pkg/cli/cmd/view/book.go
+++ b/pkg/cli/cmd/ls/ls.go
@@ -1,31 +1,91 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
-package view
+package ls
import (
"database/sql"
"fmt"
- "io"
"strings"
"github.com/dnote/dnote/pkg/cli/context"
+ "github.com/dnote/dnote/pkg/cli/infra"
"github.com/dnote/dnote/pkg/cli/log"
"github.com/pkg/errors"
+ "github.com/spf13/cobra"
)
+var example = `
+ * List all books
+ dnote ls
+
+ * List notes in a book
+ dnote ls javascript
+ `
+
+var deprecationWarning = `and "view" will replace it in the future version.
+
+Run "dnote view --help" for more information.
+`
+
+func preRun(cmd *cobra.Command, args []string) error {
+ if len(args) > 1 {
+ return errors.New("Incorrect number of argument")
+ }
+
+ return nil
+}
+
+// NewCmd returns a new ls command
+func NewCmd(ctx context.DnoteCtx) *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "ls ",
+ Aliases: []string{"l", "notes"},
+ Short: "List all notes",
+ Example: example,
+ RunE: NewRun(ctx, false),
+ PreRunE: preRun,
+ Deprecated: deprecationWarning,
+ }
+
+ return cmd
+}
+
+// NewRun returns a new run function for ls
+func NewRun(ctx context.DnoteCtx, nameOnly bool) infra.RunEFunc {
+ return func(cmd *cobra.Command, args []string) error {
+ if len(args) == 0 {
+ if err := printBooks(ctx, nameOnly); err != nil {
+ return errors.Wrap(err, "viewing books")
+ }
+
+ return nil
+ }
+
+ bookName := args[0]
+ if err := printNotes(ctx, bookName); err != nil {
+ return errors.Wrapf(err, "viewing book '%s'", bookName)
+ }
+
+ return nil
+ }
+}
+
// bookInfo is an information about the book to be printed on screen
type bookInfo struct {
BookLabel string
@@ -40,13 +100,15 @@ type noteInfo struct {
// getNewlineIdx returns the index of newline character in a string
func getNewlineIdx(str string) int {
- // Check for \r\n first
- if idx := strings.Index(str, "\r\n"); idx != -1 {
- return idx
+ var ret int
+
+ ret = strings.Index(str, "\n")
+
+ if ret == -1 {
+ ret = strings.Index(str, "\r\n")
}
- // Then check for \n
- return strings.Index(str, "\n")
+ return ret
}
// formatBody returns an excerpt of the given raw note content and a boolean
@@ -64,15 +126,15 @@ func formatBody(noteBody string) (string, bool) {
return strings.Trim(trimmed, " "), false
}
-func printBookLine(w io.Writer, info bookInfo, nameOnly bool) {
+func printBookLine(info bookInfo, nameOnly bool) {
if nameOnly {
- fmt.Fprintln(w, info.BookLabel)
+ fmt.Println(info.BookLabel)
} else {
- fmt.Fprintf(w, "%s %s\n", info.BookLabel, log.ColorYellow.Sprintf("(%d)", info.NoteCount))
+ log.Printf("%s %s\n", info.BookLabel, log.ColorYellow.Sprintf("(%d)", info.NoteCount))
}
}
-func listBooks(ctx context.DnoteCtx, w io.Writer, nameOnly bool) error {
+func printBooks(ctx context.DnoteCtx, nameOnly bool) error {
db := ctx.DB
rows, err := db.Query(`SELECT books.label, count(notes.uuid) note_count
@@ -98,13 +160,13 @@ func listBooks(ctx context.DnoteCtx, w io.Writer, nameOnly bool) error {
}
for _, info := range infos {
- printBookLine(w, info, nameOnly)
+ printBookLine(info, nameOnly)
}
return nil
}
-func listNotes(ctx context.DnoteCtx, w io.Writer, bookName string) error {
+func printNotes(ctx context.DnoteCtx, bookName string) error {
db := ctx.DB
var bookUUID string
@@ -132,7 +194,7 @@ func listNotes(ctx context.DnoteCtx, w io.Writer, bookName string) error {
infos = append(infos, info)
}
- fmt.Fprintf(w, "on book %s\n", bookName)
+ log.Infof("on book %s\n", bookName)
for _, info := range infos {
body, isExcerpt := formatBody(info.Body)
@@ -142,7 +204,7 @@ func listNotes(ctx context.DnoteCtx, w io.Writer, bookName string) error {
body = fmt.Sprintf("%s %s", body, log.ColorYellow.Sprintf("[---More---]"))
}
- fmt.Fprintf(w, "%s %s\n", rowid, body)
+ log.Plainf("%s %s\n", rowid, body)
}
return nil
diff --git a/pkg/cli/cmd/remove/remove.go b/pkg/cli/cmd/remove/remove.go
index 18224c0f..c6fbc62a 100644
--- a/pkg/cli/cmd/remove/remove.go
+++ b/pkg/cli/cmd/remove/remove.go
@@ -1,23 +1,25 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package remove
import (
"fmt"
- "os"
"strconv"
"github.com/dnote/dnote/pkg/cli/context"
@@ -130,7 +132,7 @@ func runNote(ctx context.DnoteCtx, rowIDArg string) error {
return err
}
- output.NoteInfo(os.Stdout, noteInfo)
+ output.NoteInfo(noteInfo)
ok, err := maybeConfirm("remove this note?", false)
if err != nil {
diff --git a/pkg/cli/cmd/root/root.go b/pkg/cli/cmd/root/root.go
index 6da096bf..5076e709 100644
--- a/pkg/cli/cmd/root/root.go
+++ b/pkg/cli/cmd/root/root.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package root
@@ -19,30 +22,11 @@ import (
"github.com/spf13/cobra"
)
-var dbPathFlag string
-
var root = &cobra.Command{
Use: "dnote",
- Short: "Dnote - a simple command line notebook",
+ Short: "Dnote - Instantly capture what you learn while coding",
SilenceErrors: true,
SilenceUsage: true,
- CompletionOptions: cobra.CompletionOptions{
- DisableDefaultCmd: true,
- },
-}
-
-func init() {
- root.PersistentFlags().StringVar(&dbPathFlag, "dbPath", "", "the path to the database file (defaults to standard location)")
-}
-
-// GetRoot returns the root command
-func GetRoot() *cobra.Command {
- return root
-}
-
-// GetDBPathFlag returns the value of the --dbPath flag
-func GetDBPathFlag() string {
- return dbPathFlag
}
// Register adds a new command
diff --git a/pkg/cli/cmd/sync/merge.go b/pkg/cli/cmd/sync/merge.go
index 0e4d15be..0e9c93eb 100644
--- a/pkg/cli/cmd/sync/merge.go
+++ b/pkg/cli/cmd/sync/merge.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package sync
diff --git a/pkg/cli/cmd/sync/merge_test.go b/pkg/cli/cmd/sync/merge_test.go
index e6f4839e..f2954581 100644
--- a/pkg/cli/cmd/sync/merge_test.go
+++ b/pkg/cli/cmd/sync/merge_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package sync
@@ -128,12 +131,9 @@ fuuz
expected: `foo
<<<<<<< Local
quz
-=======
-quzz
->>>>>>> Server
-<<<<<<< Local
baz
=======
+quzz
bazz
>>>>>>> Server
bar
diff --git a/pkg/cli/cmd/sync/sync.go b/pkg/cli/cmd/sync/sync.go
index 6cb506ae..f5df00f3 100644
--- a/pkg/cli/cmd/sync/sync.go
+++ b/pkg/cli/cmd/sync/sync.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package sync
@@ -26,7 +29,6 @@ import (
"github.com/dnote/dnote/pkg/cli/infra"
"github.com/dnote/dnote/pkg/cli/log"
"github.com/dnote/dnote/pkg/cli/migrate"
- "github.com/dnote/dnote/pkg/cli/ui"
"github.com/dnote/dnote/pkg/cli/upgrade"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -41,7 +43,6 @@ var example = `
dnote sync`
var isFullSync bool
-var apiEndpointFlag string
// NewCmd returns a new sync command
func NewCmd(ctx context.DnoteCtx) *cobra.Command {
@@ -55,7 +56,6 @@ func NewCmd(ctx context.DnoteCtx) *cobra.Command {
f := cmd.Flags()
f.BoolVarP(&isFullSync, "full", "f", false, "perform a full sync instead of incrementally syncing only the changed data.")
- f.StringVar(&apiEndpointFlag, "apiEndpoint", "", "API endpoint to connect to (defaults to value in config)")
return cmd
}
@@ -87,7 +87,6 @@ type syncList struct {
ExpungedNotes map[string]bool
ExpungedBooks map[string]bool
MaxUSN int
- UserMaxUSN int // Server's actual max USN (for distinguishing empty fragment vs empty server)
MaxCurrentTime int64
}
@@ -95,14 +94,14 @@ func (l syncList) getLength() int {
return len(l.Notes) + len(l.Books) + len(l.ExpungedNotes) + len(l.ExpungedBooks)
}
-// processFragments categorizes items in sync fragments into a sync list.
+// processFragments categorizes items in sync fragments into a sync list. It also decrypts any
+// encrypted data in sync fragments.
func processFragments(fragments []client.SyncFragment) (syncList, error) {
notes := map[string]client.SyncFragNote{}
books := map[string]client.SyncFragBook{}
expungedNotes := map[string]bool{}
expungedBooks := map[string]bool{}
var maxUSN int
- var userMaxUSN int
var maxCurrentTime int64
for _, fragment := range fragments {
@@ -122,9 +121,6 @@ func processFragments(fragments []client.SyncFragment) (syncList, error) {
if fragment.FragMaxUSN > maxUSN {
maxUSN = fragment.FragMaxUSN
}
- if fragment.UserMaxUSN > userMaxUSN {
- userMaxUSN = fragment.UserMaxUSN
- }
if fragment.CurrentTime > maxCurrentTime {
maxCurrentTime = fragment.CurrentTime
}
@@ -136,7 +132,6 @@ func processFragments(fragments []client.SyncFragment) (syncList, error) {
ExpungedNotes: expungedNotes,
ExpungedBooks: expungedBooks,
MaxUSN: maxUSN,
- UserMaxUSN: userMaxUSN,
MaxCurrentTime: maxCurrentTime,
}
@@ -183,68 +178,11 @@ func getSyncFragments(ctx context.DnoteCtx, afterUSN int) ([]client.SyncFragment
}
}
- log.Debug("received sync fragments: %+v\n", redactSyncFragments(buf))
+ log.Debug("received sync fragments: %+v\n", buf)
return buf, nil
}
-// redactSyncFragments returns a deep copy of sync fragments with sensitive fields (note body, book label) removed for safe logging
-func redactSyncFragments(fragments []client.SyncFragment) []client.SyncFragment {
- redacted := make([]client.SyncFragment, len(fragments))
- for i, frag := range fragments {
- // Create new notes with redacted bodies
- notes := make([]client.SyncFragNote, len(frag.Notes))
- for j, note := range frag.Notes {
- notes[j] = client.SyncFragNote{
- UUID: note.UUID,
- BookUUID: note.BookUUID,
- USN: note.USN,
- CreatedAt: note.CreatedAt,
- UpdatedAt: note.UpdatedAt,
- AddedOn: note.AddedOn,
- EditedOn: note.EditedOn,
- Body: func() string {
- if note.Body != "" {
- return ""
- }
- return ""
- }(),
- Deleted: note.Deleted,
- }
- }
-
- // Create new books with redacted labels
- books := make([]client.SyncFragBook, len(frag.Books))
- for j, book := range frag.Books {
- books[j] = client.SyncFragBook{
- UUID: book.UUID,
- USN: book.USN,
- CreatedAt: book.CreatedAt,
- UpdatedAt: book.UpdatedAt,
- AddedOn: book.AddedOn,
- Label: func() string {
- if book.Label != "" {
- return ""
- }
- return ""
- }(),
- Deleted: book.Deleted,
- }
- }
-
- redacted[i] = client.SyncFragment{
- FragMaxUSN: frag.FragMaxUSN,
- UserMaxUSN: frag.UserMaxUSN,
- CurrentTime: frag.CurrentTime,
- Notes: notes,
- Books: books,
- ExpungedNotes: frag.ExpungedNotes,
- ExpungedBooks: frag.ExpungedBooks,
- }
- }
- return redacted
-}
-
// resolveLabel resolves a book label conflict by repeatedly appending an increasing integer
// to the label until it finds a unique label. It returns the first non-conflicting label.
func resolveLabel(tx *database.DB, label string) (string, error) {
@@ -281,7 +219,7 @@ func mergeBook(tx *database.DB, b client.SyncFragBook, mode int) error {
return errors.Wrap(err, "getting a new book label for conflict resolution")
}
- if _, err := tx.Exec("UPDATE books SET label = ?, dirty = ? WHERE label = ? AND uuid != ?", newLabel, true, b.Label, b.UUID); err != nil {
+ if _, err := tx.Exec("UPDATE books SET label = ?, dirty = ? WHERE label = ?", newLabel, true, b.Label); err != nil {
return errors.Wrap(err, "resolving duplicate book label")
}
}
@@ -340,8 +278,8 @@ func mergeNote(tx *database.DB, serverNote client.SyncFragNote, localNote databa
// if the local copy is deleted, and it was edited on the server, override with server values and mark it not dirty.
if localNote.Deleted {
- if _, err := tx.Exec("UPDATE notes SET usn = ?, book_uuid = ?, body = ?, edited_on = ?, deleted = ?, dirty = ? WHERE uuid = ?",
- serverNote.USN, serverNote.BookUUID, serverNote.Body, serverNote.EditedOn, serverNote.Deleted, false, serverNote.UUID); err != nil {
+ if _, err := tx.Exec("UPDATE notes SET usn = ?, book_uuid = ?, body = ?, edited_on = ?, deleted = ?, public = ?, dirty = ? WHERE uuid = ?",
+ serverNote.USN, serverNote.BookUUID, serverNote.Body, serverNote.EditedOn, serverNote.Deleted, serverNote.Public, false, serverNote.UUID); err != nil {
return errors.Wrapf(err, "updating local note %s", serverNote.UUID)
}
@@ -371,7 +309,7 @@ func stepSyncNote(tx *database.DB, n client.SyncFragNote) error {
// if note exists in the server and does not exist in the client, insert the note.
if err == sql.ErrNoRows {
- note := database.NewNote(n.UUID, n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Deleted, false)
+ note := database.NewNote(n.UUID, n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Public, n.Deleted, false)
if err := note.Insert(tx); err != nil {
return errors.Wrapf(err, "inserting note with uuid %s", n.UUID)
@@ -395,7 +333,7 @@ func fullSyncNote(tx *database.DB, n client.SyncFragNote) error {
// if note exists in the server and does not exist in the client, insert the note.
if err == sql.ErrNoRows {
- note := database.NewNote(n.UUID, n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Deleted, false)
+ note := database.NewNote(n.UUID, n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Public, n.Deleted, false)
if err := note.Insert(tx); err != nil {
return errors.Wrapf(err, "inserting note with uuid %s", n.UUID)
@@ -600,8 +538,6 @@ func fullSync(ctx context.DnoteCtx, tx *database.DB) error {
log.Debug("performing a full sync\n")
log.Info("resolving delta.")
- log.DebugNewline()
-
list, err := getSyncList(ctx, 0)
if err != nil {
return errors.Wrap(err, "getting sync list")
@@ -609,8 +545,6 @@ func fullSync(ctx context.DnoteCtx, tx *database.DB) error {
fmt.Printf(" (total %d).", list.getLength())
- log.DebugNewline()
-
// clean resources that are in erroneous states
if err := cleanLocalNotes(tx, &list); err != nil {
return errors.Wrap(err, "cleaning up local notes")
@@ -641,7 +575,7 @@ func fullSync(ctx context.DnoteCtx, tx *database.DB) error {
}
}
- err = saveSyncState(tx, list.MaxCurrentTime, list.MaxUSN, list.UserMaxUSN)
+ err = saveSyncState(tx, list.MaxCurrentTime, list.MaxUSN)
if err != nil {
return errors.Wrap(err, "saving sync state")
}
@@ -656,8 +590,6 @@ func stepSync(ctx context.DnoteCtx, tx *database.DB, afterUSN int) error {
log.Info("resolving delta.")
- log.DebugNewline()
-
list, err := getSyncList(ctx, afterUSN)
if err != nil {
return errors.Wrap(err, "getting sync list")
@@ -687,7 +619,7 @@ func stepSync(ctx context.DnoteCtx, tx *database.DB, afterUSN int) error {
}
}
- err = saveSyncState(tx, list.MaxCurrentTime, list.MaxUSN, list.UserMaxUSN)
+ err = saveSyncState(tx, list.MaxCurrentTime, list.MaxUSN)
if err != nil {
return errors.Wrap(err, "saving sync state")
}
@@ -697,20 +629,6 @@ func stepSync(ctx context.DnoteCtx, tx *database.DB, afterUSN int) error {
return nil
}
-// isConflictError checks if an error is a 409 Conflict error from the server
-func isConflictError(err error) bool {
- if err == nil {
- return false
- }
-
- var httpErr *client.HTTPError
- if errors.As(err, &httpErr) {
- return httpErr.IsConflict()
- }
-
- return false
-}
-
func sendBooks(ctx context.DnoteCtx, tx *database.DB) (bool, error) {
isBehind := false
@@ -743,9 +661,7 @@ func sendBooks(ctx context.DnoteCtx, tx *database.DB) (bool, error) {
} else {
resp, err := client.CreateBook(ctx, book.Label)
if err != nil {
- log.Debug("error creating book (will retry after stepSync): %v\n", err)
- isBehind = true
- continue
+ return isBehind, errors.Wrap(err, "creating a book")
}
_, err = tx.Exec("UPDATE notes SET book_uuid = ? WHERE book_uuid = ?", resp.Book.UUID, book.UUID)
@@ -817,92 +733,10 @@ func sendBooks(ctx context.DnoteCtx, tx *database.DB) (bool, error) {
return isBehind, nil
}
-// findOrphanedNotes returns a list of all orphaned notes
-func findOrphanedNotes(db *database.DB) (int, []struct{ noteUUID, bookUUID string }, error) {
- var orphanCount int
- err := db.QueryRow(`
- SELECT COUNT(*) FROM notes n
- WHERE NOT EXISTS (
- SELECT 1 FROM books b
- WHERE b.uuid = n.book_uuid
- AND NOT b.deleted
- )
- `).Scan(&orphanCount)
- if err != nil {
- return 0, nil, err
- }
-
- if orphanCount == 0 {
- return 0, nil, nil
- }
-
- rows, err := db.Query(`
- SELECT n.uuid, n.book_uuid
- FROM notes n
- WHERE NOT EXISTS (
- SELECT 1 FROM books b
- WHERE b.uuid = n.book_uuid
- AND NOT b.deleted
- )
- `)
- if err != nil {
- return orphanCount, nil, err
- }
- defer rows.Close()
-
- var orphans []struct{ noteUUID, bookUUID string }
- for rows.Next() {
- var noteUUID, bookUUID string
- if err := rows.Scan(¬eUUID, &bookUUID); err != nil {
- continue
- }
- orphans = append(orphans, struct{ noteUUID, bookUUID string }{noteUUID, bookUUID})
- }
-
- return orphanCount, orphans, nil
-}
-
-func warnOrphanedNotes(tx *database.DB) {
- count, orphans, err := findOrphanedNotes(tx)
- if err != nil {
- log.Debug("error checking orphaned notes: %v\n", err)
- return
- }
-
- if count == 0 {
- return
- }
-
- log.Debug("Found %d orphaned notes (book doesn't exist locally):\n", count)
- for _, o := range orphans {
- log.Debug("note %s (book %s)\n", o.noteUUID, o.bookUUID)
- }
-}
-
-// checkPostSyncIntegrity checks for data integrity issues after sync and warns the user
-func checkPostSyncIntegrity(db *database.DB) {
- count, orphans, err := findOrphanedNotes(db)
- if err != nil {
- log.Debug("error checking orphaned notes: %v\n", err)
- return
- }
-
- if count == 0 {
- return
- }
-
- log.Warnf("Found %d orphaned notes (referencing non-existent or deleted books):\n", count)
- for _, o := range orphans {
- log.Plainf(" - note %s (missing book: %s)\n", o.noteUUID, o.bookUUID)
- }
-}
-
func sendNotes(ctx context.DnoteCtx, tx *database.DB) (bool, error) {
isBehind := false
- warnOrphanedNotes(tx)
-
- rows, err := tx.Query("SELECT uuid, book_uuid, body, deleted, usn, added_on FROM notes WHERE dirty")
+ rows, err := tx.Query("SELECT uuid, book_uuid, body, public, deleted, usn, added_on FROM notes WHERE dirty")
if err != nil {
return isBehind, errors.Wrap(err, "getting syncable notes")
}
@@ -911,11 +745,11 @@ func sendNotes(ctx context.DnoteCtx, tx *database.DB) (bool, error) {
for rows.Next() {
var note database.Note
- if err = rows.Scan(¬e.UUID, ¬e.BookUUID, ¬e.Body, ¬e.Deleted, ¬e.USN, ¬e.AddedOn); err != nil {
+ if err = rows.Scan(¬e.UUID, ¬e.BookUUID, ¬e.Body, ¬e.Public, ¬e.Deleted, ¬e.USN, ¬e.AddedOn); err != nil {
return isBehind, errors.Wrap(err, "scanning a syncable note")
}
- log.Debug("sending note %s (book: %s)\n", note.UUID, note.BookUUID)
+ log.Debug("sending note %s\n", note.UUID)
var respUSN int
@@ -932,9 +766,7 @@ func sendNotes(ctx context.DnoteCtx, tx *database.DB) (bool, error) {
} else {
resp, err := client.CreateNote(ctx, note.BookUUID, note.Body)
if err != nil {
- log.Debug("failed to create note %s (book: %s): %v\n", note.UUID, note.BookUUID, err)
- isBehind = true
- continue
+ return isBehind, errors.Wrap(err, "creating a note")
}
note.Dirty = false
@@ -965,7 +797,7 @@ func sendNotes(ctx context.DnoteCtx, tx *database.DB) (bool, error) {
respUSN = resp.Result.USN
} else {
- resp, err := client.UpdateNote(ctx, note.UUID, note.BookUUID, note.Body)
+ resp, err := client.UpdateNote(ctx, note.UUID, note.BookUUID, note.Body, note.Public)
if err != nil {
return isBehind, errors.Wrap(err, "updating a note")
}
@@ -1009,8 +841,6 @@ func sendChanges(ctx context.DnoteCtx, tx *database.DB) (bool, error) {
fmt.Printf(" (total %d).", delta)
- log.DebugNewline()
-
behind1, err := sendBooks(ctx, tx)
if err != nil {
return behind1, errors.Wrap(err, "sending books")
@@ -1044,24 +874,10 @@ func updateLastSyncAt(tx *database.DB, val int64) error {
return nil
}
-func saveSyncState(tx *database.DB, serverTime int64, serverMaxUSN int, userMaxUSN int) error {
- // Handle last_max_usn update based on server state:
- // - If serverMaxUSN > 0: we got data, update to serverMaxUSN
- // - If serverMaxUSN == 0 && userMaxUSN > 0: empty fragment (caught up), preserve existing
- // - If serverMaxUSN == 0 && userMaxUSN == 0: empty server, reset to 0
- if serverMaxUSN > 0 {
- if err := updateLastMaxUSN(tx, serverMaxUSN); err != nil {
- return errors.Wrap(err, "updating last max usn")
- }
- } else if userMaxUSN == 0 {
- // Server is empty, reset to 0
- if err := updateLastMaxUSN(tx, 0); err != nil {
- return errors.Wrap(err, "updating last max usn")
- }
+func saveSyncState(tx *database.DB, serverTime int64, serverMaxUSN int) error {
+ if err := updateLastMaxUSN(tx, serverMaxUSN); err != nil {
+ return errors.Wrap(err, "updating last max usn")
}
- // else: empty fragment but server has data, preserve existing last_max_usn
-
- // Always update last_sync_at (we did communicate with server)
if err := updateLastSyncAt(tx, serverTime); err != nil {
return errors.Wrap(err, "updating last sync at")
}
@@ -1069,33 +885,8 @@ func saveSyncState(tx *database.DB, serverTime int64, serverMaxUSN int, userMaxU
return nil
}
-// prepareEmptyServerSync marks all local books and notes as dirty when syncing to an empty server.
-// This is typically used when switching to a new empty server but wanting to upload existing local data.
-// Returns true if preparation was done, false otherwise.
-func prepareEmptyServerSync(tx *database.DB) error {
- // Mark all books and notes as dirty and reset USN to 0
- if _, err := tx.Exec("UPDATE books SET usn = 0, dirty = 1 WHERE deleted = 0"); err != nil {
- return errors.Wrap(err, "marking books as dirty")
- }
- if _, err := tx.Exec("UPDATE notes SET usn = 0, dirty = 1 WHERE deleted = 0"); err != nil {
- return errors.Wrap(err, "marking notes as dirty")
- }
-
- // Reset lastMaxUSN to 0 to match the server
- if err := updateLastMaxUSN(tx, 0); err != nil {
- return errors.Wrap(err, "resetting last max usn")
- }
-
- return nil
-}
-
func newRun(ctx context.DnoteCtx) infra.RunEFunc {
return func(cmd *cobra.Command, args []string) error {
- // Override APIEndpoint if flag was provided
- if apiEndpointFlag != "" {
- ctx.APIEndpoint = apiEndpointFlag
- }
-
if ctx.SessionKey == "" {
return errors.New("not logged in")
}
@@ -1124,74 +915,6 @@ func newRun(ctx context.DnoteCtx) infra.RunEFunc {
log.Debug("lastSyncAt: %d, lastMaxUSN: %d, syncState: %+v\n", lastSyncAt, lastMaxUSN, syncState)
- // Handle a case where server has MaxUSN=0 but local has data (server switch)
- var bookCount, noteCount int
- if err := tx.QueryRow("SELECT count(*) FROM books WHERE deleted = 0").Scan(&bookCount); err != nil {
- return errors.Wrap(err, "counting local books")
- }
- if err := tx.QueryRow("SELECT count(*) FROM notes WHERE deleted = 0").Scan(¬eCount); err != nil {
- return errors.Wrap(err, "counting local notes")
- }
-
- // If a client has previously synced (lastMaxUSN > 0) but the server was never synced to (MaxUSN = 0),
- // and the client has undeleted books or notes, allow to upload all data to the server.
- // The client might have switched servers or the server might need to be restored for any reasons.
- if syncState.MaxUSN == 0 && lastMaxUSN > 0 && (bookCount > 0 || noteCount > 0) {
- log.Debug("empty server detected: server.MaxUSN=%d, local.MaxUSN=%d, books=%d, notes=%d\n",
- syncState.MaxUSN, lastMaxUSN, bookCount, noteCount)
-
- log.Warnf("The server is empty but you have local data. Maybe you switched servers?\n")
- log.Debug("server state: MaxUSN = 0 (empty)\n")
- log.Debug("local state: %d books, %d notes (MaxUSN = %d)\n", bookCount, noteCount, lastMaxUSN)
-
- confirmed, err := ui.Confirm(fmt.Sprintf("Upload %d books and %d notes to the server?", bookCount, noteCount), false)
- if err != nil {
- tx.Rollback()
- return errors.Wrap(err, "getting user confirmation")
- }
-
- if !confirmed {
- tx.Rollback()
- return errors.New("sync cancelled by user")
- }
-
- fmt.Println() // Add newline after confirmation.
-
- if err := prepareEmptyServerSync(tx); err != nil {
- return errors.Wrap(err, "preparing for empty server sync")
- }
-
- // Re-fetch lastMaxUSN after prepareEmptyServerSync
- lastMaxUSN, err = getLastMaxUSN(tx)
- if err != nil {
- return errors.Wrap(err, "getting the last max_usn after prepare")
- }
-
- log.Debug("prepared empty server sync: marked %d books and %d notes as dirty\n", bookCount, noteCount)
- }
-
- // If full sync will be triggered by FullSyncBefore (not manual --full flag),
- // and client has more data than server, prepare local data for upload to avoid orphaning notes.
- // The lastMaxUSN > syncState.MaxUSN check prevents duplicate uploads when switching
- // back to a server that already has our data.
- if !isFullSync && lastSyncAt < syncState.FullSyncBefore && lastMaxUSN > syncState.MaxUSN {
- log.Debug("full sync triggered by FullSyncBefore: preparing local data for upload\n")
- log.Debug("server.FullSyncBefore=%d, local.lastSyncAt=%d, local.MaxUSN=%d, server.MaxUSN=%d, books=%d, notes=%d\n",
- syncState.FullSyncBefore, lastSyncAt, lastMaxUSN, syncState.MaxUSN, bookCount, noteCount)
-
- if err := prepareEmptyServerSync(tx); err != nil {
- return errors.Wrap(err, "preparing local data for full sync")
- }
-
- // Re-fetch lastMaxUSN after prepareEmptyServerSync
- lastMaxUSN, err = getLastMaxUSN(tx)
- if err != nil {
- return errors.Wrap(err, "getting the last max_usn after prepare")
- }
-
- log.Debug("prepared for full sync: marked %d books and %d notes as dirty\n", bookCount, noteCount)
- }
-
var syncErr error
if isFullSync || lastSyncAt < syncState.FullSyncBefore {
syncErr = fullSync(ctx, tx)
@@ -1230,24 +953,12 @@ func newRun(ctx context.DnoteCtx) infra.RunEFunc {
tx.Rollback()
return errors.Wrap(err, "performing the follow-up step sync")
}
-
- // After syncing server changes (which resolves conflicts), send local changes again
- // This uploads books/notes that were skipped due to 409 conflicts
- _, err = sendChanges(ctx, tx)
- if err != nil {
- tx.Rollback()
- return errors.Wrap(err, "sending changes after conflict resolution")
- }
}
- if err := tx.Commit(); err != nil {
- return errors.Wrap(err, "committing transaction")
- }
+ tx.Commit()
log.Success("success\n")
- checkPostSyncIntegrity(ctx.DB)
-
if err := upgrade.Check(ctx); err != nil {
log.Error(errors.Wrap(err, "automatically checking updates").Error())
}
diff --git a/pkg/cli/cmd/sync/sync_test.go b/pkg/cli/cmd/sync/sync_test.go
index ae3b94ff..e5c6457a 100644
--- a/pkg/cli/cmd/sync/sync_test.go
+++ b/pkg/cli/cmd/sync/sync_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package sync
@@ -33,6 +36,8 @@ import (
"github.com/pkg/errors"
)
+var dbPath = "../../tmp/.dnote.db"
+
func TestProcessFragments(t *testing.T) {
fragments := []client.SyncFragment{
{
@@ -67,7 +72,7 @@ func TestProcessFragments(t *testing.T) {
// exec
sl, err := processFragments(fragments)
if err != nil {
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
expected := syncList{
@@ -94,7 +99,6 @@ func TestProcessFragments(t *testing.T) {
ExpungedNotes: map[string]bool{},
ExpungedBooks: map[string]bool{},
MaxUSN: 10,
- UserMaxUSN: 10,
MaxCurrentTime: 1550436136,
}
@@ -104,18 +108,19 @@ func TestProcessFragments(t *testing.T) {
func TestGetLastSyncAt(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, "../../tmp/.dnote", nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "setting up last_sync_at", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastSyncAt, 1541108743)
// exec
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
got, err := getLastSyncAt(tx)
if err != nil {
- t.Fatal(errors.Wrap(err, "getting last_sync_at").Error())
+ t.Fatalf(errors.Wrap(err, "getting last_sync_at").Error())
}
tx.Commit()
@@ -126,18 +131,19 @@ func TestGetLastSyncAt(t *testing.T) {
func TestGetLastMaxUSN(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, "../../tmp/.dnote", nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "setting up last_max_usn", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastMaxUSN, 20001)
// exec
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
got, err := getLastMaxUSN(tx)
if err != nil {
- t.Fatal(errors.Wrap(err, "getting last_max_usn").Error())
+ t.Fatalf(errors.Wrap(err, "getting last_max_usn").Error())
}
tx.Commit()
@@ -172,7 +178,8 @@ func TestResolveLabel(t *testing.T) {
for idx, tc := range testCases {
func() {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, "../../tmp/.dnote", nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, fmt.Sprintf("inserting book for test case %d", idx), db, "INSERT INTO books (uuid, label) VALUES (?, ?)", "b1-uuid", "js")
database.MustExec(t, fmt.Sprintf("inserting book for test case %d", idx), db, "INSERT INTO books (uuid, label) VALUES (?, ?)", "b2-uuid", "css_2")
@@ -184,12 +191,12 @@ func TestResolveLabel(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
got, err := resolveLabel(tx, tc.input)
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Rollback()
@@ -201,17 +208,18 @@ func TestResolveLabel(t *testing.T) {
func TestSyncDeleteNote(t *testing.T) {
t.Run("exists on server only", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := syncDeleteNote(tx, "nonexistent-note-uuid"); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -229,7 +237,8 @@ func TestSyncDeleteNote(t *testing.T) {
b1UUID := testutils.MustGenerateUUID(t)
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting b1 for test case %d", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1-label")
database.MustExec(t, "inserting n1 for test case %d", db, "INSERT INTO notes (uuid, book_uuid, usn, body, added_on, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?)", "n1-uuid", b1UUID, 10, "n1 body", 1541108743, false, true)
@@ -247,12 +256,12 @@ func TestSyncDeleteNote(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction for test case").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction for test case").Error())
}
if err := syncDeleteNote(tx, "n1-uuid"); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -298,7 +307,8 @@ func TestSyncDeleteNote(t *testing.T) {
b1UUID := testutils.MustGenerateUUID(t)
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting b1 for test case %d", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1-label")
database.MustExec(t, "inserting n1 for test case %d", db, "INSERT INTO notes (uuid, book_uuid, usn, body, added_on, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?)", "n1-uuid", b1UUID, 10, "n1 body", 1541108743, false, false)
@@ -316,12 +326,12 @@ func TestSyncDeleteNote(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction for test case").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction for test case").Error())
}
if err := syncDeleteNote(tx, "n1-uuid"); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -353,7 +363,8 @@ func TestSyncDeleteNote(t *testing.T) {
func TestSyncDeleteBook(t *testing.T) {
t.Run("exists on server only", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting b1 for test case %d", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", "b1-uuid", "b1-label")
var b1 database.Book
@@ -364,12 +375,12 @@ func TestSyncDeleteBook(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := syncDeleteBook(tx, "nonexistent-book-uuid"); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -397,7 +408,8 @@ func TestSyncDeleteBook(t *testing.T) {
b1UUID := testutils.MustGenerateUUID(t)
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting b1 for test case %d", db, "INSERT INTO books (uuid, label, usn, dirty) VALUES (?, ?, ?, ?)", b1UUID, "b1-label", 12, true)
database.MustExec(t, "inserting n1 for test case %d", db, "INSERT INTO notes (uuid, book_uuid, usn, body, added_on, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?)", "n1-uuid", b1UUID, 10, "n1 body", 1541108743, false, true)
@@ -414,12 +426,12 @@ func TestSyncDeleteBook(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction for test case").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction for test case").Error())
}
if err := syncDeleteBook(tx, b1UUID); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -462,7 +474,8 @@ func TestSyncDeleteBook(t *testing.T) {
b2UUID := testutils.MustGenerateUUID(t)
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting b1 for test case %d", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1-label")
database.MustExec(t, "inserting n1 for test case %d", db, "INSERT INTO notes (uuid, book_uuid, usn, body, added_on, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?)", "n1-uuid", b1UUID, 10, "n1 body", 1541108743, false, false)
@@ -481,12 +494,12 @@ func TestSyncDeleteBook(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction for test case").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction for test case").Error())
}
if err := syncDeleteBook(tx, b1UUID); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -527,7 +540,8 @@ func TestSyncDeleteBook(t *testing.T) {
b1UUID := testutils.MustGenerateUUID(t)
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting b1 for test case %d", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1-label")
database.MustExec(t, "inserting n1 for test case %d", db, "INSERT INTO notes (uuid, book_uuid, usn, body, added_on, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?)", "n1-uuid", b1UUID, 10, "n1 body", 1541108743, false, true)
@@ -535,12 +549,12 @@ func TestSyncDeleteBook(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction for test case").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction for test case").Error())
}
if err := syncDeleteBook(tx, b1UUID); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -578,7 +592,8 @@ func TestSyncDeleteBook(t *testing.T) {
func TestFullSyncNote(t *testing.T) {
t.Run("exists on server only", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1-label")
@@ -586,7 +601,7 @@ func TestFullSyncNote(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
n := client.SyncFragNote{
@@ -601,7 +616,7 @@ func TestFullSyncNote(t *testing.T) {
if err := fullSyncNote(tx, n); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -809,7 +824,8 @@ n1 body edited
for idx, tc := range testCases {
func() {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, fmt.Sprintf("inserting b1 for test case %d", idx), db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1-label")
database.MustExec(t, fmt.Sprintf("inserting b2 for test case %d", idx), db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b2UUID, "b2-label")
@@ -820,7 +836,7 @@ n1 body edited
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
// update all fields but uuid and bump usn
@@ -836,7 +852,7 @@ n1 body edited
if err := fullSyncNote(tx, n); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -870,7 +886,8 @@ n1 body edited
func TestFullSyncBook(t *testing.T) {
t.Run("exists on server only", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", b1UUID, 555, "b1-label", true, false)
@@ -878,7 +895,7 @@ func TestFullSyncBook(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
b2UUID := testutils.MustGenerateUUID(t)
@@ -892,7 +909,7 @@ func TestFullSyncBook(t *testing.T) {
if err := fullSyncBook(tx, b); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -1008,7 +1025,8 @@ func TestFullSyncBook(t *testing.T) {
for idx, tc := range testCases {
func() {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, fmt.Sprintf("inserting book for test case %d", idx), db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", b1UUID, tc.clientUSN, tc.clientLabel, tc.clientDirty, tc.clientDeleted)
@@ -1016,7 +1034,7 @@ func TestFullSyncBook(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
// update all fields but uuid and bump usn
@@ -1029,7 +1047,7 @@ func TestFullSyncBook(t *testing.T) {
if err := fullSyncBook(tx, b); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -1060,7 +1078,8 @@ func TestFullSyncBook(t *testing.T) {
func TestStepSyncNote(t *testing.T) {
t.Run("exists on server only", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1-label")
@@ -1068,7 +1087,7 @@ func TestStepSyncNote(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
n := client.SyncFragNote{
@@ -1083,7 +1102,7 @@ func TestStepSyncNote(t *testing.T) {
if err := stepSyncNote(tx, n); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -1217,7 +1236,8 @@ n1 body edited
for idx, tc := range testCases {
func() {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, fmt.Sprintf("inserting b1 for test case %d", idx), db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1-label")
database.MustExec(t, fmt.Sprintf("inserting b2 for test case %d", idx), db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b2UUID, "b2-label")
@@ -1228,7 +1248,7 @@ n1 body edited
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
// update all fields but uuid and bump usn
@@ -1244,7 +1264,7 @@ n1 body edited
if err := stepSyncNote(tx, n); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -1278,7 +1298,8 @@ n1 body edited
func TestStepSyncBook(t *testing.T) {
t.Run("exists on server only", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", b1UUID, 555, "b1-label", true, false)
@@ -1286,7 +1307,7 @@ func TestStepSyncBook(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
b2UUID := testutils.MustGenerateUUID(t)
@@ -1300,7 +1321,7 @@ func TestStepSyncBook(t *testing.T) {
if err := stepSyncBook(tx, b); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -1400,7 +1421,8 @@ func TestStepSyncBook(t *testing.T) {
for idx, tc := range testCases {
func() {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, fmt.Sprintf("inserting book for test case %d", idx), db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", b1UUID, tc.clientUSN, tc.clientLabel, tc.clientDirty, tc.clientDeleted)
@@ -1410,7 +1432,7 @@ func TestStepSyncBook(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
// update all fields but uuid and bump usn
@@ -1423,7 +1445,7 @@ func TestStepSyncBook(t *testing.T) {
if err := fullSyncBook(tx, b); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -1463,12 +1485,13 @@ func TestStepSyncBook(t *testing.T) {
func TestMergeBook(t *testing.T) {
t.Run("insert, no duplicates", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
// test
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
b1 := client.SyncFragBook{
@@ -1481,7 +1504,7 @@ func TestMergeBook(t *testing.T) {
if err := mergeBook(tx, b1, modeInsert); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -1506,13 +1529,14 @@ func TestMergeBook(t *testing.T) {
t.Run("insert, 1 duplicate", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", "b1-uuid", 1, "foo", false, false)
// test
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
b := client.SyncFragBook{
@@ -1525,7 +1549,7 @@ func TestMergeBook(t *testing.T) {
if err := mergeBook(tx, b, modeInsert); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -1557,7 +1581,8 @@ func TestMergeBook(t *testing.T) {
t.Run("insert, 3 duplicates", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", "b1-uuid", 1, "foo", false, false)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", "b2-uuid", 2, "foo_2", true, false)
@@ -1566,7 +1591,7 @@ func TestMergeBook(t *testing.T) {
// test
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
b := client.SyncFragBook{
@@ -1579,7 +1604,7 @@ func TestMergeBook(t *testing.T) {
if err := mergeBook(tx, b, modeInsert); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -1625,12 +1650,13 @@ func TestMergeBook(t *testing.T) {
t.Run("update, no duplicates", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
// test
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
b1UUID := testutils.MustGenerateUUID(t)
@@ -1646,7 +1672,7 @@ func TestMergeBook(t *testing.T) {
if err := mergeBook(tx, b1, modeUpdate); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -1671,7 +1697,8 @@ func TestMergeBook(t *testing.T) {
t.Run("update, 1 duplicate", func(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", "b1-uuid", 1, "foo", false, false)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", "b2-uuid", 2, "bar", false, false)
@@ -1679,7 +1706,7 @@ func TestMergeBook(t *testing.T) {
// test
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
b := client.SyncFragBook{
@@ -1692,7 +1719,7 @@ func TestMergeBook(t *testing.T) {
if err := mergeBook(tx, b, modeUpdate); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -1724,7 +1751,8 @@ func TestMergeBook(t *testing.T) {
t.Run("update, 3 duplicate", func(t *testing.T) {
// set uj
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, dbPath, nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", "b1-uuid", 1, "foo", false, false)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, usn, label, dirty, deleted) VALUES (?, ?, ?, ?, ?)", "b2-uuid", 2, "bar", false, false)
@@ -1734,7 +1762,7 @@ func TestMergeBook(t *testing.T) {
// test
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
b := client.SyncFragBook{
@@ -1747,7 +1775,7 @@ func TestMergeBook(t *testing.T) {
if err := mergeBook(tx, b, modeUpdate); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -1793,132 +1821,44 @@ func TestMergeBook(t *testing.T) {
}
func TestSaveServerState(t *testing.T) {
- t.Run("with data received", func(t *testing.T) {
- // set up
- db := database.InitTestMemoryDB(t)
- testutils.LoginDB(t, db)
+ // set up
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
+ defer context.TeardownTestCtx(t, ctx)
+ testutils.Login(t, &ctx)
- database.MustExec(t, "inserting last synced at", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastSyncAt, int64(1231108742))
- database.MustExec(t, "inserting last max usn", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastMaxUSN, 8)
+ db := ctx.DB
- // execute
- tx, err := db.Begin()
- if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
- }
+ database.MustExec(t, "inserting last synced at", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastSyncAt, int64(1231108742))
+ database.MustExec(t, "inserting last max usn", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastMaxUSN, 8)
- serverTime := int64(1541108743)
- serverMaxUSN := 100
- userMaxUSN := 100
+ // execute
+ tx, err := db.Begin()
+ if err != nil {
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
+ }
- err = saveSyncState(tx, serverTime, serverMaxUSN, userMaxUSN)
- if err != nil {
- tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
- }
+ serverTime := int64(1541108743)
+ serverMaxUSN := 100
- tx.Commit()
+ err = saveSyncState(tx, serverTime, serverMaxUSN)
+ if err != nil {
+ tx.Rollback()
+ t.Fatalf(errors.Wrap(err, "executing").Error())
+ }
- // test
- var lastSyncedAt int64
- var lastMaxUSN int
+ tx.Commit()
- database.MustScan(t, "getting system value",
- db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastSyncAt), &lastSyncedAt)
- database.MustScan(t, "getting system value",
- db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN), &lastMaxUSN)
+ // test
+ var lastSyncedAt int64
+ var lastMaxUSN int
- assert.Equal(t, lastSyncedAt, serverTime, "last synced at mismatch")
- assert.Equal(t, lastMaxUSN, serverMaxUSN, "last max usn mismatch")
- })
+ database.MustScan(t, "getting system value",
+ db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastSyncAt), &lastSyncedAt)
+ database.MustScan(t, "getting system value",
+ db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN), &lastMaxUSN)
- t.Run("with empty fragment but server has data - preserves last_max_usn", func(t *testing.T) {
- // This tests the fix for the infinite sync bug where empty fragments
- // would reset last_max_usn to 0, causing the client to re-download all data.
- // When serverMaxUSN=0 (no data in fragment) but userMaxUSN>0 (server has data),
- // we're caught up and should preserve the existing last_max_usn.
-
- // set up
- db := database.InitTestMemoryDB(t)
- testutils.LoginDB(t, db)
-
- existingLastMaxUSN := 100
- database.MustExec(t, "inserting last synced at", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastSyncAt, int64(1231108742))
- database.MustExec(t, "inserting last max usn", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastMaxUSN, existingLastMaxUSN)
-
- // execute
- tx, err := db.Begin()
- if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
- }
-
- serverTime := int64(1541108743)
- serverMaxUSN := 0 // Empty fragment (no data in this sync)
- userMaxUSN := 150 // Server's actual max USN (higher than ours)
-
- err = saveSyncState(tx, serverTime, serverMaxUSN, userMaxUSN)
- if err != nil {
- tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
- }
-
- tx.Commit()
-
- // test
- var lastSyncedAt int64
- var lastMaxUSN int
-
- database.MustScan(t, "getting system value",
- db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastSyncAt), &lastSyncedAt)
- database.MustScan(t, "getting system value",
- db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN), &lastMaxUSN)
-
- assert.Equal(t, lastSyncedAt, serverTime, "last synced at should be updated")
- // last_max_usn should NOT be updated to 0, it should preserve the existing value
- assert.Equal(t, lastMaxUSN, existingLastMaxUSN, "last max usn should be preserved when fragment is empty but server has data")
- })
-
- t.Run("with empty server - resets last_max_usn to 0", func(t *testing.T) {
- // When both serverMaxUSN=0 and userMaxUSN=0, the server is truly empty
- // and we should reset last_max_usn to 0.
-
- // set up
- db := database.InitTestMemoryDB(t)
- testutils.LoginDB(t, db)
-
- database.MustExec(t, "inserting last synced at", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastSyncAt, int64(1231108742))
- database.MustExec(t, "inserting last max usn", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastMaxUSN, 50)
-
- // execute
- tx, err := db.Begin()
- if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
- }
-
- serverTime := int64(1541108743)
- serverMaxUSN := 0 // Empty fragment
- userMaxUSN := 0 // Server is actually empty
-
- err = saveSyncState(tx, serverTime, serverMaxUSN, userMaxUSN)
- if err != nil {
- tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
- }
-
- tx.Commit()
-
- // test
- var lastSyncedAt int64
- var lastMaxUSN int
-
- database.MustScan(t, "getting system value",
- db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastSyncAt), &lastSyncedAt)
- database.MustScan(t, "getting system value",
- db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN), &lastMaxUSN)
-
- assert.Equal(t, lastSyncedAt, serverTime, "last synced at should be updated")
- assert.Equal(t, lastMaxUSN, 0, "last max usn should be reset to 0 when server is empty")
- })
+ assert.Equal(t, lastSyncedAt, serverTime, "last synced at mismatch")
+ assert.Equal(t, lastMaxUSN, serverMaxUSN, "last max usn mismatch")
}
// TestSendBooks tests that books are put to correct 'buckets' by running a test server and recording the
@@ -1926,7 +1866,8 @@ func TestSaveServerState(t *testing.T) {
// are updated accordingly based on the server response.
func TestSendBooks(t *testing.T) {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
db := ctx.DB
@@ -1961,14 +1902,14 @@ func TestSendBooks(t *testing.T) {
var updatesUUIDs []string
var deletedUUIDs []string
- // fire up a test server
+ // fire up a test server. It decrypts the payload for test purposes.
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.String() == "/v3/books" && r.Method == "POST" {
var payload client.CreateBookPayload
err := json.NewDecoder(r.Body).Decode(&payload)
if err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload in the test server").Error())
+ t.Fatalf(errors.Wrap(err, "decoding payload in the test server").Error())
return
}
@@ -2016,19 +1957,19 @@ func TestSendBooks(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if _, err := sendBooks(ctx, tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
// test
- // First, sort data so that they can be asserted
+ // First, decrypt data so that they can be asserted
sort.SliceStable(createdLabels, func(i, j int) bool {
return strings.Compare(createdLabels[i], createdLabels[j]) < 0
})
@@ -2087,7 +2028,7 @@ func TestSendBooks_isBehind(t *testing.T) {
err := json.NewDecoder(r.Body).Decode(&payload)
if err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload in the test server").Error())
+ t.Fatalf(errors.Wrap(err, "decoding payload in the test server").Error())
return
}
@@ -2158,8 +2099,9 @@ func TestSendBooks_isBehind(t *testing.T) {
for idx, tc := range testCases {
func() {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
ctx.APIEndpoint = ts.URL
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
db := ctx.DB
@@ -2170,13 +2112,13 @@ func TestSendBooks_isBehind(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
isBehind, err := sendBooks(ctx, tx)
if err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -2205,8 +2147,9 @@ func TestSendBooks_isBehind(t *testing.T) {
for idx, tc := range testCases {
func() {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
ctx.APIEndpoint = ts.URL
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
db := ctx.DB
@@ -2217,13 +2160,13 @@ func TestSendBooks_isBehind(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
isBehind, err := sendBooks(ctx, tx)
if err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -2252,8 +2195,9 @@ func TestSendBooks_isBehind(t *testing.T) {
for idx, tc := range testCases {
func() {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
ctx.APIEndpoint = ts.URL
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
db := ctx.DB
@@ -2264,13 +2208,13 @@ func TestSendBooks_isBehind(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
isBehind, err := sendBooks(ctx, tx)
if err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -2286,7 +2230,8 @@ func TestSendBooks_isBehind(t *testing.T) {
// uuid from the incoming data.
func TestSendNotes(t *testing.T) {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
db := ctx.DB
@@ -2321,14 +2266,14 @@ func TestSendNotes(t *testing.T) {
var updatedUUIDs []string
var deletedUUIDs []string
- // fire up a test server
+ // fire up a test server. It decrypts the payload for test purposes.
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.String() == "/v3/notes" && r.Method == "POST" {
var payload client.CreateNotePayload
err := json.NewDecoder(r.Body).Decode(&payload)
if err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload in the test server").Error())
+ t.Fatalf(errors.Wrap(err, "decoding payload in the test server").Error())
return
}
@@ -2376,12 +2321,12 @@ func TestSendNotes(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if _, err := sendNotes(ctx, tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -2438,7 +2383,8 @@ func TestSendNotes(t *testing.T) {
func TestSendNotes_addedOn(t *testing.T) {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
db := ctx.DB
@@ -2449,7 +2395,7 @@ func TestSendNotes_addedOn(t *testing.T) {
b1UUID := "b1-uuid"
database.MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, usn, body, added_on, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?)", "n1-uuid", b1UUID, 0, "n1-body", 1541108743, false, true)
- // fire up a test server
+ // fire up a test server. It decrypts the payload for test purposes.
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.String() == "/v3/notes" && r.Method == "POST" {
resp := client.CreateNoteResp{
@@ -2475,12 +2421,12 @@ func TestSendNotes_addedOn(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if _, err := sendNotes(ctx, tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -2498,7 +2444,7 @@ func TestSendNotes_isBehind(t *testing.T) {
err := json.NewDecoder(r.Body).Decode(&payload)
if err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload in the test server").Error())
+ t.Fatalf(errors.Wrap(err, "decoding payload in the test server").Error())
return
}
@@ -2569,7 +2515,8 @@ func TestSendNotes_isBehind(t *testing.T) {
for idx, tc := range testCases {
func() {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
ctx.APIEndpoint = ts.URL
@@ -2582,13 +2529,13 @@ func TestSendNotes_isBehind(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
isBehind, err := sendNotes(ctx, tx)
if err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -2617,7 +2564,8 @@ func TestSendNotes_isBehind(t *testing.T) {
for idx, tc := range testCases {
func() {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
ctx.APIEndpoint = ts.URL
@@ -2630,13 +2578,13 @@ func TestSendNotes_isBehind(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
isBehind, err := sendNotes(ctx, tx)
if err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -2665,7 +2613,8 @@ func TestSendNotes_isBehind(t *testing.T) {
for idx, tc := range testCases {
func() {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../../tmp", nil)
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
ctx.APIEndpoint = ts.URL
@@ -2678,13 +2627,13 @@ func TestSendNotes_isBehind(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
isBehind, err := sendNotes(ctx, tx)
if err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -2830,7 +2779,8 @@ n1 body edited
for idx, tc := range testCases {
func() {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, "../../tmp/.dnote", nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, fmt.Sprintf("inserting b1 for test case %d", idx), db, "INSERT INTO books (uuid, label, usn, dirty) VALUES (?, ?, ?, ?)", b1UUID, "b1-label", 5, false)
database.MustExec(t, fmt.Sprintf("inserting b2 for test case %d", idx), db, "INSERT INTO books (uuid, label, usn, dirty) VALUES (?, ?, ?, ?)", b2UUID, "b2-label", 6, false)
@@ -2841,7 +2791,7 @@ n1 body edited
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
// update all fields but uuid and bump usn
@@ -2861,7 +2811,7 @@ n1 body edited
if err := mergeNote(tx, fragNote, localNote); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -2911,7 +2861,8 @@ n1 body edited
func TestCheckBookPristine(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, "../../tmp/.dnote", nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting b1", db, "INSERT INTO books (uuid, label, usn, dirty) VALUES (?, ?, ?, ?)", "b1-uuid", "b1-label", 5, false)
database.MustExec(t, "inserting b2", db, "INSERT INTO books (uuid, label, usn, dirty) VALUES (?, ?, ?, ?)", "b2-uuid", "b2-label", 6, false)
@@ -2925,12 +2876,12 @@ func TestCheckBookPristine(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
got, err := checkNotesPristine(tx, "b1-uuid")
if err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -2943,12 +2894,12 @@ func TestCheckBookPristine(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
got, err := checkNotesPristine(tx, "b2-uuid")
if err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -3084,7 +3035,8 @@ func TestCheckBookInList(t *testing.T) {
func TestCleanLocalNotes(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, "../../tmp/.dnote", nil)
+ defer database.TeardownTestDB(t, db)
list := syncList{
Notes: map[string]client.SyncFragNote{
@@ -3132,12 +3084,12 @@ func TestCleanLocalNotes(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := cleanLocalNotes(tx, &list); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -3155,7 +3107,8 @@ func TestCleanLocalNotes(t *testing.T) {
func TestCleanLocalBooks(t *testing.T) {
// set up
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, "../../tmp/.dnote", nil)
+ defer database.TeardownTestDB(t, db)
list := syncList{
Notes: map[string]client.SyncFragNote{
@@ -3199,12 +3152,12 @@ func TestCleanLocalBooks(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := cleanLocalBooks(tx, &list); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -3219,69 +3172,3 @@ func TestCleanLocalBooks(t *testing.T) {
database.MustScan(t, "getting b3", db.QueryRow("SELECT label FROM books WHERE uuid = ?", "b3-uuid"), &b3.Label)
database.MustScan(t, "getting b5", db.QueryRow("SELECT label FROM books WHERE uuid = ?", "b5-uuid"), &b5.Label)
}
-
-func TestPrepareEmptyServerSync(t *testing.T) {
- // set up
- db := database.InitTestMemoryDB(t)
-
- // Setup: local has synced data (usn > 0, dirty = false) and some deleted items
- database.MustExec(t, "inserting b1", db, "INSERT INTO books (uuid, label, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?)", "b1-uuid", "b1-label", 5, false, false)
- database.MustExec(t, "inserting b2", db, "INSERT INTO books (uuid, label, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?)", "b2-uuid", "b2-label", 8, false, false)
- database.MustExec(t, "inserting b3 deleted", db, "INSERT INTO books (uuid, label, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?)", "b3-uuid", "b3-label", 6, true, false)
- database.MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, body, usn, deleted, dirty, added_on) VALUES (?, ?, ?, ?, ?, ?, ?)", "n1-uuid", "b1-uuid", "note 1", 6, false, false, 1541108743)
- database.MustExec(t, "inserting n2", db, "INSERT INTO notes (uuid, book_uuid, body, usn, deleted, dirty, added_on) VALUES (?, ?, ?, ?, ?, ?, ?)", "n2-uuid", "b2-uuid", "note 2", 9, false, false, 1541108743)
- database.MustExec(t, "inserting n3 deleted", db, "INSERT INTO notes (uuid, book_uuid, body, usn, deleted, dirty, added_on) VALUES (?, ?, ?, ?, ?, ?, ?)", "n3-uuid", "b1-uuid", "note 3", 7, true, false, 1541108743)
- database.MustExec(t, "setting last_max_usn", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastMaxUSN, 9)
-
- // execute
- tx, err := db.Begin()
- if err != nil {
- t.Fatal(errors.Wrap(err, "beginning transaction"))
- }
-
- if err := prepareEmptyServerSync(tx); err != nil {
- tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing prepareEmptyServerSync"))
- }
-
- tx.Commit()
-
- // test - verify non-deleted items are marked dirty with usn=0, deleted items unchanged
- var b1, b2, b3 database.Book
- database.MustScan(t, "getting b1", db.QueryRow("SELECT usn, dirty, deleted FROM books WHERE uuid = ?", "b1-uuid"), &b1.USN, &b1.Dirty, &b1.Deleted)
- database.MustScan(t, "getting b2", db.QueryRow("SELECT usn, dirty, deleted FROM books WHERE uuid = ?", "b2-uuid"), &b2.USN, &b2.Dirty, &b2.Deleted)
- database.MustScan(t, "getting b3", db.QueryRow("SELECT usn, dirty, deleted FROM books WHERE uuid = ?", "b3-uuid"), &b3.USN, &b3.Dirty, &b3.Deleted)
-
- assert.Equal(t, b1.USN, 0, "b1 USN should be reset to 0")
- assert.Equal(t, b1.Dirty, true, "b1 should be marked dirty")
- assert.Equal(t, b1.Deleted, false, "b1 should not be deleted")
-
- assert.Equal(t, b2.USN, 0, "b2 USN should be reset to 0")
- assert.Equal(t, b2.Dirty, true, "b2 should be marked dirty")
- assert.Equal(t, b2.Deleted, false, "b2 should not be deleted")
-
- assert.Equal(t, b3.USN, 6, "b3 USN should remain unchanged (deleted item)")
- assert.Equal(t, b3.Dirty, false, "b3 should not be marked dirty (deleted item)")
- assert.Equal(t, b3.Deleted, true, "b3 should remain deleted")
-
- var n1, n2, n3 database.Note
- database.MustScan(t, "getting n1", db.QueryRow("SELECT usn, dirty, deleted FROM notes WHERE uuid = ?", "n1-uuid"), &n1.USN, &n1.Dirty, &n1.Deleted)
- database.MustScan(t, "getting n2", db.QueryRow("SELECT usn, dirty, deleted FROM notes WHERE uuid = ?", "n2-uuid"), &n2.USN, &n2.Dirty, &n2.Deleted)
- database.MustScan(t, "getting n3", db.QueryRow("SELECT usn, dirty, deleted FROM notes WHERE uuid = ?", "n3-uuid"), &n3.USN, &n3.Dirty, &n3.Deleted)
-
- assert.Equal(t, n1.USN, 0, "n1 USN should be reset to 0")
- assert.Equal(t, n1.Dirty, true, "n1 should be marked dirty")
- assert.Equal(t, n1.Deleted, false, "n1 should not be deleted")
-
- assert.Equal(t, n2.USN, 0, "n2 USN should be reset to 0")
- assert.Equal(t, n2.Dirty, true, "n2 should be marked dirty")
- assert.Equal(t, n2.Deleted, false, "n2 should not be deleted")
-
- assert.Equal(t, n3.USN, 7, "n3 USN should remain unchanged (deleted item)")
- assert.Equal(t, n3.Dirty, false, "n3 should not be marked dirty (deleted item)")
- assert.Equal(t, n3.Deleted, true, "n3 should remain deleted")
-
- var lastMaxUSN int
- database.MustScan(t, "getting last_max_usn", db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN), &lastMaxUSN)
- assert.Equal(t, lastMaxUSN, 0, "last_max_usn should be reset to 0")
-}
diff --git a/pkg/cli/cmd/version/version.go b/pkg/cli/cmd/version/version.go
index 79892204..b7b29ba0 100644
--- a/pkg/cli/cmd/version/version.go
+++ b/pkg/cli/cmd/version/version.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package version
diff --git a/pkg/cli/cmd/view/book_test.go b/pkg/cli/cmd/view/book_test.go
deleted file mode 100644
index 226d5d04..00000000
--- a/pkg/cli/cmd/view/book_test.go
+++ /dev/null
@@ -1,184 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package view
-
-import (
- "bytes"
- "fmt"
- "strings"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/cli/context"
- "github.com/dnote/dnote/pkg/cli/database"
-)
-
-func TestGetNewlineIdx(t *testing.T) {
- testCases := []struct {
- input string
- expected int
- }{
- {
- input: "hello\nworld",
- expected: 5,
- },
- {
- input: "hello\r\nworld",
- expected: 5,
- },
- {
- input: "no newline here",
- expected: -1,
- },
- {
- input: "",
- expected: -1,
- },
- {
- input: "\n",
- expected: 0,
- },
- {
- input: "\r\n",
- expected: 0,
- },
- }
-
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("input: %q", tc.input), func(t *testing.T) {
- got := getNewlineIdx(tc.input)
- assert.Equal(t, got, tc.expected, "newline index mismatch")
- })
- }
-}
-
-func TestFormatBody(t *testing.T) {
- testCases := []struct {
- input string
- expectedBody string
- expectedExcerpt bool
- }{
- {
- input: "single line",
- expectedBody: "single line",
- expectedExcerpt: false,
- },
- {
- input: "first line\nsecond line",
- expectedBody: "first line",
- expectedExcerpt: true,
- },
- {
- input: "first line\r\nsecond line",
- expectedBody: "first line",
- expectedExcerpt: true,
- },
- {
- input: " spaced line ",
- expectedBody: "spaced line",
- expectedExcerpt: false,
- },
- {
- input: " first line \nsecond line",
- expectedBody: "first line",
- expectedExcerpt: true,
- },
- {
- input: "",
- expectedBody: "",
- expectedExcerpt: false,
- },
- {
- input: "line with trailing newline\n",
- expectedBody: "line with trailing newline",
- expectedExcerpt: false,
- },
- {
- input: "line with trailing newlines\n\n",
- expectedBody: "line with trailing newlines",
- expectedExcerpt: false,
- },
- }
-
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("input: %q", tc.input), func(t *testing.T) {
- gotBody, gotExcerpt := formatBody(tc.input)
- assert.Equal(t, gotBody, tc.expectedBody, "formatted body mismatch")
- assert.Equal(t, gotExcerpt, tc.expectedExcerpt, "excerpt flag mismatch")
- })
- }
-}
-
-func TestListNotes(t *testing.T) {
- // Setup
- db := database.InitTestMemoryDB(t)
- defer db.Close()
-
- bookUUID := "js-book-uuid"
- database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", bookUUID, "javascript")
- database.MustExec(t, "inserting note 1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on) VALUES (?, ?, ?, ?)", "note-1", bookUUID, "first note", 1515199943)
- database.MustExec(t, "inserting note 2", db, "INSERT INTO notes (uuid, book_uuid, body, added_on) VALUES (?, ?, ?, ?)", "note-2", bookUUID, "multiline note\nwith second line", 1515199945)
-
- ctx := context.DnoteCtx{DB: db}
- var buf bytes.Buffer
-
- // Execute
- err := listNotes(ctx, &buf, "javascript")
- if err != nil {
- t.Fatal(err)
- }
-
- got := buf.String()
-
- // Verify output
- assert.Equal(t, strings.Contains(got, "on book javascript"), true, "should show book name")
- assert.Equal(t, strings.Contains(got, "first note"), true, "should contain first note")
- assert.Equal(t, strings.Contains(got, "multiline note"), true, "should show first line of multiline note")
- assert.Equal(t, strings.Contains(got, "[---More---]"), true, "should show more indicator for multiline note")
- assert.Equal(t, strings.Contains(got, "with second line"), false, "should not show second line of multiline note")
-}
-
-func TestListBooks(t *testing.T) {
- // Setup
- db := database.InitTestMemoryDB(t)
- defer db.Close()
-
- b1UUID := "js-book-uuid"
- b2UUID := "linux-book-uuid"
-
- database.MustExec(t, "inserting book 1", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "javascript")
- database.MustExec(t, "inserting book 2", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b2UUID, "linux")
-
- // Add notes to test count
- database.MustExec(t, "inserting note 1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on) VALUES (?, ?, ?, ?)", "note-1", b1UUID, "note body 1", 1515199943)
- database.MustExec(t, "inserting note 2", db, "INSERT INTO notes (uuid, book_uuid, body, added_on) VALUES (?, ?, ?, ?)", "note-2", b1UUID, "note body 2", 1515199944)
-
- ctx := context.DnoteCtx{DB: db}
- var buf bytes.Buffer
-
- // Execute
- err := listBooks(ctx, &buf, false)
- if err != nil {
- t.Fatal(err)
- }
-
- got := buf.String()
-
- // Verify output
- assert.Equal(t, strings.Contains(got, "javascript"), true, "should contain javascript book")
- assert.Equal(t, strings.Contains(got, "linux"), true, "should contain linux book")
- assert.Equal(t, strings.Contains(got, "(2)"), true, "should show 2 notes for javascript")
-}
diff --git a/pkg/cli/cmd/view/note.go b/pkg/cli/cmd/view/note.go
deleted file mode 100644
index f853dd9a..00000000
--- a/pkg/cli/cmd/view/note.go
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package view
-
-import (
- "io"
- "strconv"
-
- "github.com/dnote/dnote/pkg/cli/context"
- "github.com/dnote/dnote/pkg/cli/database"
- "github.com/dnote/dnote/pkg/cli/output"
- "github.com/pkg/errors"
-)
-
-func viewNote(ctx context.DnoteCtx, w io.Writer, noteRowIDArg string, contentOnly bool) error {
- noteRowID, err := strconv.Atoi(noteRowIDArg)
- if err != nil {
- return errors.Wrap(err, "invalid rowid")
- }
-
- db := ctx.DB
- info, err := database.GetNoteInfo(db, noteRowID)
- if err != nil {
- return err
- }
-
- if contentOnly {
- output.NoteContent(w, info)
- } else {
- output.NoteInfo(w, info)
- }
-
- return nil
-}
diff --git a/pkg/cli/cmd/view/note_test.go b/pkg/cli/cmd/view/note_test.go
deleted file mode 100644
index 36e9aa84..00000000
--- a/pkg/cli/cmd/view/note_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package view
-
-import (
- "bytes"
- "strings"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/cli/context"
- "github.com/dnote/dnote/pkg/cli/database"
-)
-
-func TestViewNote(t *testing.T) {
- db := database.InitTestMemoryDB(t)
- defer db.Close()
-
- bookUUID := "test-book-uuid"
- database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", bookUUID, "golang")
- database.MustExec(t, "inserting note", db, "INSERT INTO notes (uuid, book_uuid, body, added_on) VALUES (?, ?, ?, ?)",
- "note-uuid", bookUUID, "test note content", 1515199943000000000)
-
- ctx := context.DnoteCtx{DB: db}
- var buf bytes.Buffer
-
- err := viewNote(ctx, &buf, "1", false)
- if err != nil {
- t.Fatal(err)
- }
-
- got := buf.String()
- assert.Equal(t, strings.Contains(got, "test note content"), true, "should contain note content")
-}
-
-func TestViewNoteContentOnly(t *testing.T) {
- db := database.InitTestMemoryDB(t)
- defer db.Close()
-
- bookUUID := "test-book-uuid"
- database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", bookUUID, "golang")
- database.MustExec(t, "inserting note", db, "INSERT INTO notes (uuid, book_uuid, body, added_on) VALUES (?, ?, ?, ?)",
- "note-uuid", bookUUID, "test note content", 1515199943000000000)
-
- ctx := context.DnoteCtx{DB: db}
- var buf bytes.Buffer
-
- err := viewNote(ctx, &buf, "1", true)
- if err != nil {
- t.Fatal(err)
- }
-
- got := buf.String()
- assert.Equal(t, got, "test note content", "should contain only note content")
-}
-
-func TestViewNoteInvalidRowID(t *testing.T) {
- db := database.InitTestMemoryDB(t)
- defer db.Close()
-
- ctx := context.DnoteCtx{DB: db}
- var buf bytes.Buffer
-
- err := viewNote(ctx, &buf, "not-a-number", false)
- assert.NotEqual(t, err, nil, "should return error for invalid rowid")
-}
-
-func TestViewNoteNotFound(t *testing.T) {
- db := database.InitTestMemoryDB(t)
- defer db.Close()
-
- ctx := context.DnoteCtx{DB: db}
- var buf bytes.Buffer
-
- err := viewNote(ctx, &buf, "999", false)
- assert.NotEqual(t, err, nil, "should return error for non-existent note")
-}
diff --git a/pkg/cli/cmd/view/view.go b/pkg/cli/cmd/view/view.go
index 57b17dbd..271c0c2e 100644
--- a/pkg/cli/cmd/view/view.go
+++ b/pkg/cli/cmd/view/view.go
@@ -1,28 +1,32 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package view
import (
- "os"
-
"github.com/dnote/dnote/pkg/cli/context"
"github.com/dnote/dnote/pkg/cli/infra"
- "github.com/dnote/dnote/pkg/cli/utils"
"github.com/pkg/errors"
"github.com/spf13/cobra"
+
+ "github.com/dnote/dnote/pkg/cli/cmd/cat"
+ "github.com/dnote/dnote/pkg/cli/cmd/ls"
+ "github.com/dnote/dnote/pkg/cli/utils"
)
var example = `
@@ -37,7 +41,6 @@ var example = `
`
var nameOnly bool
-var contentOnly bool
func preRun(cmd *cobra.Command, args []string) error {
if len(args) > 2 {
@@ -60,33 +63,33 @@ func NewCmd(ctx context.DnoteCtx) *cobra.Command {
f := cmd.Flags()
f.BoolVarP(&nameOnly, "name-only", "", false, "print book names only")
- f.BoolVarP(&contentOnly, "content-only", "", false, "print the note content only")
return cmd
}
func newRun(ctx context.DnoteCtx) infra.RunEFunc {
return func(cmd *cobra.Command, args []string) error {
+ var run infra.RunEFunc
+
if len(args) == 0 {
- // List all books
- return listBooks(ctx, os.Stdout, nameOnly)
+ run = ls.NewRun(ctx, nameOnly)
} else if len(args) == 1 {
if nameOnly {
return errors.New("--name-only flag is only valid when viewing books")
}
if utils.IsNumber(args[0]) {
- // View a note by index
- return viewNote(ctx, os.Stdout, args[0], contentOnly)
+ run = cat.NewRun(ctx)
} else {
- // List notes in a book
- return listNotes(ctx, os.Stdout, args[0])
+ run = ls.NewRun(ctx, false)
}
} else if len(args) == 2 {
- // View a note in a book (book name + note index)
- return viewNote(ctx, os.Stdout, args[1], contentOnly)
+ // DEPRECATED: passing book name to view command is deprecated
+ run = cat.NewRun(ctx)
+ } else {
+ return errors.New("Incorrect number of arguments")
}
- return errors.New("Incorrect number of arguments")
+ return run(cmd, args)
}
}
diff --git a/pkg/cli/config/config.go b/pkg/cli/config/config.go
index 065100c0..bb2e9424 100644
--- a/pkg/cli/config/config.go
+++ b/pkg/cli/config/config.go
@@ -1,61 +1,42 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package config
import (
"fmt"
- "os"
+ "io/ioutil"
"github.com/dnote/dnote/pkg/cli/consts"
"github.com/dnote/dnote/pkg/cli/context"
- "github.com/dnote/dnote/pkg/cli/log"
- "github.com/dnote/dnote/pkg/cli/utils"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
// Config holds dnote configuration
type Config struct {
- Editor string `yaml:"editor"`
- APIEndpoint string `yaml:"apiEndpoint"`
- EnableUpgradeCheck bool `yaml:"enableUpgradeCheck"`
-}
-
-func checkLegacyPath(ctx context.DnoteCtx) (string, bool) {
- legacyPath := fmt.Sprintf("%s/%s", ctx.Paths.LegacyDnote, consts.ConfigFilename)
-
- ok, err := utils.FileExists(legacyPath)
- if err != nil {
- log.Error(errors.Wrapf(err, "checking legacy dnote directory at %s", legacyPath).Error())
- }
- if ok {
- return legacyPath, true
- }
-
- return "", false
+ Editor string `yaml:"editor"`
+ APIEndpoint string `yaml:"apiEndpoint"`
}
// GetPath returns the path to the dnote config file
func GetPath(ctx context.DnoteCtx) string {
- legacyPath, ok := checkLegacyPath(ctx)
- if ok {
- return legacyPath
- }
-
- return fmt.Sprintf("%s/%s/%s", ctx.Paths.Config, consts.DnoteDirName, consts.ConfigFilename)
+ return fmt.Sprintf("%s/%s", ctx.DnoteDir, consts.ConfigFilename)
}
// Read reads the config file
@@ -63,7 +44,7 @@ func Read(ctx context.DnoteCtx) (Config, error) {
var ret Config
configPath := GetPath(ctx)
- b, err := os.ReadFile(configPath)
+ b, err := ioutil.ReadFile(configPath)
if err != nil {
return ret, errors.Wrap(err, "reading config file")
}
@@ -85,7 +66,7 @@ func Write(ctx context.DnoteCtx, cf Config) error {
return errors.Wrap(err, "marshalling config into YAML")
}
- err = os.WriteFile(path, b, 0644)
+ err = ioutil.WriteFile(path, b, 0644)
if err != nil {
return errors.Wrap(err, "writing the config file")
}
diff --git a/pkg/cli/consts/consts.go b/pkg/cli/consts/consts.go
index 0f49c152..4c84d1ae 100644
--- a/pkg/cli/consts/consts.go
+++ b/pkg/cli/consts/consts.go
@@ -1,26 +1,27 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package consts provides definitions of constants
package consts
var (
- // LegacyDnoteDirName is the name of the legacy directory containing dnote files
- LegacyDnoteDirName = ".dnote"
// DnoteDirName is the name of the directory containing dnote files
- DnoteDirName = "dnote"
+ DnoteDirName = ".dnote"
// DnoteDBFileName is a filename for the Dnote SQLite database
DnoteDBFileName = "dnote.db"
// TmpContentFileBase is the base for the filename for a temporary content
diff --git a/pkg/cli/context/ctx.go b/pkg/cli/context/ctx.go
index 971d9145..26ddc0e2 100644
--- a/pkg/cli/context/ctx.go
+++ b/pkg/cli/context/ctx.go
@@ -1,49 +1,40 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package context defines dnote context
package context
import (
- "net/http"
-
"github.com/dnote/dnote/pkg/cli/database"
"github.com/dnote/dnote/pkg/clock"
)
-// Paths contain directory definitions
-type Paths struct {
- Home string
- Config string
- Data string
- Cache string
- LegacyDnote string
-}
-
// DnoteCtx is a context holding the information of the current runtime
type DnoteCtx struct {
- Paths Paths
- APIEndpoint string
- Version string
- DB *database.DB
- SessionKey string
- SessionKeyExpiry int64
- Editor string
- Clock clock.Clock
- EnableUpgradeCheck bool
- HTTPClient *http.Client
+ HomeDir string
+ DnoteDir string
+ APIEndpoint string
+ Version string
+ DB *database.DB
+ SessionKey string
+ SessionKeyExpiry int64
+ Editor string
+ Clock clock.Clock
}
// Redact replaces private information from the context with a set of
diff --git a/pkg/cli/context/files.go b/pkg/cli/context/files.go
deleted file mode 100644
index 1abbcd47..00000000
--- a/pkg/cli/context/files.go
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package context
-
-import (
- "path/filepath"
-
- "github.com/dnote/dnote/pkg/cli/consts"
- "github.com/dnote/dnote/pkg/cli/utils"
- "github.com/pkg/errors"
-)
-
-// InitDnoteDirs creates the dnote directories if they don't already exist.
-func InitDnoteDirs(paths Paths) error {
- if paths.Config != "" {
- configDir := filepath.Join(paths.Config, consts.DnoteDirName)
- if err := utils.EnsureDir(configDir); err != nil {
- return errors.Wrap(err, "initializing config dir")
- }
- }
- if paths.Data != "" {
- dataDir := filepath.Join(paths.Data, consts.DnoteDirName)
- if err := utils.EnsureDir(dataDir); err != nil {
- return errors.Wrap(err, "initializing data dir")
- }
- }
- if paths.Cache != "" {
- cacheDir := filepath.Join(paths.Cache, consts.DnoteDirName)
- if err := utils.EnsureDir(cacheDir); err != nil {
- return errors.Wrap(err, "initializing cache dir")
- }
- }
-
- return nil
-}
diff --git a/pkg/cli/context/files_test.go b/pkg/cli/context/files_test.go
deleted file mode 100644
index 49d62dc9..00000000
--- a/pkg/cli/context/files_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package context
-
-import (
- "os"
- "path/filepath"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/cli/consts"
-)
-
-func assertDirsExist(t *testing.T, paths Paths) {
- configDir := filepath.Join(paths.Config, consts.DnoteDirName)
- info, err := os.Stat(configDir)
- assert.Equal(t, err, nil, "config dir should exist")
- assert.Equal(t, info.IsDir(), true, "config should be a directory")
-
- dataDir := filepath.Join(paths.Data, consts.DnoteDirName)
- info, err = os.Stat(dataDir)
- assert.Equal(t, err, nil, "data dir should exist")
- assert.Equal(t, info.IsDir(), true, "data should be a directory")
-
- cacheDir := filepath.Join(paths.Cache, consts.DnoteDirName)
- info, err = os.Stat(cacheDir)
- assert.Equal(t, err, nil, "cache dir should exist")
- assert.Equal(t, info.IsDir(), true, "cache should be a directory")
-}
-
-func TestInitDnoteDirs(t *testing.T) {
- tmpDir := t.TempDir()
-
- paths := Paths{
- Config: filepath.Join(tmpDir, "config"),
- Data: filepath.Join(tmpDir, "data"),
- Cache: filepath.Join(tmpDir, "cache"),
- }
-
- // Initialize directories
- err := InitDnoteDirs(paths)
- assert.Equal(t, err, nil, "InitDnoteDirs should succeed")
- assertDirsExist(t, paths)
-
- // Call again - should be idempotent
- err = InitDnoteDirs(paths)
- assert.Equal(t, err, nil, "InitDnoteDirs should succeed when dirs already exist")
- assertDirsExist(t, paths)
-}
diff --git a/pkg/cli/context/testutils.go b/pkg/cli/context/testutils.go
index cb477475..383c5a08 100644
--- a/pkg/cli/context/testutils.go
+++ b/pkg/cli/context/testutils.go
@@ -1,22 +1,26 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package context
import (
- "path/filepath"
+ "fmt"
+ "os"
"testing"
"github.com/dnote/dnote/pkg/cli/consts"
@@ -25,76 +29,25 @@ import (
"github.com/pkg/errors"
)
-// getDefaultTestPaths creates default test paths with all paths pointing to a temp directory
-func getDefaultTestPaths(t *testing.T) Paths {
- tmpDir := t.TempDir()
- return Paths{
- Home: tmpDir,
- Cache: tmpDir,
- Config: tmpDir,
- Data: tmpDir,
- }
-}
+// InitTestCtx initializes a test context
+func InitTestCtx(t *testing.T, dnoteDir string, dbOpts *database.TestDBOptions) DnoteCtx {
+ dbPath := fmt.Sprintf("%s/%s", dnoteDir, consts.DnoteDBFileName)
-
-// InitTestCtx initializes a test context with an in-memory database
-// and a temporary directory for all paths
-func InitTestCtx(t *testing.T) DnoteCtx {
- paths := getDefaultTestPaths(t)
- db := database.InitTestMemoryDB(t)
-
- if err := InitDnoteDirs(paths); err != nil {
- t.Fatal(errors.Wrap(err, "creating test directories"))
- }
+ db := database.InitTestDB(t, dbPath, dbOpts)
return DnoteCtx{
- DB: db,
- Paths: paths,
- Clock: clock.NewMock(), // Use a mock clock to test times
+ DB: db,
+ DnoteDir: dnoteDir,
+ // Use a mock clock to test times
+ Clock: clock.NewMock(),
}
}
-// InitTestCtxWithDB initializes a test context with the provided database
-// and a temporary directory for all paths.
-// Used when you need full control over database initialization (e.g. migration tests).
-func InitTestCtxWithDB(t *testing.T, db *database.DB) DnoteCtx {
- paths := getDefaultTestPaths(t)
+// TeardownTestCtx cleans up the test context
+func TeardownTestCtx(t *testing.T, ctx DnoteCtx) {
+ database.TeardownTestDB(t, ctx.DB)
- if err := InitDnoteDirs(paths); err != nil {
- t.Fatal(errors.Wrap(err, "creating test directories"))
- }
-
- return DnoteCtx{
- DB: db,
- Paths: paths,
- Clock: clock.NewMock(), // Use a mock clock to test times
- }
-}
-
-// InitTestCtxWithFileDB initializes a test context with a file-based database
-// at the expected path.
-func InitTestCtxWithFileDB(t *testing.T) DnoteCtx {
- paths := getDefaultTestPaths(t)
-
- if err := InitDnoteDirs(paths); err != nil {
- t.Fatal(errors.Wrap(err, "creating test directories"))
- }
-
- dbPath := filepath.Join(paths.Data, consts.DnoteDirName, consts.DnoteDBFileName)
- db, err := database.Open(dbPath)
- if err != nil {
- t.Fatal(errors.Wrap(err, "opening database"))
- }
-
- if _, err := db.Exec(database.GetDefaultSchemaSQL()); err != nil {
- t.Fatal(errors.Wrap(err, "running schema sql"))
- }
-
- t.Cleanup(func() { db.Close() })
-
- return DnoteCtx{
- DB: db,
- Paths: paths,
- Clock: clock.NewMock(), // Use a mock clock to test times
+ if err := os.RemoveAll(ctx.DnoteDir); err != nil {
+ t.Fatal(errors.Wrap(err, "removing test dnote directory"))
}
}
diff --git a/pkg/cli/crypt/crypto.go b/pkg/cli/crypt/crypto.go
new file mode 100644
index 00000000..d0fba497
--- /dev/null
+++ b/pkg/cli/crypt/crypto.go
@@ -0,0 +1,123 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+// Package crypt provides cryptographic funcitonalities
+package crypt
+
+import (
+ "crypto/aes"
+ "crypto/cipher"
+ "crypto/rand"
+ "crypto/sha256"
+ "encoding/base64"
+ "io"
+
+ "github.com/pkg/errors"
+ "golang.org/x/crypto/hkdf"
+ "golang.org/x/crypto/pbkdf2"
+)
+
+var aesGcmNonceSize = 12
+
+func runHkdf(secret, salt, info []byte) ([]byte, error) {
+ r := hkdf.New(sha256.New, secret, salt, info)
+
+ ret := make([]byte, 32)
+ _, err := io.ReadFull(r, ret)
+ if err != nil {
+ return []byte{}, errors.Wrap(err, "reading key bytes")
+ }
+
+ return ret, nil
+}
+
+// MakeKeys derives, from the given credential, a key set comprising of an encryption key
+// and an authentication key
+func MakeKeys(password, email []byte, iteration int) ([]byte, []byte, error) {
+ masterKey := pbkdf2.Key([]byte(password), []byte(email), iteration, 32, sha256.New)
+
+ authKey, err := runHkdf(masterKey, email, []byte("auth"))
+ if err != nil {
+ return nil, nil, errors.Wrap(err, "deriving auth key")
+ }
+
+ return masterKey, authKey, nil
+}
+
+// AesGcmEncrypt encrypts the plaintext using AES in a GCM mode. It returns
+// a ciphertext prepended by a 12 byte pseudo-random nonce, encoded in base64.
+func AesGcmEncrypt(key, plaintext []byte) (string, error) {
+ if key == nil {
+ return "", errors.New("no key provided")
+ }
+
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return "", errors.Wrap(err, "initializing aes")
+ }
+
+ aesgcm, err := cipher.NewGCM(block)
+ if err != nil {
+ return "", errors.Wrap(err, "initializing gcm")
+ }
+
+ nonce := make([]byte, aesGcmNonceSize)
+ if _, err := io.ReadFull(rand.Reader, nonce); err != nil {
+ return "", errors.Wrap(err, "generating nonce")
+ }
+
+ ciphertext := aesgcm.Seal(nonce, nonce, []byte(plaintext), nil)
+ cipherKeyB64 := base64.StdEncoding.EncodeToString(ciphertext)
+
+ return cipherKeyB64, nil
+}
+
+// AesGcmDecrypt decrypts the encrypted data using AES in a GCM mode. The data should be
+// a base64 encoded string in the format of 12 byte nonce followed by a ciphertext.
+func AesGcmDecrypt(key []byte, dataB64 string) ([]byte, error) {
+ if key == nil {
+ return nil, errors.New("no key provided")
+ }
+
+ data, err := base64.StdEncoding.DecodeString(dataB64)
+ if err != nil {
+ return nil, errors.Wrap(err, "decoding base64 data")
+ }
+
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, errors.Wrap(err, "initializing aes")
+ }
+
+ aesgcm, err := cipher.NewGCM(block)
+ if err != nil {
+ return nil, errors.Wrap(err, "initializing gcm")
+ }
+
+ if len(data) < aesGcmNonceSize {
+ return nil, errors.Wrap(err, "malformed data")
+ }
+
+ nonce, ciphertext := data[:aesGcmNonceSize], data[aesGcmNonceSize:]
+ plaintext, err := aesgcm.Open(nil, nonce, ciphertext, nil)
+ if err != nil {
+ return nil, errors.Wrap(err, "decrypting")
+ }
+
+ return plaintext, nil
+}
diff --git a/pkg/cli/crypt/crypto_test.go b/pkg/cli/crypt/crypto_test.go
new file mode 100644
index 00000000..013c6110
--- /dev/null
+++ b/pkg/cli/crypt/crypto_test.go
@@ -0,0 +1,118 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
+ */
+
+package crypt
+
+import (
+ "crypto/aes"
+ "crypto/cipher"
+ "encoding/base64"
+ "fmt"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/pkg/errors"
+)
+
+func TestAesGcmEncrypt(t *testing.T) {
+ testCases := []struct {
+ key []byte
+ plaintext []byte
+ }{
+ {
+ key: []byte("AES256Key-32Characters1234567890"),
+ plaintext: []byte("foo bar baz quz"),
+ },
+ {
+ key: []byte("AES256Key-32Charactersabcdefghij"),
+ plaintext: []byte("1234 foo 5678 bar 7890 baz"),
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("key %s plaintext %s", tc.key, tc.plaintext), func(t *testing.T) {
+ // encrypt
+ dataB64, err := AesGcmEncrypt(tc.key, tc.plaintext)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "performing encryption"))
+ }
+
+ // test that data can be decrypted
+ data, err := base64.StdEncoding.DecodeString(dataB64)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "decoding data from base64"))
+ }
+
+ nonce, ciphertext := data[:12], data[12:]
+
+ fmt.Println(string(data))
+
+ block, err := aes.NewCipher([]byte(tc.key))
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "initializing aes"))
+ }
+
+ aesgcm, err := cipher.NewGCM(block)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "initializing gcm"))
+ }
+
+ plaintext, err := aesgcm.Open(nil, nonce, ciphertext, nil)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "decode"))
+ }
+
+ assert.DeepEqual(t, plaintext, tc.plaintext, "plaintext mismatch")
+ })
+ }
+}
+
+func TestAesGcmDecrypt(t *testing.T) {
+ testCases := []struct {
+ key []byte
+ ciphertextB64 string
+ expectedPlaintext string
+ }{
+ {
+ key: []byte("AES256Key-32Characters1234567890"),
+ ciphertextB64: "M2ov9hWMQ52v1S/zigwX3bJt4cVCV02uiRm/grKqN/rZxNkJrD7vK4Ii0g==",
+ expectedPlaintext: "foo bar baz quz",
+ },
+ {
+ key: []byte("AES256Key-32Characters1234567890"),
+ ciphertextB64: "M4csFKUIUbD1FBEzLgHjscoKgN0lhMGJ0n2nKWiCkE/qSKlRP7kS",
+ expectedPlaintext: "foo\n1\nbar\n2",
+ },
+ {
+ key: []byte("AES256Key-32Characters1234567890"),
+ ciphertextB64: "pe/fnw73MR1clmVIlRSJ5gDwBdnPly/DF7DsR5dJVz4dHZlv0b10WzvJEGOCHZEr+Q==",
+ expectedPlaintext: "föo\nbār\nbåz & qūz",
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("key %s ciphertext %s", tc.key, tc.ciphertextB64), func(t *testing.T) {
+ plaintext, err := AesGcmDecrypt(tc.key, tc.ciphertextB64)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "performing decryption"))
+ }
+
+ assert.DeepEqual(t, plaintext, []byte(tc.expectedPlaintext), "plaintext mismatch")
+ })
+ }
+}
diff --git a/pkg/cli/database/models.go b/pkg/cli/database/models.go
index e8e463bb..2476651c 100644
--- a/pkg/cli/database/models.go
+++ b/pkg/cli/database/models.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package database
@@ -38,12 +41,13 @@ type Note struct {
AddedOn int64 `json:"added_on"`
EditedOn int64 `json:"edited_on"`
USN int `json:"usn"`
+ Public bool `json:"public"`
Deleted bool `json:"deleted"`
Dirty bool `json:"dirty"`
}
// NewNote constructs a note with the given data
-func NewNote(uuid, bookUUID, body string, addedOn, editedOn int64, usn int, deleted, dirty bool) Note {
+func NewNote(uuid, bookUUID, body string, addedOn, editedOn int64, usn int, public, deleted, dirty bool) Note {
return Note{
UUID: uuid,
BookUUID: bookUUID,
@@ -51,6 +55,7 @@ func NewNote(uuid, bookUUID, body string, addedOn, editedOn int64, usn int, dele
AddedOn: addedOn,
EditedOn: editedOn,
USN: usn,
+ Public: public,
Deleted: deleted,
Dirty: dirty,
}
@@ -58,8 +63,8 @@ func NewNote(uuid, bookUUID, body string, addedOn, editedOn int64, usn int, dele
// Insert inserts a new note
func (n Note) Insert(db *DB) error {
- _, err := db.Exec("INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
- n.UUID, n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Deleted, n.Dirty)
+ _, err := db.Exec("INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ n.UUID, n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Public, n.Deleted, n.Dirty)
if err != nil {
return errors.Wrapf(err, "inserting note with uuid %s", n.UUID)
@@ -70,8 +75,8 @@ func (n Note) Insert(db *DB) error {
// Update updates the note with the given data
func (n Note) Update(db *DB) error {
- _, err := db.Exec("UPDATE notes SET book_uuid = ?, body = ?, added_on = ?, edited_on = ?, usn = ?, deleted = ?, dirty = ? WHERE uuid = ?",
- n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Deleted, n.Dirty, n.UUID)
+ _, err := db.Exec("UPDATE notes SET book_uuid = ?, body = ?, added_on = ?, edited_on = ?, usn = ?, public = ?, deleted = ?, dirty = ? WHERE uuid = ?",
+ n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Public, n.Deleted, n.Dirty, n.UUID)
if err != nil {
return errors.Wrapf(err, "updating the note with uuid %s", n.UUID)
diff --git a/pkg/cli/database/models_test.go b/pkg/cli/database/models_test.go
index 6d0a45f0..6ff6d775 100644
--- a/pkg/cli/database/models_test.go
+++ b/pkg/cli/database/models_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package database
@@ -31,6 +34,7 @@ func TestNewNote(t *testing.T) {
addedOn int64
editedOn int64
usn int
+ public bool
deleted bool
dirty bool
}{
@@ -41,6 +45,7 @@ func TestNewNote(t *testing.T) {
addedOn: 1542058875,
editedOn: 0,
usn: 0,
+ public: false,
deleted: false,
dirty: false,
},
@@ -51,13 +56,14 @@ func TestNewNote(t *testing.T) {
addedOn: 1542058875,
editedOn: 1542058876,
usn: 1008,
+ public: true,
deleted: true,
dirty: true,
},
}
for idx, tc := range testCases {
- got := NewNote(tc.uuid, tc.bookUUID, tc.body, tc.addedOn, tc.editedOn, tc.usn, tc.deleted, tc.dirty)
+ got := NewNote(tc.uuid, tc.bookUUID, tc.body, tc.addedOn, tc.editedOn, tc.usn, tc.public, tc.deleted, tc.dirty)
assert.Equal(t, got.UUID, tc.uuid, fmt.Sprintf("UUID mismatch for test case %d", idx))
assert.Equal(t, got.BookUUID, tc.bookUUID, fmt.Sprintf("BookUUID mismatch for test case %d", idx))
@@ -65,6 +71,7 @@ func TestNewNote(t *testing.T) {
assert.Equal(t, got.AddedOn, tc.addedOn, fmt.Sprintf("AddedOn mismatch for test case %d", idx))
assert.Equal(t, got.EditedOn, tc.editedOn, fmt.Sprintf("EditedOn mismatch for test case %d", idx))
assert.Equal(t, got.USN, tc.usn, fmt.Sprintf("USN mismatch for test case %d", idx))
+ assert.Equal(t, got.Public, tc.public, fmt.Sprintf("Public mismatch for test case %d", idx))
assert.Equal(t, got.Deleted, tc.deleted, fmt.Sprintf("Deleted mismatch for test case %d", idx))
assert.Equal(t, got.Dirty, tc.dirty, fmt.Sprintf("Dirty mismatch for test case %d", idx))
}
@@ -78,6 +85,7 @@ func TestNoteInsert(t *testing.T) {
addedOn int64
editedOn int64
usn int
+ public bool
deleted bool
dirty bool
}{
@@ -88,6 +96,7 @@ func TestNoteInsert(t *testing.T) {
addedOn: 1542058875,
editedOn: 0,
usn: 0,
+ public: false,
deleted: false,
dirty: false,
},
@@ -98,6 +107,7 @@ func TestNoteInsert(t *testing.T) {
addedOn: 1542058875,
editedOn: 1542058876,
usn: 1008,
+ public: true,
deleted: true,
dirty: true,
},
@@ -106,7 +116,8 @@ func TestNoteInsert(t *testing.T) {
for idx, tc := range testCases {
func() {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
n := Note{
UUID: tc.uuid,
@@ -115,6 +126,7 @@ func TestNoteInsert(t *testing.T) {
AddedOn: tc.addedOn,
EditedOn: tc.editedOn,
USN: tc.usn,
+ Public: tc.public,
Deleted: tc.deleted,
Dirty: tc.dirty,
}
@@ -122,12 +134,12 @@ func TestNoteInsert(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
if err := n.Insert(tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -136,10 +148,10 @@ func TestNoteInsert(t *testing.T) {
var uuid, bookUUID, body string
var addedOn, editedOn int64
var usn int
- var deleted, dirty bool
+ var public, deleted, dirty bool
MustScan(t, "getting n1",
- db.QueryRow("SELECT uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty FROM notes WHERE uuid = ?", tc.uuid),
- &uuid, &bookUUID, &body, &addedOn, &editedOn, &usn, &deleted, &dirty)
+ db.QueryRow("SELECT uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty FROM notes WHERE uuid = ?", tc.uuid),
+ &uuid, &bookUUID, &body, &addedOn, &editedOn, &usn, &public, &deleted, &dirty)
assert.Equal(t, uuid, tc.uuid, fmt.Sprintf("uuid mismatch for test case %d", idx))
assert.Equal(t, bookUUID, tc.bookUUID, fmt.Sprintf("bookUUID mismatch for test case %d", idx))
@@ -147,6 +159,7 @@ func TestNoteInsert(t *testing.T) {
assert.Equal(t, addedOn, tc.addedOn, fmt.Sprintf("addedOn mismatch for test case %d", idx))
assert.Equal(t, editedOn, tc.editedOn, fmt.Sprintf("editedOn mismatch for test case %d", idx))
assert.Equal(t, usn, tc.usn, fmt.Sprintf("usn mismatch for test case %d", idx))
+ assert.Equal(t, public, tc.public, fmt.Sprintf("public mismatch for test case %d", idx))
assert.Equal(t, deleted, tc.deleted, fmt.Sprintf("deleted mismatch for test case %d", idx))
assert.Equal(t, dirty, tc.dirty, fmt.Sprintf("dirty mismatch for test case %d", idx))
}()
@@ -161,12 +174,14 @@ func TestNoteUpdate(t *testing.T) {
addedOn int64
editedOn int64
usn int
+ public bool
deleted bool
dirty bool
newBookUUID string
newBody string
newEditedOn int64
newUSN int
+ newPublic bool
newDeleted bool
newDirty bool
}{
@@ -177,12 +192,14 @@ func TestNoteUpdate(t *testing.T) {
addedOn: 1542058875,
editedOn: 0,
usn: 0,
+ public: false,
deleted: false,
dirty: false,
newBookUUID: "b1-uuid",
newBody: "n1-body edited",
newEditedOn: 1542058879,
newUSN: 0,
+ newPublic: false,
newDeleted: false,
newDirty: false,
},
@@ -193,12 +210,14 @@ func TestNoteUpdate(t *testing.T) {
addedOn: 1542058875,
editedOn: 0,
usn: 0,
+ public: false,
deleted: false,
dirty: true,
newBookUUID: "b2-uuid",
newBody: "n1-body",
newEditedOn: 1542058879,
newUSN: 0,
+ newPublic: true,
newDeleted: false,
newDirty: false,
},
@@ -209,12 +228,14 @@ func TestNoteUpdate(t *testing.T) {
addedOn: 1542058875,
editedOn: 0,
usn: 10,
+ public: false,
deleted: false,
dirty: false,
newBookUUID: "",
newBody: "",
newEditedOn: 1542058879,
newUSN: 151,
+ newPublic: false,
newDeleted: true,
newDirty: false,
},
@@ -225,12 +246,14 @@ func TestNoteUpdate(t *testing.T) {
addedOn: 1542058875,
editedOn: 0,
usn: 0,
+ public: false,
deleted: false,
dirty: false,
newBookUUID: "",
newBody: "",
newEditedOn: 1542058879,
newUSN: 15,
+ newPublic: false,
newDeleted: true,
newDirty: false,
},
@@ -239,7 +262,8 @@ func TestNoteUpdate(t *testing.T) {
for idx, tc := range testCases {
func() {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
n1 := Note{
UUID: tc.uuid,
@@ -248,6 +272,7 @@ func TestNoteUpdate(t *testing.T) {
AddedOn: tc.addedOn,
EditedOn: tc.editedOn,
USN: tc.usn,
+ Public: tc.public,
Deleted: tc.deleted,
Dirty: tc.dirty,
}
@@ -258,29 +283,31 @@ func TestNoteUpdate(t *testing.T) {
AddedOn: 1542058875,
EditedOn: 0,
USN: 39,
+ Public: false,
Deleted: false,
Dirty: false,
}
- MustExec(t, fmt.Sprintf("inserting n1 for test case %d", idx), db, "INSERT INTO notes (uuid, book_uuid, usn, added_on, edited_on, body, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", n1.UUID, n1.BookUUID, n1.USN, n1.AddedOn, n1.EditedOn, n1.Body, n1.Deleted, n1.Dirty)
- MustExec(t, fmt.Sprintf("inserting n2 for test case %d", idx), db, "INSERT INTO notes (uuid, book_uuid, usn, added_on, edited_on, body, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", n2.UUID, n2.BookUUID, n2.USN, n2.AddedOn, n2.EditedOn, n2.Body, n2.Deleted, n2.Dirty)
+ MustExec(t, fmt.Sprintf("inserting n1 for test case %d", idx), db, "INSERT INTO notes (uuid, book_uuid, usn, added_on, edited_on, body, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", n1.UUID, n1.BookUUID, n1.USN, n1.AddedOn, n1.EditedOn, n1.Body, n1.Public, n1.Deleted, n1.Dirty)
+ MustExec(t, fmt.Sprintf("inserting n2 for test case %d", idx), db, "INSERT INTO notes (uuid, book_uuid, usn, added_on, edited_on, body, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", n2.UUID, n2.BookUUID, n2.USN, n2.AddedOn, n2.EditedOn, n2.Body, n2.Public, n2.Deleted, n2.Dirty)
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
n1.BookUUID = tc.newBookUUID
n1.Body = tc.newBody
n1.EditedOn = tc.newEditedOn
n1.USN = tc.newUSN
+ n1.Public = tc.newPublic
n1.Deleted = tc.newDeleted
n1.Dirty = tc.newDirty
if err := n1.Update(tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -288,11 +315,11 @@ func TestNoteUpdate(t *testing.T) {
// test
var n1Record, n2Record Note
MustScan(t, "getting n1",
- db.QueryRow("SELECT uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty FROM notes WHERE uuid = ?", tc.uuid),
- &n1Record.UUID, &n1Record.BookUUID, &n1Record.Body, &n1Record.AddedOn, &n1Record.EditedOn, &n1Record.USN, &n1Record.Deleted, &n1Record.Dirty)
+ db.QueryRow("SELECT uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty FROM notes WHERE uuid = ?", tc.uuid),
+ &n1Record.UUID, &n1Record.BookUUID, &n1Record.Body, &n1Record.AddedOn, &n1Record.EditedOn, &n1Record.USN, &n1Record.Public, &n1Record.Deleted, &n1Record.Dirty)
MustScan(t, "getting n2",
- db.QueryRow("SELECT uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty FROM notes WHERE uuid = ?", n2.UUID),
- &n2Record.UUID, &n2Record.BookUUID, &n2Record.Body, &n2Record.AddedOn, &n2Record.EditedOn, &n2Record.USN, &n2Record.Deleted, &n2Record.Dirty)
+ db.QueryRow("SELECT uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty FROM notes WHERE uuid = ?", n2.UUID),
+ &n2Record.UUID, &n2Record.BookUUID, &n2Record.Body, &n2Record.AddedOn, &n2Record.EditedOn, &n2Record.USN, &n2Record.Public, &n2Record.Deleted, &n2Record.Dirty)
assert.Equal(t, n1Record.UUID, n1.UUID, fmt.Sprintf("n1 uuid mismatch for test case %d", idx))
assert.Equal(t, n1Record.BookUUID, tc.newBookUUID, fmt.Sprintf("n1 bookUUID mismatch for test case %d", idx))
@@ -300,6 +327,7 @@ func TestNoteUpdate(t *testing.T) {
assert.Equal(t, n1Record.AddedOn, n1.AddedOn, fmt.Sprintf("n1 addedOn mismatch for test case %d", idx))
assert.Equal(t, n1Record.EditedOn, tc.newEditedOn, fmt.Sprintf("n1 editedOn mismatch for test case %d", idx))
assert.Equal(t, n1Record.USN, tc.newUSN, fmt.Sprintf("n1 usn mismatch for test case %d", idx))
+ assert.Equal(t, n1Record.Public, tc.newPublic, fmt.Sprintf("n1 public mismatch for test case %d", idx))
assert.Equal(t, n1Record.Deleted, tc.newDeleted, fmt.Sprintf("n1 deleted mismatch for test case %d", idx))
assert.Equal(t, n1Record.Dirty, tc.newDirty, fmt.Sprintf("n1 dirty mismatch for test case %d", idx))
@@ -309,6 +337,7 @@ func TestNoteUpdate(t *testing.T) {
assert.Equal(t, n2Record.AddedOn, n2.AddedOn, fmt.Sprintf("n2 addedOn mismatch for test case %d", idx))
assert.Equal(t, n2Record.EditedOn, n2.EditedOn, fmt.Sprintf("n2 editedOn mismatch for test case %d", idx))
assert.Equal(t, n2Record.USN, n2.USN, fmt.Sprintf("n2 usn mismatch for test case %d", idx))
+ assert.Equal(t, n2Record.Public, n2.Public, fmt.Sprintf("n2 public mismatch for test case %d", idx))
assert.Equal(t, n2Record.Deleted, n2.Deleted, fmt.Sprintf("n2 deleted mismatch for test case %d", idx))
assert.Equal(t, n2Record.Dirty, n2.Dirty, fmt.Sprintf("n2 dirty mismatch for test case %d", idx))
}()
@@ -330,7 +359,8 @@ func TestNoteUpdateUUID(t *testing.T) {
for idx, tc := range testCases {
t.Run(fmt.Sprintf("testCase%d", idx), func(t *testing.T) {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
n1 := Note{
UUID: "n1-uuid",
@@ -357,11 +387,11 @@ func TestNoteUpdateUUID(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := n1.UpdateUUID(tx, tc.newUUID); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -384,7 +414,8 @@ func TestNoteUpdateUUID(t *testing.T) {
func TestNoteExpunge(t *testing.T) {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
n1 := Note{
UUID: "n1-uuid",
@@ -393,6 +424,7 @@ func TestNoteExpunge(t *testing.T) {
AddedOn: 1542058874,
EditedOn: 0,
USN: 22,
+ Public: false,
Deleted: false,
Dirty: false,
}
@@ -403,22 +435,23 @@ func TestNoteExpunge(t *testing.T) {
AddedOn: 1542058875,
EditedOn: 0,
USN: 39,
+ Public: false,
Deleted: false,
Dirty: false,
}
- MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, usn, added_on, edited_on, body, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", n1.UUID, n1.BookUUID, n1.USN, n1.AddedOn, n1.EditedOn, n1.Body, n1.Deleted, n1.Dirty)
- MustExec(t, "inserting n2", db, "INSERT INTO notes (uuid, book_uuid, usn, added_on, edited_on, body, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", n2.UUID, n2.BookUUID, n2.USN, n2.AddedOn, n2.EditedOn, n2.Body, n2.Deleted, n2.Dirty)
+ MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, usn, added_on, edited_on, body, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", n1.UUID, n1.BookUUID, n1.USN, n1.AddedOn, n1.EditedOn, n1.Body, n1.Public, n1.Deleted, n1.Dirty)
+ MustExec(t, "inserting n2", db, "INSERT INTO notes (uuid, book_uuid, usn, added_on, edited_on, body, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", n2.UUID, n2.BookUUID, n2.USN, n2.AddedOn, n2.EditedOn, n2.Body, n2.Public, n2.Deleted, n2.Dirty)
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := n1.Expunge(tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -431,8 +464,8 @@ func TestNoteExpunge(t *testing.T) {
var n2Record Note
MustScan(t, "getting n2",
- db.QueryRow("SELECT uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty FROM notes WHERE uuid = ?", n2.UUID),
- &n2Record.UUID, &n2Record.BookUUID, &n2Record.Body, &n2Record.AddedOn, &n2Record.EditedOn, &n2Record.USN, &n2Record.Deleted, &n2Record.Dirty)
+ db.QueryRow("SELECT uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty FROM notes WHERE uuid = ?", n2.UUID),
+ &n2Record.UUID, &n2Record.BookUUID, &n2Record.Body, &n2Record.AddedOn, &n2Record.EditedOn, &n2Record.USN, &n2Record.Public, &n2Record.Deleted, &n2Record.Dirty)
assert.Equal(t, n2Record.UUID, n2.UUID, "n2 uuid mismatch")
assert.Equal(t, n2Record.BookUUID, n2.BookUUID, "n2 bookUUID mismatch")
@@ -440,6 +473,7 @@ func TestNoteExpunge(t *testing.T) {
assert.Equal(t, n2Record.AddedOn, n2.AddedOn, "n2 addedOn mismatch")
assert.Equal(t, n2Record.EditedOn, n2.EditedOn, "n2 editedOn mismatch")
assert.Equal(t, n2Record.USN, n2.USN, "n2 usn mismatch")
+ assert.Equal(t, n2Record.Public, n2.Public, "n2 public mismatch")
assert.Equal(t, n2Record.Deleted, n2.Deleted, "n2 deleted mismatch")
assert.Equal(t, n2Record.Dirty, n2.Dirty, "n2 dirty mismatch")
}
@@ -506,7 +540,8 @@ func TestBookInsert(t *testing.T) {
for idx, tc := range testCases {
func() {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
b := Book{
UUID: tc.uuid,
@@ -520,12 +555,12 @@ func TestBookInsert(t *testing.T) {
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
if err := b.Insert(tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -586,7 +621,8 @@ func TestBookUpdate(t *testing.T) {
for idx, tc := range testCases {
func() {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
b1 := Book{
UUID: "b1-uuid",
@@ -609,7 +645,7 @@ func TestBookUpdate(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("beginning a transaction for test case %d", idx)).Error())
}
b1.Label = tc.newLabel
@@ -619,7 +655,7 @@ func TestBookUpdate(t *testing.T) {
if err := b1.Update(tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
+ t.Fatalf(errors.Wrap(err, fmt.Sprintf("executing for test case %d", idx)).Error())
}
tx.Commit()
@@ -664,7 +700,8 @@ func TestBookUpdateUUID(t *testing.T) {
t.Run(fmt.Sprintf("testCase%d", idx), func(t *testing.T) {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
b1 := Book{
UUID: "b1-uuid",
@@ -687,11 +724,11 @@ func TestBookUpdateUUID(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := b1.UpdateUUID(tx, tc.newUUID); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -714,7 +751,8 @@ func TestBookUpdateUUID(t *testing.T) {
func TestBookExpunge(t *testing.T) {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
b1 := Book{
UUID: "b1-uuid",
@@ -737,12 +775,12 @@ func TestBookExpunge(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := b1.Expunge(tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing").Error())
+ t.Fatalf(errors.Wrap(err, "executing").Error())
}
tx.Commit()
@@ -768,7 +806,8 @@ func TestBookExpunge(t *testing.T) {
// TestNoteFTS tests that note full text search indices stay in sync with the notes after insert, update and delete
func TestNoteFTS(t *testing.T) {
// set up
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
// execute - insert
n := Note{
@@ -778,18 +817,19 @@ func TestNoteFTS(t *testing.T) {
AddedOn: 1542058875,
EditedOn: 0,
USN: 0,
+ Public: false,
Deleted: false,
Dirty: false,
}
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := n.Insert(tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "inserting").Error())
+ t.Fatalf(errors.Wrap(err, "inserting").Error())
}
tx.Commit()
@@ -807,13 +847,13 @@ func TestNoteFTS(t *testing.T) {
// execute - update
tx, err = db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
n.Body = "baz quz"
if err := n.Update(tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "updating").Error())
+ t.Fatalf(errors.Wrap(err, "updating").Error())
}
tx.Commit()
@@ -832,12 +872,12 @@ func TestNoteFTS(t *testing.T) {
// execute - delete
tx, err = db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := n.Expunge(tx); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "expunging").Error())
+ t.Fatalf(errors.Wrap(err, "expunging").Error())
}
tx.Commit()
diff --git a/pkg/cli/database/queries.go b/pkg/cli/database/queries.go
index 2209c8f3..5691175f 100644
--- a/pkg/cli/database/queries.go
+++ b/pkg/cli/database/queries.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package database
@@ -167,6 +170,7 @@ func GetActiveNote(db *DB, rowid int) (Note, error) {
added_on,
edited_on,
usn,
+ public,
deleted,
dirty
FROM notes WHERE rowid = ? AND deleted = false;`, rowid).Scan(
@@ -177,6 +181,7 @@ func GetActiveNote(db *DB, rowid int) (Note, error) {
&ret.AddedOn,
&ret.EditedOn,
&ret.USN,
+ &ret.Public,
&ret.Deleted,
&ret.Dirty,
)
diff --git a/pkg/cli/database/queries_test.go b/pkg/cli/database/queries_test.go
index e394fe95..1ac168e4 100644
--- a/pkg/cli/database/queries_test.go
+++ b/pkg/cli/database/queries_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package database
@@ -44,17 +47,18 @@ func TestInsertSystem(t *testing.T) {
for _, tc := range testCases {
t.Run(fmt.Sprintf("insert %s %s", tc.key, tc.val), func(t *testing.T) {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := InsertSystem(tx, tc.key, tc.val); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing for test case").Error())
+ t.Fatalf(errors.Wrap(err, "executing for test case").Error())
}
tx.Commit()
@@ -91,7 +95,8 @@ func TestUpsertSystem(t *testing.T) {
for _, tc := range testCases {
t.Run(fmt.Sprintf("insert %s %s", tc.key, tc.val), func(t *testing.T) {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
MustExec(t, "inserting a system configuration", db, "INSERT INTO system (key, value) VALUES (?, ?)", "baz", "quz")
@@ -101,12 +106,12 @@ func TestUpsertSystem(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := UpsertSystem(tx, tc.key, tc.val); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing for test case").Error())
+ t.Fatalf(errors.Wrap(err, "executing for test case").Error())
}
tx.Commit()
@@ -129,19 +134,20 @@ func TestUpsertSystem(t *testing.T) {
func TestGetSystem(t *testing.T) {
t.Run(fmt.Sprintf("get string value"), func(t *testing.T) {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
// execute
MustExec(t, "inserting a system configuration", db, "INSERT INTO system (key, value) VALUES (?, ?)", "foo", "bar")
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
var dest string
if err := GetSystem(tx, "foo", &dest); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing for test case").Error())
+ t.Fatalf(errors.Wrap(err, "executing for test case").Error())
}
tx.Commit()
@@ -151,19 +157,20 @@ func TestGetSystem(t *testing.T) {
t.Run(fmt.Sprintf("get int64 value"), func(t *testing.T) {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
// execute
MustExec(t, "inserting a system configuration", db, "INSERT INTO system (key, value) VALUES (?, ?)", "foo", 1234)
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
var dest int64
if err := GetSystem(tx, "foo", &dest); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing for test case").Error())
+ t.Fatalf(errors.Wrap(err, "executing for test case").Error())
}
tx.Commit()
@@ -191,7 +198,8 @@ func TestUpdateSystem(t *testing.T) {
for _, tc := range testCases {
t.Run(fmt.Sprintf("update %s %s", tc.key, tc.val), func(t *testing.T) {
// Setup
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
MustExec(t, "inserting a system configuration", db, "INSERT INTO system (key, value) VALUES (?, ?)", "foo", "fuz")
MustExec(t, "inserting a system configuration", db, "INSERT INTO system (key, value) VALUES (?, ?)", "baz", "quz")
@@ -202,12 +210,12 @@ func TestUpdateSystem(t *testing.T) {
// execute
tx, err := db.Begin()
if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
+ t.Fatalf(errors.Wrap(err, "beginning a transaction").Error())
}
if err := UpdateSystem(tx, tc.key, tc.val); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "executing for test case").Error())
+ t.Fatalf(errors.Wrap(err, "executing for test case").Error())
}
tx.Commit()
@@ -230,10 +238,11 @@ func TestUpdateSystem(t *testing.T) {
func TestGetActiveNote(t *testing.T) {
t.Run("not deleted", func(t *testing.T) {
// set up
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
n1UUID := "n1-uuid"
- MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", n1UUID, "b1-uuid", "n1 content", 1542058875, 1542058876, 1, false, true)
+ MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", n1UUID, "b1-uuid", "n1 content", 1542058875, 1542058876, 1, true, false, true)
var n1RowID int
MustScan(t, "getting rowid", db.QueryRow("SELECT rowid FROM notes WHERE uuid = ?", n1UUID), &n1RowID)
@@ -252,16 +261,18 @@ func TestGetActiveNote(t *testing.T) {
assert.Equal(t, got.AddedOn, int64(1542058875), "AddedOn mismatch")
assert.Equal(t, got.EditedOn, int64(1542058876), "EditedOn mismatch")
assert.Equal(t, got.USN, 1, "USN mismatch")
+ assert.Equal(t, got.Public, true, "Public mismatch")
assert.Equal(t, got.Deleted, false, "Deleted mismatch")
assert.Equal(t, got.Dirty, true, "Dirty mismatch")
})
t.Run("deleted", func(t *testing.T) {
// set up
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
n1UUID := "n1-uuid"
- MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", n1UUID, "b1-uuid", "n1 content", 1542058875, 1542058876, 1, true, true)
+ MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", n1UUID, "b1-uuid", "n1 content", 1542058875, 1542058876, 1, true, true, true)
var n1RowID int
MustScan(t, "getting rowid", db.QueryRow("SELECT rowid FROM notes WHERE uuid = ?", n1UUID), &n1RowID)
@@ -281,10 +292,11 @@ func TestGetActiveNote(t *testing.T) {
func TestUpdateNoteContent(t *testing.T) {
// set up
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
uuid := "n1-uuid"
- MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", uuid, "b1-uuid", "n1 content", 1542058875, 0, 1, false, false)
+ MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", uuid, "b1-uuid", "n1 content", 1542058875, 0, 1, false, false, false)
var rowid int
MustScan(t, "getting rowid", db.QueryRow("SELECT rowid FROM notes WHERE uuid = ?", uuid), &rowid)
@@ -312,7 +324,8 @@ func TestUpdateNoteContent(t *testing.T) {
func TestUpdateNoteBook(t *testing.T) {
// set up
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
b1UUID := "b1-uuid"
b2UUID := "b2-uuid"
@@ -320,7 +333,7 @@ func TestUpdateNoteBook(t *testing.T) {
MustExec(t, "inserting b2", db, "INSERT INTO books (uuid, label, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?)", b2UUID, "b2-label", 9, false, false)
uuid := "n1-uuid"
- MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", uuid, b1UUID, "n1 content", 1542058875, 0, 1, false, false)
+ MustExec(t, "inserting n1", db, "INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", uuid, b1UUID, "n1 content", 1542058875, 0, 1, false, false, false)
var rowid int
MustScan(t, "getting rowid", db.QueryRow("SELECT rowid FROM notes WHERE uuid = ?", uuid), &rowid)
@@ -348,7 +361,8 @@ func TestUpdateNoteBook(t *testing.T) {
func TestUpdateBookName(t *testing.T) {
// set up
- db := InitTestMemoryDB(t)
+ db := InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer TeardownTestDB(t, db)
b1UUID := "b1-uuid"
MustExec(t, "inserting b1", db, "INSERT INTO books (uuid, label, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?)", b1UUID, "b1-label", 8, false, false)
diff --git a/pkg/cli/database/schema.sql b/pkg/cli/database/schema.sql
deleted file mode 100644
index 9a9de094..00000000
--- a/pkg/cli/database/schema.sql
+++ /dev/null
@@ -1,40 +0,0 @@
--- This is the final state of the CLI database after all migrations.
--- Auto-generated by generate-schema.go. Do not edit manually.
-CREATE TABLE books
- (
- uuid text PRIMARY KEY,
- label text NOT NULL
- , dirty bool DEFAULT false, usn int DEFAULT 0 NOT NULL, deleted bool DEFAULT false);
-CREATE TABLE system
- (
- key string NOT NULL,
- value text NOT NULL
- );
-CREATE UNIQUE INDEX idx_books_label ON books(label);
-CREATE UNIQUE INDEX idx_books_uuid ON books(uuid);
-CREATE TABLE "notes"
- (
- uuid text NOT NULL,
- book_uuid text NOT NULL,
- body text NOT NULL,
- added_on integer NOT NULL,
- edited_on integer DEFAULT 0,
- dirty bool DEFAULT false,
- usn int DEFAULT 0 NOT NULL,
- deleted bool DEFAULT false
- );
-CREATE VIRTUAL TABLE note_fts USING fts5(content=notes, body, tokenize="porter unicode61 categories 'L* N* Co Ps Pe'");
-CREATE TRIGGER notes_after_insert AFTER INSERT ON notes BEGIN
- INSERT INTO note_fts(rowid, body) VALUES (new.rowid, new.body);
- END;
-CREATE TRIGGER notes_after_delete AFTER DELETE ON notes BEGIN
- INSERT INTO note_fts(note_fts, rowid, body) VALUES ('delete', old.rowid, old.body);
- END;
-CREATE TRIGGER notes_after_update AFTER UPDATE ON notes BEGIN
- INSERT INTO note_fts(note_fts, rowid, body) VALUES ('delete', old.rowid, old.body);
- INSERT INTO note_fts(rowid, body) VALUES (new.rowid, new.body);
- END;
-
--- Migration version data.
-INSERT INTO system (key, value) VALUES ('schema', 14);
-INSERT INTO system (key, value) VALUES ('remote_schema', 1);
diff --git a/pkg/cli/database/schema/main.go b/pkg/cli/database/schema/main.go
deleted file mode 100644
index 6c75e4d0..00000000
--- a/pkg/cli/database/schema/main.go
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Command schema generates the CLI database schema.sql file.
-package main
-
-import (
- "fmt"
- "os"
- "path/filepath"
- "strings"
-
- "github.com/dnote/dnote/pkg/cli/config"
- "github.com/dnote/dnote/pkg/cli/consts"
- "github.com/dnote/dnote/pkg/cli/context"
- "github.com/dnote/dnote/pkg/cli/database"
- "github.com/dnote/dnote/pkg/cli/infra"
- "github.com/dnote/dnote/pkg/cli/migrate"
-)
-
-func main() {
- tmpDir, err := os.MkdirTemp("", "dnote-schema-gen-*")
- if err != nil {
- fmt.Fprintf(os.Stderr, "Error: %v\n", err)
- os.Exit(1)
- }
- defer os.RemoveAll(tmpDir)
-
- schemaPath := filepath.Join("pkg", "cli", "database", "schema.sql")
-
- if err := run(tmpDir, schemaPath); err != nil {
- fmt.Fprintf(os.Stderr, "Error: %v\n", err)
- os.Exit(1)
- }
-}
-
-func run(tmpDir, outputPath string) error {
- schema, err := generateSchema(tmpDir)
- if err != nil {
- return err
- }
-
- if err := os.WriteFile(outputPath, []byte(schema), 0644); err != nil {
- return fmt.Errorf("writing schema file: %w", err)
- }
-
- fmt.Printf("Schema generated successfully at %s\n", outputPath)
- return nil
-}
-
-// generateSchema creates a fresh database, runs all migrations, and extracts the schema
-func generateSchema(tmpDir string) (string, error) {
- // Create dnote directory structure in temp dir
- dnoteDir := filepath.Join(tmpDir, "dnote")
- if err := os.MkdirAll(dnoteDir, 0755); err != nil {
- return "", fmt.Errorf("creating dnote dir: %w", err)
- }
-
- // Use a file-based database
- dbPath := filepath.Join(tmpDir, "schema.db")
-
- // Create context
- ctx := context.DnoteCtx{
- Paths: context.Paths{
- Home: tmpDir,
- Config: tmpDir,
- Data: tmpDir,
- Cache: tmpDir,
- },
- Version: "schema-gen",
- }
-
- // Open database
- db, err := database.Open(dbPath)
- if err != nil {
- return "", fmt.Errorf("opening database: %w", err)
- }
- defer db.Close()
- ctx.DB = db
-
- // Initialize database with base tables
- if err := infra.InitDB(ctx); err != nil {
- return "", fmt.Errorf("initializing database: %w", err)
- }
-
- // Initialize system data
- if err := infra.InitSystem(ctx); err != nil {
- return "", fmt.Errorf("initializing system: %w", err)
- }
-
- // Create minimal config file
- if err := config.Write(ctx, config.Config{}); err != nil {
- return "", fmt.Errorf("writing initial config: %w", err)
- }
-
- // Run all local migrations
- if err := migrate.Run(ctx, migrate.LocalSequence, migrate.LocalMode); err != nil {
- return "", fmt.Errorf("running migrations: %w", err)
- }
-
- // Extract schema before closing database
- schema, err := extractSchema(db)
- if err != nil {
- return "", fmt.Errorf("extracting schema: %w", err)
- }
-
- // Add INSERT statements for migration versions.
- systemData := "\n-- Migration version data.\n"
- systemData += fmt.Sprintf("INSERT INTO system (key, value) VALUES ('%s', %d);\n", consts.SystemSchema, len(migrate.LocalSequence))
- systemData += fmt.Sprintf("INSERT INTO system (key, value) VALUES ('%s', %d);\n", consts.SystemRemoteSchema, len(migrate.RemoteSequence))
-
- return schema + systemData, nil
-}
-
-// extractSchema extracts the complete schema by querying sqlite_master
-func extractSchema(db *database.DB) (string, error) {
- // Query sqlite_master for all schema objects, excluding FTS shadow tables
- // FTS shadow tables are internal tables automatically created by FTS virtual tables
- rows, err := db.Conn.Query(`SELECT sql FROM sqlite_master
- WHERE sql IS NOT NULL
- AND name NOT LIKE 'sqlite_%'
- AND (type != 'table'
- OR (type = 'table' AND name NOT IN (
- SELECT m1.name FROM sqlite_master m1
- JOIN sqlite_master m2 ON m1.name LIKE m2.name || '_%'
- WHERE m2.type = 'table' AND m2.sql LIKE '%VIRTUAL TABLE%'
- )))`)
- if err != nil {
- return "", fmt.Errorf("querying sqlite_master: %w", err)
- }
- defer rows.Close()
-
- var schemas []string
- for rows.Next() {
- var sql string
- if err := rows.Scan(&sql); err != nil {
- return "", fmt.Errorf("scanning row: %w", err)
- }
- schemas = append(schemas, sql)
- }
-
- if err := rows.Err(); err != nil {
- return "", fmt.Errorf("iterating rows: %w", err)
- }
-
- // Add autogenerated header comment
- header := `-- This is the final state of the CLI database after all migrations.
--- Auto-generated by generate-schema.go. Do not edit manually.
-`
- return header + strings.Join(schemas, ";\n") + ";\n", nil
-}
diff --git a/pkg/cli/database/schema/main_test.go b/pkg/cli/database/schema/main_test.go
deleted file mode 100644
index 26898ef3..00000000
--- a/pkg/cli/database/schema/main_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "fmt"
- "os"
- "path/filepath"
- "strings"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/cli/consts"
-)
-
-func TestRun(t *testing.T) {
- tmpDir := t.TempDir()
- outputPath := filepath.Join(tmpDir, "schema.sql")
-
- // Run the function
- if err := run(tmpDir, outputPath); err != nil {
- t.Fatalf("run() failed: %v", err)
- }
-
- // Verify schema.sql was created
- content, err := os.ReadFile(outputPath)
- if err != nil {
- t.Fatalf("reading schema.sql: %v", err)
- }
-
- schema := string(content)
-
- // Verify it has the header
- assert.Equal(t, strings.HasPrefix(schema, "-- This is the final state"), true, "schema.sql should have header comment")
-
- // Verify schema contains expected tables
- expectedTables := []string{
- "CREATE TABLE books",
- "CREATE TABLE system",
- "CREATE TABLE \"notes\"",
- "CREATE VIRTUAL TABLE note_fts",
- }
-
- for _, expected := range expectedTables {
- assert.Equal(t, strings.Contains(schema, expected), true, fmt.Sprintf("schema should contain %s", expected))
- }
-
- // Verify schema contains triggers
- expectedTriggers := []string{
- "CREATE TRIGGER notes_after_insert",
- "CREATE TRIGGER notes_after_delete",
- "CREATE TRIGGER notes_after_update",
- }
-
- for _, expected := range expectedTriggers {
- assert.Equal(t, strings.Contains(schema, expected), true, fmt.Sprintf("schema should contain %s", expected))
- }
-
- // Verify schema does not contain sqlite internal tables
- assert.Equal(t, strings.Contains(schema, "sqlite_sequence"), false, "schema should not contain sqlite_sequence")
-
- // Verify system key-value pairs for schema versions are present
- expectedSchemaKey := fmt.Sprintf("INSERT INTO system (key, value) VALUES ('%s',", consts.SystemSchema)
- assert.Equal(t, strings.Contains(schema, expectedSchemaKey), true, "schema should contain schema version INSERT statement")
-
- expectedRemoteSchemaKey := fmt.Sprintf("INSERT INTO system (key, value) VALUES ('%s',", consts.SystemRemoteSchema)
- assert.Equal(t, strings.Contains(schema, expectedRemoteSchemaKey), true, "schema should contain remote_schema version INSERT statement")
-}
diff --git a/pkg/cli/database/sql.go b/pkg/cli/database/sql.go
index 0af3c7fd..3af29502 100644
--- a/pkg/cli/database/sql.go
+++ b/pkg/cli/database/sql.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package database
diff --git a/pkg/cli/database/testutils.go b/pkg/cli/database/testutils.go
index 23633d53..17032696 100644
--- a/pkg/cli/database/testutils.go
+++ b/pkg/cli/database/testutils.go
@@ -1,24 +1,27 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package database
import (
"database/sql"
- _ "embed"
"fmt"
+ "os"
"path/filepath"
"testing"
@@ -27,13 +30,56 @@ import (
"github.com/pkg/errors"
)
-//go:embed schema.sql
-var defaultSchemaSQL string
-
-// GetDefaultSchemaSQL returns the default schema SQL for tests
-func GetDefaultSchemaSQL() string {
- return defaultSchemaSQL
-}
+var defaultSchemaSQL = `CREATE TABLE books
+ (
+ uuid text PRIMARY KEY,
+ label text NOT NULL
+ , dirty bool DEFAULT false, usn int DEFAULT 0 NOT NULL, deleted bool DEFAULT false);
+CREATE TABLE system
+ (
+ key string NOT NULL,
+ value text NOT NULL
+ );
+CREATE UNIQUE INDEX idx_books_label ON books(label);
+CREATE UNIQUE INDEX idx_books_uuid ON books(uuid);
+CREATE TABLE IF NOT EXISTS "notes"
+ (
+ uuid text NOT NULL,
+ book_uuid text NOT NULL,
+ body text NOT NULL,
+ added_on integer NOT NULL,
+ edited_on integer DEFAULT 0,
+ public bool DEFAULT false,
+ dirty bool DEFAULT false,
+ usn int DEFAULT 0 NOT NULL,
+ deleted bool DEFAULT false
+ );
+CREATE VIRTUAL TABLE note_fts USING fts5(content=notes, body, tokenize="porter unicode61 categories 'L* N* Co Ps Pe'")
+/* note_fts(body) */;
+CREATE TABLE IF NOT EXISTS 'note_fts_data'(id INTEGER PRIMARY KEY, block BLOB);
+CREATE TABLE IF NOT EXISTS 'note_fts_idx'(segid, term, pgno, PRIMARY KEY(segid, term)) WITHOUT ROWID;
+CREATE TABLE IF NOT EXISTS 'note_fts_docsize'(id INTEGER PRIMARY KEY, sz BLOB);
+CREATE TABLE IF NOT EXISTS 'note_fts_config'(k PRIMARY KEY, v) WITHOUT ROWID;
+CREATE TRIGGER notes_after_insert AFTER INSERT ON notes BEGIN
+ INSERT INTO note_fts(rowid, body) VALUES (new.rowid, new.body);
+ END;
+CREATE TRIGGER notes_after_delete AFTER DELETE ON notes BEGIN
+ INSERT INTO note_fts(note_fts, rowid, body) VALUES ('delete', old.rowid, old.body);
+ END;
+CREATE TRIGGER notes_after_update AFTER UPDATE ON notes BEGIN
+ INSERT INTO note_fts(note_fts, rowid, body) VALUES ('delete', old.rowid, old.body);
+ INSERT INTO note_fts(rowid, body) VALUES (new.rowid, new.body);
+ END;
+CREATE TABLE actions
+ (
+ uuid text PRIMARY KEY,
+ schema integer NOT NULL,
+ type text NOT NULL,
+ data text NOT NULL,
+ timestamp integer NOT NULL
+ );
+CREATE UNIQUE INDEX idx_notes_uuid ON notes(uuid);
+CREATE INDEX idx_notes_book_uuid ON notes(book_uuid);`
// MustScan scans the given row and fails a test in case of any errors
func MustScan(t *testing.T, message string, row *sql.Row, args ...interface{}) {
@@ -53,48 +99,29 @@ func MustExec(t *testing.T, message string, db *DB, query string, args ...interf
return result
}
-// InitTestMemoryDB initializes an in-memory test database with the default schema.
-func InitTestMemoryDB(t *testing.T) *DB {
- return InitTestMemoryDBRaw(t, "")
+// TestDBOptions contains options for test database
+type TestDBOptions struct {
+ SchemaSQLPath string
+ SkipMigration bool
}
-// InitTestFileDB initializes a file-based test database with the default schema.
-func InitTestFileDB(t *testing.T) (*DB, string) {
- uuid := mustGenerateTestUUID(t)
- dbPath := filepath.Join(t.TempDir(), fmt.Sprintf("dnote-%s.db", uuid))
- db := InitTestFileDBRaw(t, dbPath)
- return db, dbPath
-}
-
-// InitTestFileDBRaw initializes a file-based test database at the specified path with the default schema.
-func InitTestFileDBRaw(t *testing.T, dbPath string) *DB {
+// InitTestDB initializes a test database and opens connection to it
+func InitTestDB(t *testing.T, dbPath string, options *TestDBOptions) *DB {
db, err := Open(dbPath)
if err != nil {
- t.Fatal(errors.Wrap(err, "opening database"))
+ t.Fatal(errors.Wrap(err, "opening database connection"))
}
- if _, err := db.Exec(defaultSchemaSQL); err != nil {
- t.Fatal(errors.Wrap(err, "running schema sql"))
- }
-
- t.Cleanup(func() { db.Close() })
- return db
-}
-
-// InitTestMemoryDBRaw initializes an in-memory test database without marking migrations complete.
-// If schemaPath is empty, uses the default schema. Used for migration testing.
-func InitTestMemoryDBRaw(t *testing.T, schemaPath string) *DB {
- uuid := mustGenerateTestUUID(t)
- dbName := fmt.Sprintf("file:%s?mode=memory&cache=shared", uuid)
-
- db, err := Open(dbName)
+ dir, _ := filepath.Split(dbPath)
+ err = os.MkdirAll(dir, 0777)
if err != nil {
- t.Fatal(errors.Wrap(err, "opening in-memory database"))
+ t.Fatal(errors.Wrap(err, "creating the directory for test database file"))
}
var schemaSQL string
- if schemaPath != "" {
- schemaSQL = string(utils.ReadFileAbs(schemaPath))
+ if options != nil && options.SchemaSQLPath != "" {
+ b := utils.ReadFileAbs(options.SchemaSQLPath)
+ schemaSQL = string(b)
} else {
schemaSQL = defaultSchemaSQL
}
@@ -103,14 +130,28 @@ func InitTestMemoryDBRaw(t *testing.T, schemaPath string) *DB {
t.Fatal(errors.Wrap(err, "running schema sql"))
}
- t.Cleanup(func() { db.Close() })
+ if options == nil || !options.SkipMigration {
+ MarkMigrationComplete(t, db)
+ }
+
return db
}
+// TeardownTestDB closes the test database and removes the its file
+func TeardownTestDB(t *testing.T, db *DB) {
+ if err := db.Close(); err != nil {
+ t.Fatal(errors.Wrap(err, "closing database"))
+ }
+
+ if err := os.RemoveAll(db.Filepath); err != nil {
+ t.Fatal(errors.Wrap(err, "removing database file"))
+ }
+}
+
// OpenTestDB opens the database connection to a test database
// without initializing any schema
func OpenTestDB(t *testing.T, dnoteDir string) *DB {
- dbPath := fmt.Sprintf("%s/%s/%s", dnoteDir, consts.DnoteDirName, consts.DnoteDBFileName)
+ dbPath := fmt.Sprintf("%s/%s", dnoteDir, consts.DnoteDBFileName)
db, err := Open(dbPath)
if err != nil {
t.Fatal(errors.Wrap(err, "opening database connection to the test database"))
@@ -119,11 +160,12 @@ func OpenTestDB(t *testing.T, dnoteDir string) *DB {
return db
}
-// mustGenerateTestUUID generates a UUID for test databases and fails the test on error
-func mustGenerateTestUUID(t *testing.T) string {
- uuid, err := utils.GenerateUUID()
- if err != nil {
- t.Fatal(errors.Wrap(err, "generating UUID for test database"))
+// MarkMigrationComplete marks all migrations as complete in the database
+func MarkMigrationComplete(t *testing.T, db *DB) {
+ if _, err := db.Exec("INSERT INTO system (key, value) VALUES (? , ?);", consts.SystemSchema, 12); err != nil {
+ t.Fatal(errors.Wrap(err, "inserting schema"))
+ }
+ if _, err := db.Exec("INSERT INTO system (key, value) VALUES (? , ?);", consts.SystemRemoteSchema, 1); err != nil {
+ t.Fatal(errors.Wrap(err, "inserting remote schema"))
}
- return uuid
}
diff --git a/pkg/cli/infra/init.go b/pkg/cli/infra/init.go
index a6cbd1aa..5feb4b7d 100644
--- a/pkg/cli/infra/init.go
+++ b/pkg/cli/infra/init.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package infra provides operations and definitions for the
@@ -21,10 +24,10 @@ import (
"database/sql"
"fmt"
"os"
+ "os/user"
"strconv"
"time"
- "github.com/dnote/dnote/pkg/cli/client"
"github.com/dnote/dnote/pkg/cli/config"
"github.com/dnote/dnote/pkg/cli/consts"
"github.com/dnote/dnote/pkg/cli/context"
@@ -33,85 +36,44 @@ import (
"github.com/dnote/dnote/pkg/cli/migrate"
"github.com/dnote/dnote/pkg/cli/utils"
"github.com/dnote/dnote/pkg/clock"
- "github.com/dnote/dnote/pkg/dirs"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
-const (
- // DefaultAPIEndpoint is the default API endpoint used when none is configured
- DefaultAPIEndpoint = "http://localhost:3001/api"
-)
-
// RunEFunc is a function type of dnote commands
type RunEFunc func(*cobra.Command, []string) error
-func checkLegacyDBPath() (string, bool) {
- legacyDnoteDir := getLegacyDnotePath(dirs.Home)
- ok, err := utils.FileExists(legacyDnoteDir)
- if ok {
- return legacyDnoteDir, true
- }
-
+func newCtx(versionTag string) (context.DnoteCtx, error) {
+ homeDir, err := getHomeDir()
if err != nil {
- log.Error(errors.Wrapf(err, "checking legacy dnote directory at %s", legacyDnoteDir).Error())
+ return context.DnoteCtx{}, errors.Wrap(err, "Failed to get home dir")
}
+ dnoteDir := getDnoteDir(homeDir)
- return "", false
-}
-
-func getDBPath(paths context.Paths, customPath string) string {
- // If custom path is provided, use it
- if customPath != "" {
- return customPath
- }
-
- legacyDnoteDir, ok := checkLegacyDBPath()
- if ok {
- return fmt.Sprintf("%s/%s", legacyDnoteDir, consts.DnoteDBFileName)
- }
-
- return fmt.Sprintf("%s/%s/%s", paths.Data, consts.DnoteDirName, consts.DnoteDBFileName)
-}
-
-// newBaseCtx creates a minimal context with paths and database connection.
-// This base context is used for file and database initialization before
-// being enriched with config values by setupCtx.
-func newBaseCtx(versionTag, customDBPath string) (context.DnoteCtx, error) {
- dnoteDir := getLegacyDnotePath(dirs.Home)
- paths := context.Paths{
- Home: dirs.Home,
- Config: dirs.ConfigHome,
- Data: dirs.DataHome,
- Cache: dirs.CacheHome,
- LegacyDnote: dnoteDir,
- }
-
- dbPath := getDBPath(paths, customDBPath)
-
- db, err := database.Open(dbPath)
+ dnoteDBPath := fmt.Sprintf("%s/%s", dnoteDir, consts.DnoteDBFileName)
+ db, err := database.Open(dnoteDBPath)
if err != nil {
return context.DnoteCtx{}, errors.Wrap(err, "conntecting to db")
}
ctx := context.DnoteCtx{
- Paths: paths,
- Version: versionTag,
- DB: db,
+ HomeDir: homeDir,
+ DnoteDir: dnoteDir,
+ Version: versionTag,
+ DB: db,
}
return ctx, nil
}
// Init initializes the Dnote environment and returns a new dnote context
-// apiEndpoint is used when creating a new config file (e.g., from ldflags during tests)
-func Init(versionTag, apiEndpoint, dbPath string) (*context.DnoteCtx, error) {
- ctx, err := newBaseCtx(versionTag, dbPath)
+func Init(apiEndpoint, versionTag string) (*context.DnoteCtx, error) {
+ ctx, err := newCtx(versionTag)
if err != nil {
return nil, errors.Wrap(err, "initializing a context")
}
- if err := initFiles(ctx, apiEndpoint); err != nil {
+ if err := InitFiles(ctx, apiEndpoint); err != nil {
return nil, errors.Wrap(err, "initializing files")
}
@@ -129,19 +91,18 @@ func Init(versionTag, apiEndpoint, dbPath string) (*context.DnoteCtx, error) {
return nil, errors.Wrap(err, "running migration")
}
- ctx, err = setupCtx(ctx)
+ ctx, err = SetupCtx(ctx)
if err != nil {
return nil, errors.Wrap(err, "setting up the context")
}
- log.Debug("context: %+v\n", context.Redact(ctx))
+ log.Debug("Running with Dnote context: %+v\n", context.Redact(ctx))
return &ctx, nil
}
-// setupCtx enriches the base context with values from config file and database.
-// This is called after files and database have been initialized.
-func setupCtx(ctx context.DnoteCtx) (context.DnoteCtx, error) {
+// SetupCtx populates the context and returns a new context
+func SetupCtx(ctx context.DnoteCtx) (context.DnoteCtx, error) {
db := ctx.DB
var sessionKey string
@@ -162,25 +123,45 @@ func setupCtx(ctx context.DnoteCtx) (context.DnoteCtx, error) {
}
ret := context.DnoteCtx{
- Paths: ctx.Paths,
- Version: ctx.Version,
- DB: ctx.DB,
- SessionKey: sessionKey,
- SessionKeyExpiry: sessionKeyExpiry,
- APIEndpoint: cf.APIEndpoint,
- Editor: cf.Editor,
- Clock: clock.New(),
- EnableUpgradeCheck: cf.EnableUpgradeCheck,
- HTTPClient: client.NewRateLimitedHTTPClient(),
+ HomeDir: ctx.HomeDir,
+ DnoteDir: ctx.DnoteDir,
+ Version: ctx.Version,
+ DB: ctx.DB,
+ SessionKey: sessionKey,
+ SessionKeyExpiry: sessionKeyExpiry,
+ APIEndpoint: cf.APIEndpoint,
+ Editor: cf.Editor,
+ Clock: clock.New(),
}
return ret, nil
}
-// getLegacyDnotePath returns a legacy dnote directory path placed under
-// the user's home directory
-func getLegacyDnotePath(homeDir string) string {
- return fmt.Sprintf("%s/%s", homeDir, consts.LegacyDnoteDirName)
+func getDnoteDir(homeDir string) string {
+ var ret string
+
+ dnoteDirEnv := os.Getenv("DNOTE_DIR")
+ if dnoteDirEnv == "" {
+ ret = fmt.Sprintf("%s/%s", homeDir, consts.DnoteDirName)
+ } else {
+ ret = dnoteDirEnv
+ }
+
+ return ret
+}
+
+func getHomeDir() (string, error) {
+ homeDirEnv := os.Getenv("DNOTE_HOME_DIR")
+ if homeDirEnv != "" {
+ return homeDirEnv, nil
+ }
+
+ usr, err := user.Current()
+ if err != nil {
+ return "", errors.Wrap(err, "Failed to get current user")
+ }
+
+ return usr.HomeDir, nil
}
// InitDB initializes the database.
@@ -287,9 +268,7 @@ func InitSystem(ctx context.DnoteCtx) error {
return errors.Wrapf(err, "initializing system config for %s", consts.SystemLastSyncAt)
}
- if err := tx.Commit(); err != nil {
- return errors.Wrap(err, "committing transaction")
- }
+ tx.Commit()
return nil
}
@@ -325,6 +304,24 @@ func getEditorCommand() string {
return ret
}
+// initDnoteDir initializes dnote directory if it does not exist yet
+func initDnoteDir(ctx context.DnoteCtx) error {
+ path := ctx.DnoteDir
+
+ ok, err := utils.FileExists(path)
+ if err != nil {
+ return errors.Wrap(err, "checking if dnote dir exists")
+ }
+ if ok {
+ return nil
+ }
+
+ if err := os.MkdirAll(path, 0755); err != nil {
+ return errors.Wrap(err, "Failed to create dnote directory")
+ }
+
+ return nil
+}
// initConfigFile populates a new config file if it does not exist yet
func initConfigFile(ctx context.DnoteCtx, apiEndpoint string) error {
@@ -339,16 +336,9 @@ func initConfigFile(ctx context.DnoteCtx, apiEndpoint string) error {
editor := getEditorCommand()
- // Use default API endpoint if none provided
- endpoint := apiEndpoint
- if endpoint == "" {
- endpoint = DefaultAPIEndpoint
- }
-
cf := config.Config{
- Editor: editor,
- APIEndpoint: endpoint,
- EnableUpgradeCheck: true,
+ Editor: editor,
+ APIEndpoint: apiEndpoint,
}
if err := config.Write(ctx, cf); err != nil {
@@ -358,9 +348,9 @@ func initConfigFile(ctx context.DnoteCtx, apiEndpoint string) error {
return nil
}
-// initFiles creates, if necessary, the dnote directory and files inside
-func initFiles(ctx context.DnoteCtx, apiEndpoint string) error {
- if err := context.InitDnoteDirs(ctx.Paths); err != nil {
+// InitFiles creates, if necessary, the dnote directory and files inside
+func InitFiles(ctx context.DnoteCtx, apiEndpoint string) error {
+ if err := initDnoteDir(ctx); err != nil {
return errors.Wrap(err, "creating the dnote dir")
}
if err := initConfigFile(ctx, apiEndpoint); err != nil {
diff --git a/pkg/cli/infra/init_test.go b/pkg/cli/infra/init_test.go
index 8c698624..723ceaf2 100644
--- a/pkg/cli/infra/init_test.go
+++ b/pkg/cli/infra/init_test.go
@@ -1,35 +1,35 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package infra
import (
- "fmt"
- "os"
"testing"
"github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/cli/config"
"github.com/dnote/dnote/pkg/cli/database"
- "github.com/dnote/dnote/pkg/dirs"
"github.com/pkg/errors"
)
func TestInitSystemKV(t *testing.T) {
// Setup
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer database.TeardownTestDB(t, db)
var originalCount int
database.MustScan(t, "counting system configs", db.QueryRow("SELECT count(*) FROM system"), &originalCount)
@@ -60,7 +60,8 @@ func TestInitSystemKV(t *testing.T) {
func TestInitSystemKV_existing(t *testing.T) {
// Setup
- db := database.InitTestMemoryDB(t)
+ db := database.InitTestDB(t, "../tmp/dnote-test.db", nil)
+ defer database.TeardownTestDB(t, db)
database.MustExec(t, "inserting a system config", db, "INSERT INTO system (key, value) VALUES (?, ?)", "testKey", "testVal")
@@ -90,37 +91,3 @@ func TestInitSystemKV_existing(t *testing.T) {
db.QueryRow("SELECT value FROM system WHERE key = ?", "testKey"), &val)
assert.Equal(t, val, "testVal", "system value should not have been updated")
}
-
-func TestInit_APIEndpoint(t *testing.T) {
- // Create a temporary directory for test
- tmpDir, err := os.MkdirTemp("", "dnote-init-test-*")
- if err != nil {
- t.Fatal(errors.Wrap(err, "creating temp dir"))
- }
- defer os.RemoveAll(tmpDir)
-
- // Set up environment to use our temp directory
- t.Setenv("XDG_CONFIG_HOME", fmt.Sprintf("%s/config", tmpDir))
- t.Setenv("XDG_DATA_HOME", fmt.Sprintf("%s/data", tmpDir))
- t.Setenv("XDG_CACHE_HOME", fmt.Sprintf("%s/cache", tmpDir))
-
- // Force dirs package to reload with new environment
- dirs.Reload()
-
- // Initialize - should create config with default apiEndpoint
- ctx, err := Init("test-version", "", "")
- if err != nil {
- t.Fatal(errors.Wrap(err, "initializing"))
- }
- defer ctx.DB.Close()
-
- // Read the config that was created
- cf, err := config.Read(*ctx)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reading config"))
- }
-
- // Context should use the apiEndpoint from config
- assert.Equal(t, ctx.APIEndpoint, DefaultAPIEndpoint, "context should use apiEndpoint from config")
- assert.Equal(t, cf.APIEndpoint, DefaultAPIEndpoint, "context should use apiEndpoint from config")
-}
diff --git a/pkg/cli/log/log.go b/pkg/cli/log/log.go
index 0bc569b6..93a76214 100644
--- a/pkg/cli/log/log.go
+++ b/pkg/cli/log/log.go
@@ -1,30 +1,27 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package log
import (
"fmt"
+ "github.com/dnote/color"
"os"
-
- "github.com/fatih/color"
-)
-
-const (
- debugEnvName = "DNOTE_DEBUG"
- debugEnvValue = "1"
)
var (
@@ -84,7 +81,7 @@ func Error(msg string) {
// Errorf prints an error message with optional format verbs
func Errorf(msg string, v ...interface{}) {
- fmt.Fprintf(color.Output, "%s%s %s", indent, ColorRed.Sprintf("%s", "⨯"), fmt.Sprintf(msg, v...))
+ fmt.Fprintf(color.Output, "%s%s %s", indent, ColorRed.Sprintf("⨯"), fmt.Sprintf(msg, v...))
}
// Printf prints an normal message
@@ -99,29 +96,17 @@ func Askf(msg string, masked bool, v ...interface{}) {
var symbol string
if masked {
- symbol = ColorGray.Sprintf("%s", symbolChar)
+ symbol = ColorGray.Sprintf(symbolChar)
} else {
- symbol = ColorGreen.Sprintf("%s", symbolChar)
+ symbol = ColorGreen.Sprintf(symbolChar)
}
fmt.Fprintf(color.Output, "%s%s %s: ", indent, symbol, fmt.Sprintf(msg, v...))
}
-// isDebug returns true if debug mode is enabled
-func isDebug() bool {
- return os.Getenv(debugEnvName) == debugEnvValue
-}
-
// Debug prints to the console if DNOTE_DEBUG is set
func Debug(msg string, v ...interface{}) {
- if isDebug() {
+ if os.Getenv("DNOTE_DEBUG") == "1" {
fmt.Fprintf(color.Output, "%s %s", ColorGray.Sprint("DEBUG:"), fmt.Sprintf(msg, v...))
}
}
-
-// DebugNewline prints a newline only in debug mode
-func DebugNewline() {
- if isDebug() {
- fmt.Println()
- }
-}
diff --git a/pkg/cli/main.go b/pkg/cli/main.go
index 2fb1c564..452dc76e 100644
--- a/pkg/cli/main.go
+++ b/pkg/cli/main.go
@@ -1,23 +1,25 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package main
import (
"os"
- "strings"
"github.com/dnote/dnote/pkg/cli/infra"
"github.com/dnote/dnote/pkg/cli/log"
@@ -26,10 +28,12 @@ import (
// commands
"github.com/dnote/dnote/pkg/cli/cmd/add"
+ "github.com/dnote/dnote/pkg/cli/cmd/cat"
"github.com/dnote/dnote/pkg/cli/cmd/edit"
"github.com/dnote/dnote/pkg/cli/cmd/find"
"github.com/dnote/dnote/pkg/cli/cmd/login"
"github.com/dnote/dnote/pkg/cli/cmd/logout"
+ "github.com/dnote/dnote/pkg/cli/cmd/ls"
"github.com/dnote/dnote/pkg/cli/cmd/remove"
"github.com/dnote/dnote/pkg/cli/cmd/root"
"github.com/dnote/dnote/pkg/cli/cmd/sync"
@@ -41,32 +45,8 @@ import (
var apiEndpoint string
var versionTag = "master"
-// parseDBPath extracts --dbPath flag value from command line arguments
-// regardless of where it appears (before or after subcommand).
-// Returns empty string if not found.
-func parseDBPath(args []string) string {
- for i, arg := range args {
- // Handle --dbPath=value
- if strings.HasPrefix(arg, "--dbPath=") {
- return strings.TrimPrefix(arg, "--dbPath=")
- }
- // Handle --dbPath value
- if arg == "--dbPath" && i+1 < len(args) {
- return args[i+1]
- }
- }
- return ""
-}
-
func main() {
- // Parse flags early to get --dbPath before initializing database
- // We need to manually parse --dbPath because it can appear after the subcommand
- // (e.g., "dnote sync --full --dbPath=./custom.db") and root.ParseFlags only
- // parses flags before the subcommand.
- dbPath := parseDBPath(os.Args[1:])
-
- // Initialize context - defaultAPIEndpoint is used when creating new config file
- ctx, err := infra.Init(versionTag, apiEndpoint, dbPath)
+ ctx, err := infra.Init(apiEndpoint, versionTag)
if err != nil {
panic(errors.Wrap(err, "initializing context"))
}
@@ -77,8 +57,10 @@ func main() {
root.Register(login.NewCmd(*ctx))
root.Register(logout.NewCmd(*ctx))
root.Register(add.NewCmd(*ctx))
+ root.Register(ls.NewCmd(*ctx))
root.Register(sync.NewCmd(*ctx))
root.Register(version.NewCmd(*ctx))
+ root.Register(cat.NewCmd(*ctx))
root.Register(view.NewCmd(*ctx))
root.Register(find.NewCmd(*ctx))
diff --git a/pkg/cli/main_test.go b/pkg/cli/main_test.go
index 727a5c3e..ecf819af 100644
--- a/pkg/cli/main_test.go
+++ b/pkg/cli/main_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package main
@@ -20,7 +23,6 @@ import (
"log"
"os"
"os/exec"
- "strings"
"testing"
"github.com/dnote/dnote/pkg/assert"
@@ -33,17 +35,9 @@ import (
var binaryName = "test-dnote"
-// setupTestEnv creates a unique test directory for parallel test execution
-func setupTestEnv(t *testing.T) (string, testutils.RunDnoteCmdOptions) {
- testDir := t.TempDir()
- opts := testutils.RunDnoteCmdOptions{
- Env: []string{
- fmt.Sprintf("XDG_CONFIG_HOME=%s", testDir),
- fmt.Sprintf("XDG_DATA_HOME=%s", testDir),
- fmt.Sprintf("XDG_CACHE_HOME=%s", testDir),
- },
- }
- return testDir, opts
+var opts = testutils.RunDnoteCmdOptions{
+ HomeDir: "./tmp",
+ DnoteDir: "./tmp/.dnote",
}
func TestMain(m *testing.M) {
@@ -56,16 +50,15 @@ func TestMain(m *testing.M) {
}
func TestInit(t *testing.T) {
- testDir, opts := setupTestEnv(t)
-
// Execute
// run an arbitrary command "view" due to https://github.com/spf13/cobra/issues/1056
testutils.RunDnoteCmd(t, opts, binaryName, "view")
+ defer testutils.RemoveDir(t, opts.HomeDir)
- db := database.OpenTestDB(t, testDir)
+ db := database.OpenTestDB(t, opts.DnoteDir)
// Test
- ok, err := utils.FileExists(testDir)
+ ok, err := utils.FileExists(opts.DnoteDir)
if err != nil {
t.Fatal(errors.Wrap(err, "checking if dnote dir exists"))
}
@@ -73,7 +66,7 @@ func TestInit(t *testing.T) {
t.Errorf("dnote directory was not initialized")
}
- ok, err = utils.FileExists(fmt.Sprintf("%s/%s/%s", testDir, consts.DnoteDirName, consts.ConfigFilename))
+ ok, err = utils.FileExists(fmt.Sprintf("%s/%s", opts.DnoteDir, consts.ConfigFilename))
if err != nil {
t.Fatal(errors.Wrap(err, "checking if dnote config exists"))
}
@@ -109,13 +102,11 @@ func TestInit(t *testing.T) {
func TestAddNote(t *testing.T) {
t.Run("new book", func(t *testing.T) {
- testDir, opts := setupTestEnv(t)
-
// Set up and execute
testutils.RunDnoteCmd(t, opts, binaryName, "add", "js", "-c", "foo")
- testutils.MustWaitDnoteCmd(t, opts, testutils.UserContent, binaryName, "add", "js")
+ defer testutils.RemoveDir(t, opts.HomeDir)
- db := database.OpenTestDB(t, testDir)
+ db := database.OpenTestDB(t, opts.DnoteDir)
// Test
var noteCount, bookCount int
@@ -123,7 +114,7 @@ func TestAddNote(t *testing.T) {
database.MustScan(t, "counting notes", db.QueryRow("SELECT count(*) FROM notes"), ¬eCount)
assert.Equalf(t, bookCount, 1, "book count mismatch")
- assert.Equalf(t, noteCount, 2, "note count mismatch")
+ assert.Equalf(t, noteCount, 1, "note count mismatch")
var book database.Book
database.MustScan(t, "getting book", db.QueryRow("SELECT uuid, dirty FROM books where label = ?", "js"), &book.UUID, &book.Dirty)
@@ -140,14 +131,13 @@ func TestAddNote(t *testing.T) {
})
t.Run("existing book", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
// Setup
- db, dbPath := database.InitTestFileDB(t)
+ db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil)
testutils.Setup3(t, db)
// Execute
- testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "add", "js", "-c", "foo")
+ testutils.RunDnoteCmd(t, opts, binaryName, "add", "js", "-c", "foo")
+ defer testutils.RemoveDir(t, opts.HomeDir)
// Test
@@ -182,14 +172,13 @@ func TestAddNote(t *testing.T) {
func TestEditNote(t *testing.T) {
t.Run("content flag", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
// Setup
- db, dbPath := database.InitTestFileDB(t)
+ db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil)
testutils.Setup4(t, db)
// Execute
- testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "edit", "2", "-c", "foo bar")
+ testutils.RunDnoteCmd(t, opts, binaryName, "edit", "2", "-c", "foo bar")
+ defer testutils.RemoveDir(t, opts.HomeDir)
// Test
var noteCount, bookCount int
@@ -216,14 +205,13 @@ func TestEditNote(t *testing.T) {
})
t.Run("book flag", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
// Setup
- db, dbPath := database.InitTestFileDB(t)
+ db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil)
testutils.Setup5(t, db)
// Execute
- testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "edit", "2", "-b", "linux")
+ testutils.RunDnoteCmd(t, opts, binaryName, "edit", "2", "-b", "linux")
+ defer testutils.RemoveDir(t, opts.HomeDir)
// Test
var noteCount, bookCount int
@@ -251,14 +239,13 @@ func TestEditNote(t *testing.T) {
})
t.Run("book flag and content flag", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
// Setup
- db, dbPath := database.InitTestFileDB(t)
+ db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil)
testutils.Setup5(t, db)
// Execute
- testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "edit", "2", "-b", "linux", "-c", "n2 body updated")
+ testutils.RunDnoteCmd(t, opts, binaryName, "edit", "2", "-b", "linux", "-c", "n2 body updated")
+ defer testutils.RemoveDir(t, opts.HomeDir)
// Test
var noteCount, bookCount int
@@ -288,14 +275,13 @@ func TestEditNote(t *testing.T) {
func TestEditBook(t *testing.T) {
t.Run("name flag", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
// Setup
- db, dbPath := database.InitTestFileDB(t)
+ db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil)
testutils.Setup1(t, db)
// Execute
- testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "edit", "js", "-n", "js-edited")
+ testutils.RunDnoteCmd(t, opts, binaryName, "edit", "js", "-n", "js-edited")
+ defer testutils.RemoveDir(t, opts.HomeDir)
// Test
var noteCount, bookCount int
@@ -348,18 +334,17 @@ func TestRemoveNote(t *testing.T) {
for _, tc := range testCases {
t.Run(fmt.Sprintf("--yes=%t", tc.yesFlag), func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
// Setup
- db, dbPath := database.InitTestFileDB(t)
+ db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil)
testutils.Setup2(t, db)
// Execute
if tc.yesFlag {
- testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "remove", "-y", "1")
+ testutils.RunDnoteCmd(t, opts, binaryName, "remove", "-y", "1")
} else {
- testutils.MustWaitDnoteCmd(t, opts, testutils.ConfirmRemoveNote, binaryName, "--dbPath", dbPath, "remove", "1")
+ testutils.WaitDnoteCmd(t, opts, testutils.UserConfirm, binaryName, "remove", "1")
}
+ defer testutils.RemoveDir(t, opts.HomeDir)
// Test
var noteCount, bookCount, jsNoteCount, linuxNoteCount int
@@ -436,19 +421,19 @@ func TestRemoveBook(t *testing.T) {
for _, tc := range testCases {
t.Run(fmt.Sprintf("--yes=%t", tc.yesFlag), func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
// Setup
- db, dbPath := database.InitTestFileDB(t)
+ db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil)
testutils.Setup2(t, db)
// Execute
if tc.yesFlag {
- testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "remove", "-y", "js")
+ testutils.RunDnoteCmd(t, opts, binaryName, "remove", "-y", "js")
} else {
- testutils.MustWaitDnoteCmd(t, opts, testutils.ConfirmRemoveBook, binaryName, "--dbPath", dbPath, "remove", "js")
+ testutils.WaitDnoteCmd(t, opts, testutils.UserConfirm, binaryName, "remove", "js")
}
+ defer testutils.RemoveDir(t, opts.HomeDir)
+
// Test
var noteCount, bookCount, jsNoteCount, linuxNoteCount int
database.MustScan(t, "counting books", db.QueryRow("SELECT count(*) FROM books"), &bookCount)
@@ -509,125 +494,3 @@ func TestRemoveBook(t *testing.T) {
})
}
}
-
-func TestDBPathFlag(t *testing.T) {
- // Helper function to verify database contents
- verifyDatabase := func(t *testing.T, dbPath, expectedBook, expectedNote string) *database.DB {
- ok, err := utils.FileExists(dbPath)
- if err != nil {
- t.Fatal(errors.Wrapf(err, "checking if custom db exists at %s", dbPath))
- }
- if !ok {
- t.Errorf("custom database was not created at %s", dbPath)
- }
-
- db, err := database.Open(dbPath)
- if err != nil {
- t.Fatal(errors.Wrapf(err, "opening db at %s", dbPath))
- }
-
- var noteCount, bookCount int
- database.MustScan(t, "counting books", db.QueryRow("SELECT count(*) FROM books"), &bookCount)
- database.MustScan(t, "counting notes", db.QueryRow("SELECT count(*) FROM notes"), ¬eCount)
-
- assert.Equalf(t, bookCount, 1, fmt.Sprintf("%s book count mismatch", dbPath))
- assert.Equalf(t, noteCount, 1, fmt.Sprintf("%s note count mismatch", dbPath))
-
- var book database.Book
- database.MustScan(t, "getting book", db.QueryRow("SELECT label FROM books"), &book.Label)
- assert.Equalf(t, book.Label, expectedBook, fmt.Sprintf("%s book label mismatch", dbPath))
-
- var note database.Note
- database.MustScan(t, "getting note", db.QueryRow("SELECT body FROM notes"), ¬e.Body)
- assert.Equalf(t, note.Body, expectedNote, fmt.Sprintf("%s note body mismatch", dbPath))
-
- return db
- }
-
- // Setup - use two different custom database paths
- testDir, customOpts := setupTestEnv(t)
- customDBPath1 := fmt.Sprintf("%s/custom-test1.db", testDir)
- customDBPath2 := fmt.Sprintf("%s/custom-test2.db", testDir)
-
- // Execute - add different notes to each database
- testutils.RunDnoteCmd(t, customOpts, binaryName, "--dbPath", customDBPath1, "add", "db1-book", "-c", "content in db1")
- testutils.RunDnoteCmd(t, customOpts, binaryName, "--dbPath", customDBPath2, "add", "db2-book", "-c", "content in db2")
-
- // Test both databases
- db1 := verifyDatabase(t, customDBPath1, "db1-book", "content in db1")
- defer db1.Close()
-
- db2 := verifyDatabase(t, customDBPath2, "db2-book", "content in db2")
- defer db2.Close()
-
- // Verify that the databases are independent
- var db1HasDB2Book int
- db1.QueryRow("SELECT count(*) FROM books WHERE label = ?", "db2-book").Scan(&db1HasDB2Book)
- assert.Equal(t, db1HasDB2Book, 0, "db1 should not have db2's book")
-
- var db2HasDB1Book int
- db2.QueryRow("SELECT count(*) FROM books WHERE label = ?", "db1-book").Scan(&db2HasDB1Book)
- assert.Equal(t, db2HasDB1Book, 0, "db2 should not have db1's book")
-}
-
-func TestView(t *testing.T) {
- t.Run("view note by rowid", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
- db, dbPath := database.InitTestFileDB(t)
- testutils.Setup4(t, db)
-
- output := testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "view", "1")
-
- assert.Equal(t, strings.Contains(output, "Booleans have toString()"), true, "should contain note content")
- assert.Equal(t, strings.Contains(output, "book name"), true, "should show metadata")
- })
-
- t.Run("view note content only", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
- db, dbPath := database.InitTestFileDB(t)
- testutils.Setup4(t, db)
-
- output := testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "view", "1", "--content-only")
-
- assert.Equal(t, strings.Contains(output, "Booleans have toString()"), true, "should contain note content")
- assert.Equal(t, strings.Contains(output, "book name"), false, "should not show metadata")
- })
-
- t.Run("list books", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
- db, dbPath := database.InitTestFileDB(t)
- testutils.Setup1(t, db)
-
- output := testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "view")
-
- assert.Equal(t, strings.Contains(output, "js"), true, "should list js book")
- assert.Equal(t, strings.Contains(output, "linux"), true, "should list linux book")
- })
-
- t.Run("list notes in book", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
- db, dbPath := database.InitTestFileDB(t)
- testutils.Setup2(t, db)
-
- output := testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "view", "js")
-
- assert.Equal(t, strings.Contains(output, "n1 body"), true, "should list note 1")
- assert.Equal(t, strings.Contains(output, "n2 body"), true, "should list note 2")
- })
-
- t.Run("view note by book name and rowid", func(t *testing.T) {
- _, opts := setupTestEnv(t)
-
- db, dbPath := database.InitTestFileDB(t)
- testutils.Setup4(t, db)
-
- output := testutils.RunDnoteCmd(t, opts, binaryName, "--dbPath", dbPath, "view", "js", "2")
-
- assert.Equal(t, strings.Contains(output, "Date object implements mathematical comparisons"), true, "should contain note content")
- assert.Equal(t, strings.Contains(output, "book name"), true, "should show metadata")
- })
-}
diff --git a/pkg/cli/migrate/fixtures/local-12-pre-schema.sql b/pkg/cli/migrate/fixtures/local-12-pre-schema.sql
index 5560af3d..c501a460 100644
--- a/pkg/cli/migrate/fixtures/local-12-pre-schema.sql
+++ b/pkg/cli/migrate/fixtures/local-12-pre-schema.sql
@@ -38,5 +38,13 @@ CREATE TRIGGER notes_after_update AFTER UPDATE ON notes BEGIN
INSERT INTO note_fts(note_fts, rowid, body) VALUES ('delete', old.rowid, old.body);
INSERT INTO note_fts(rowid, body) VALUES (new.rowid, new.body);
END;
+CREATE TABLE actions
+ (
+ uuid text PRIMARY KEY,
+ schema integer NOT NULL,
+ type text NOT NULL,
+ data text NOT NULL,
+ timestamp integer NOT NULL
+ );
CREATE UNIQUE INDEX idx_notes_uuid ON notes(uuid);
CREATE INDEX idx_notes_book_uuid ON notes(book_uuid);
diff --git a/pkg/cli/migrate/fixtures/local-14-pre-schema.sql b/pkg/cli/migrate/fixtures/local-14-pre-schema.sql
deleted file mode 100644
index 5560af3d..00000000
--- a/pkg/cli/migrate/fixtures/local-14-pre-schema.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-CREATE TABLE books
- (
- uuid text PRIMARY KEY,
- label text NOT NULL
- , dirty bool DEFAULT false, usn int DEFAULT 0 NOT NULL, deleted bool DEFAULT false);
-CREATE TABLE system
- (
- key string NOT NULL,
- value text NOT NULL
- );
-CREATE UNIQUE INDEX idx_books_label ON books(label);
-CREATE UNIQUE INDEX idx_books_uuid ON books(uuid);
-CREATE TABLE IF NOT EXISTS "notes"
- (
- uuid text NOT NULL,
- book_uuid text NOT NULL,
- body text NOT NULL,
- added_on integer NOT NULL,
- edited_on integer DEFAULT 0,
- public bool DEFAULT false,
- dirty bool DEFAULT false,
- usn int DEFAULT 0 NOT NULL,
- deleted bool DEFAULT false
- );
-CREATE VIRTUAL TABLE note_fts USING fts5(content=notes, body, tokenize="porter unicode61 categories 'L* N* Co Ps Pe'")
-/* note_fts(body) */;
-CREATE TABLE IF NOT EXISTS 'note_fts_data'(id INTEGER PRIMARY KEY, block BLOB);
-CREATE TABLE IF NOT EXISTS 'note_fts_idx'(segid, term, pgno, PRIMARY KEY(segid, term)) WITHOUT ROWID;
-CREATE TABLE IF NOT EXISTS 'note_fts_docsize'(id INTEGER PRIMARY KEY, sz BLOB);
-CREATE TABLE IF NOT EXISTS 'note_fts_config'(k PRIMARY KEY, v) WITHOUT ROWID;
-CREATE TRIGGER notes_after_insert AFTER INSERT ON notes BEGIN
- INSERT INTO note_fts(rowid, body) VALUES (new.rowid, new.body);
- END;
-CREATE TRIGGER notes_after_delete AFTER DELETE ON notes BEGIN
- INSERT INTO note_fts(note_fts, rowid, body) VALUES ('delete', old.rowid, old.body);
- END;
-CREATE TRIGGER notes_after_update AFTER UPDATE ON notes BEGIN
- INSERT INTO note_fts(note_fts, rowid, body) VALUES ('delete', old.rowid, old.body);
- INSERT INTO note_fts(rowid, body) VALUES (new.rowid, new.body);
- END;
-CREATE UNIQUE INDEX idx_notes_uuid ON notes(uuid);
-CREATE INDEX idx_notes_book_uuid ON notes(book_uuid);
diff --git a/pkg/cli/migrate/legacy.go b/pkg/cli/migrate/legacy.go
index 4399f7fb..3d771ac9 100644
--- a/pkg/cli/migrate/legacy.go
+++ b/pkg/cli/migrate/legacy.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package migrate provides migration logic for both sqlite and
@@ -20,6 +23,7 @@ package migrate
import (
"encoding/json"
"fmt"
+ "io/ioutil"
"os"
"time"
@@ -173,8 +177,8 @@ func performMigration(ctx context.DnoteCtx, migrationID int) error {
// backupDnoteDir backs up the dnote directory to a temporary backup directory
func backupDnoteDir(ctx context.DnoteCtx) error {
- srcPath := fmt.Sprintf("%s/.dnote", ctx.Paths.Home)
- tmpPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, backupDirName)
+ srcPath := fmt.Sprintf("%s/.dnote", ctx.HomeDir)
+ tmpPath := fmt.Sprintf("%s/%s", ctx.HomeDir, backupDirName)
if err := utils.CopyDir(srcPath, tmpPath); err != nil {
return errors.Wrap(err, "Failed to copy the .dnote directory")
@@ -194,8 +198,8 @@ func restoreBackup(ctx context.DnoteCtx) error {
}
}()
- srcPath := fmt.Sprintf("%s/.dnote", ctx.Paths.Home)
- backupPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, backupDirName)
+ srcPath := fmt.Sprintf("%s/.dnote", ctx.HomeDir)
+ backupPath := fmt.Sprintf("%s/%s", ctx.HomeDir, backupDirName)
if err = os.RemoveAll(srcPath); err != nil {
return errors.Wrapf(err, "Failed to clear current dnote data at %s", backupPath)
@@ -209,7 +213,7 @@ func restoreBackup(ctx context.DnoteCtx) error {
}
func clearBackup(ctx context.DnoteCtx) error {
- backupPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, backupDirName)
+ backupPath := fmt.Sprintf("%s/%s", ctx.HomeDir, backupDirName)
if err := os.RemoveAll(backupPath); err != nil {
return errors.Wrapf(err, "Failed to remove backup at %s", backupPath)
@@ -220,7 +224,7 @@ func clearBackup(ctx context.DnoteCtx) error {
// getSchemaPath returns the path to the file containing schema info
func getSchemaPath(ctx context.DnoteCtx) string {
- return fmt.Sprintf("%s/%s", ctx.Paths.LegacyDnote, schemaFilename)
+ return fmt.Sprintf("%s/%s", ctx.DnoteDir, schemaFilename)
}
func readSchema(ctx context.DnoteCtx) (schema, error) {
@@ -228,7 +232,7 @@ func readSchema(ctx context.DnoteCtx) (schema, error) {
path := getSchemaPath(ctx)
- b, err := os.ReadFile(path)
+ b, err := ioutil.ReadFile(path)
if err != nil {
return ret, errors.Wrap(err, "Failed to read schema file")
}
@@ -248,7 +252,7 @@ func writeSchema(ctx context.DnoteCtx, s schema) error {
return errors.Wrap(err, "Failed to marshal schema into yaml")
}
- if err := os.WriteFile(path, d, 0644); err != nil {
+ if err := ioutil.WriteFile(path, d, 0644); err != nil {
return errors.Wrap(err, "Failed to write schema file")
}
@@ -481,7 +485,7 @@ var migrateToV8SystemKeyBookMark = "bookmark"
// migrateToV1 deletes YAML archive if exists
func migrateToV1(ctx context.DnoteCtx) error {
- yamlPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, ".dnote-yaml-archived")
+ yamlPath := fmt.Sprintf("%s/%s", ctx.HomeDir, ".dnote-yaml-archived")
ok, err := utils.FileExists(yamlPath)
if err != nil {
return errors.Wrap(err, "checking if yaml file exists")
@@ -498,9 +502,9 @@ func migrateToV1(ctx context.DnoteCtx) error {
}
func migrateToV2(ctx context.DnoteCtx) error {
- notePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote)
+ notePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir)
- b, err := os.ReadFile(notePath)
+ b, err := ioutil.ReadFile(notePath)
if err != nil {
return errors.Wrap(err, "Failed to read the note file")
}
@@ -544,7 +548,7 @@ func migrateToV2(ctx context.DnoteCtx) error {
return errors.Wrap(err, "Failed to marshal new dnote into JSON")
}
- err = os.WriteFile(notePath, d, 0644)
+ err = ioutil.WriteFile(notePath, d, 0644)
if err != nil {
return errors.Wrap(err, "Failed to write the new dnote into the file")
}
@@ -554,10 +558,10 @@ func migrateToV2(ctx context.DnoteCtx) error {
// migrateToV3 generates actions for existing dnote
func migrateToV3(ctx context.DnoteCtx) error {
- notePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote)
- actionsPath := fmt.Sprintf("%s/actions", ctx.Paths.LegacyDnote)
+ notePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir)
+ actionsPath := fmt.Sprintf("%s/actions", ctx.DnoteDir)
- b, err := os.ReadFile(notePath)
+ b, err := ioutil.ReadFile(notePath)
if err != nil {
return errors.Wrap(err, "Failed to read the note file")
}
@@ -611,7 +615,7 @@ func migrateToV3(ctx context.DnoteCtx) error {
return errors.Wrap(err, "Failed to marshal actions into JSON")
}
- err = os.WriteFile(actionsPath, a, 0644)
+ err = ioutil.WriteFile(actionsPath, a, 0644)
if err != nil {
return errors.Wrap(err, "Failed to write the actions into a file")
}
@@ -641,9 +645,9 @@ func getEditorCommand() string {
}
func migrateToV4(ctx context.DnoteCtx) error {
- configPath := fmt.Sprintf("%s/dnoterc", ctx.Paths.LegacyDnote)
+ configPath := fmt.Sprintf("%s/dnoterc", ctx.DnoteDir)
- b, err := os.ReadFile(configPath)
+ b, err := ioutil.ReadFile(configPath)
if err != nil {
return errors.Wrap(err, "Failed to read the config file")
}
@@ -664,7 +668,7 @@ func migrateToV4(ctx context.DnoteCtx) error {
return errors.Wrap(err, "Failed to marshal config into JSON")
}
- err = os.WriteFile(configPath, data, 0644)
+ err = ioutil.WriteFile(configPath, data, 0644)
if err != nil {
return errors.Wrap(err, "Failed to write the config into a file")
}
@@ -674,9 +678,9 @@ func migrateToV4(ctx context.DnoteCtx) error {
// migrateToV5 migrates actions
func migrateToV5(ctx context.DnoteCtx) error {
- actionsPath := fmt.Sprintf("%s/actions", ctx.Paths.LegacyDnote)
+ actionsPath := fmt.Sprintf("%s/actions", ctx.DnoteDir)
- b, err := os.ReadFile(actionsPath)
+ b, err := ioutil.ReadFile(actionsPath)
if err != nil {
return errors.Wrap(err, "reading the actions file")
}
@@ -734,7 +738,7 @@ func migrateToV5(ctx context.DnoteCtx) error {
if err != nil {
return errors.Wrap(err, "marshalling result into JSON")
}
- err = os.WriteFile(actionsPath, a, 0644)
+ err = ioutil.WriteFile(actionsPath, a, 0644)
if err != nil {
return errors.Wrap(err, "writing the result into a file")
}
@@ -744,9 +748,9 @@ func migrateToV5(ctx context.DnoteCtx) error {
// migrateToV6 adds a 'public' field to notes
func migrateToV6(ctx context.DnoteCtx) error {
- notePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote)
+ notePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir)
- b, err := os.ReadFile(notePath)
+ b, err := ioutil.ReadFile(notePath)
if err != nil {
return errors.Wrap(err, "Failed to read the note file")
}
@@ -787,7 +791,7 @@ func migrateToV6(ctx context.DnoteCtx) error {
return errors.Wrap(err, "Failed to marshal new dnote into JSON")
}
- err = os.WriteFile(notePath, d, 0644)
+ err = ioutil.WriteFile(notePath, d, 0644)
if err != nil {
return errors.Wrap(err, "Failed to write the new dnote into the file")
}
@@ -799,9 +803,9 @@ func migrateToV6(ctx context.DnoteCtx) error {
// EditNoteDataV2. Due to a bug, edit logged actions with schema version '2'
// but with a data of EditNoteDataV1. https://github.com/dnote/dnote/pkg/cli/issues/107
func migrateToV7(ctx context.DnoteCtx) error {
- actionPath := fmt.Sprintf("%s/actions", ctx.Paths.LegacyDnote)
+ actionPath := fmt.Sprintf("%s/actions", ctx.DnoteDir)
- b, err := os.ReadFile(actionPath)
+ b, err := ioutil.ReadFile(actionPath)
if err != nil {
return errors.Wrap(err, "reading actions file")
}
@@ -853,7 +857,7 @@ func migrateToV7(ctx context.DnoteCtx) error {
return errors.Wrap(err, "marshalling new actions")
}
- err = os.WriteFile(actionPath, d, 0644)
+ err = ioutil.WriteFile(actionPath, d, 0644)
if err != nil {
return errors.Wrap(err, "writing new actions to a file")
}
@@ -869,8 +873,8 @@ func migrateToV8(ctx context.DnoteCtx) error {
}
// 1. Migrate the the dnote file
- dnoteFilePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote)
- b, err := os.ReadFile(dnoteFilePath)
+ dnoteFilePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir)
+ b, err := ioutil.ReadFile(dnoteFilePath)
if err != nil {
return errors.Wrap(err, "reading the notes")
}
@@ -909,8 +913,8 @@ func migrateToV8(ctx context.DnoteCtx) error {
}
// 2. Migrate the actions file
- actionsPath := fmt.Sprintf("%s/actions", ctx.Paths.LegacyDnote)
- b, err = os.ReadFile(actionsPath)
+ actionsPath := fmt.Sprintf("%s/actions", ctx.DnoteDir)
+ b, err = ioutil.ReadFile(actionsPath)
if err != nil {
return errors.Wrap(err, "reading the actions")
}
@@ -934,8 +938,8 @@ func migrateToV8(ctx context.DnoteCtx) error {
}
// 3. Migrate the timestamps file
- timestampsPath := fmt.Sprintf("%s/timestamps", ctx.Paths.LegacyDnote)
- b, err = os.ReadFile(timestampsPath)
+ timestampsPath := fmt.Sprintf("%s/timestamps", ctx.DnoteDir)
+ b, err = ioutil.ReadFile(timestampsPath)
if err != nil {
return errors.Wrap(err, "reading the timestamps")
}
@@ -976,7 +980,7 @@ func migrateToV8(ctx context.DnoteCtx) error {
if err := os.RemoveAll(timestampsPath); err != nil {
return errors.Wrap(err, "removing the timestamps file")
}
- schemaPath := fmt.Sprintf("%s/schema", ctx.Paths.LegacyDnote)
+ schemaPath := fmt.Sprintf("%s/schema", ctx.DnoteDir)
if err := os.RemoveAll(schemaPath); err != nil {
return errors.Wrap(err, "removing the schema file")
}
diff --git a/pkg/cli/migrate/legacy_test.go b/pkg/cli/migrate/legacy_test.go
index 73d8b063..7fe81126 100644
--- a/pkg/cli/migrate/legacy_test.go
+++ b/pkg/cli/migrate/legacy_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package migrate
@@ -18,6 +21,7 @@ package migrate
import (
"encoding/json"
"fmt"
+ "io/ioutil"
"os"
"path/filepath"
"testing"
@@ -38,15 +42,13 @@ func setupEnv(t *testing.T, homeDir string) context.DnoteCtx {
}
return context.DnoteCtx{
- Paths: context.Paths{
- Home: homeDir,
- LegacyDnote: dnoteDir,
- },
+ HomeDir: homeDir,
+ DnoteDir: dnoteDir,
}
}
func teardownEnv(t *testing.T, ctx context.DnoteCtx) {
- if err := os.RemoveAll(ctx.Paths.LegacyDnote); err != nil {
+ if err := os.RemoveAll(ctx.DnoteDir); err != nil {
t.Fatal(errors.Wrap(err, "tearing down the dnote dir"))
}
}
@@ -57,11 +59,11 @@ func TestMigrateToV1(t *testing.T) {
ctx := setupEnv(t, "../tmp")
defer teardownEnv(t, ctx)
- yamlPath, err := filepath.Abs(filepath.Join(ctx.Paths.Home, ".dnote-yaml-archived"))
+ yamlPath, err := filepath.Abs(filepath.Join(ctx.HomeDir, ".dnote-yaml-archived"))
if err != nil {
panic(errors.Wrap(err, "Failed to get absolute YAML path").Error())
}
- os.WriteFile(yamlPath, []byte{}, 0644)
+ ioutil.WriteFile(yamlPath, []byte{}, 0644)
// execute
if err := migrateToV1(ctx); err != nil {
@@ -83,7 +85,7 @@ func TestMigrateToV1(t *testing.T) {
ctx := setupEnv(t, "../tmp")
defer teardownEnv(t, ctx)
- yamlPath, err := filepath.Abs(filepath.Join(ctx.Paths.Home, ".dnote-yaml-archived"))
+ yamlPath, err := filepath.Abs(filepath.Join(ctx.HomeDir, ".dnote-yaml-archived"))
if err != nil {
panic(errors.Wrap(err, "Failed to get absolute YAML path").Error())
}
@@ -350,21 +352,11 @@ func TestMigrateToV7(t *testing.T) {
}
func TestMigrateToV8(t *testing.T) {
- tmpDir := t.TempDir()
- dnoteDir := tmpDir + "/.dnote"
- if err := os.MkdirAll(dnoteDir, 0755); err != nil {
- t.Fatal(errors.Wrap(err, "creating legacy dnote directory"))
- }
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-1-pre-schema.sql", SkipMigration: true}
+ db := database.InitTestDB(t, "../tmp/.dnote/dnote-test.db", &opts)
+ defer database.TeardownTestDB(t, db)
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-1-pre-schema.sql")
-
- ctx := context.DnoteCtx{
- Paths: context.Paths{
- Home: tmpDir,
- LegacyDnote: dnoteDir,
- },
- DB: db,
- }
+ ctx := context.DnoteCtx{HomeDir: "../tmp", DnoteDir: "../tmp/.dnote", DB: db}
// set up
testutils.CopyFixture(t, ctx, "./fixtures/legacy-8-actions.json", "actions")
@@ -381,10 +373,10 @@ func TestMigrateToV8(t *testing.T) {
// test
// 1. test if files are migrated
- dnoteFilePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote)
- dnotercPath := fmt.Sprintf("%s/dnoterc", ctx.Paths.LegacyDnote)
- schemaFilePath := fmt.Sprintf("%s/schema", ctx.Paths.LegacyDnote)
- timestampFilePath := fmt.Sprintf("%s/timestamps", ctx.Paths.LegacyDnote)
+ dnoteFilePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir)
+ dnotercPath := fmt.Sprintf("%s/dnoterc", ctx.DnoteDir)
+ schemaFilePath := fmt.Sprintf("%s/schema", ctx.DnoteDir)
+ timestampFilePath := fmt.Sprintf("%s/timestamps", ctx.DnoteDir)
ok, err := utils.FileExists(dnoteFilePath)
if err != nil {
diff --git a/pkg/cli/migrate/migrate.go b/pkg/cli/migrate/migrate.go
index 9b4b0f50..431360a4 100644
--- a/pkg/cli/migrate/migrate.go
+++ b/pkg/cli/migrate/migrate.go
@@ -1,23 +1,25 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package migrate
import (
"database/sql"
-
"github.com/dnote/dnote/pkg/cli/consts"
"github.com/dnote/dnote/pkg/cli/context"
"github.com/dnote/dnote/pkg/cli/log"
@@ -45,8 +47,6 @@ var LocalSequence = []migration{
lm10,
lm11,
lm12,
- lm13,
- lm14,
}
// RemoteSequence is a list of remote migrations to be run
@@ -141,7 +141,7 @@ func Run(ctx context.DnoteCtx, migrations []migration, mode int) error {
return errors.Wrap(err, "getting the current schema")
}
- log.Debug("%s: %d of %d\n", schemaKey, schema, len(migrations))
+ log.Debug("current schema: %s %d of %d\n", consts.SystemSchema, schema, len(migrations))
toRun := migrations[schema:]
diff --git a/pkg/cli/migrate/migrate_test.go b/pkg/cli/migrate/migrate_test.go
index 7b31a91e..2a94b9d6 100644
--- a/pkg/cli/migrate/migrate_test.go
+++ b/pkg/cli/migrate/migrate_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package migrate
@@ -18,14 +21,13 @@ package migrate
import (
"encoding/json"
"fmt"
+ "gopkg.in/yaml.v2"
+ "io/ioutil"
"net/http"
"net/http/httptest"
- "os"
"testing"
"time"
- "gopkg.in/yaml.v2"
-
"github.com/dnote/actions"
"github.com/dnote/dnote/pkg/assert"
"github.com/dnote/dnote/pkg/cli/consts"
@@ -35,15 +37,6 @@ import (
"github.com/pkg/errors"
)
-// initTestDBNoMigration initializes a test database with schema.sql but removes
-// migration version data so tests can control the migration state themselves.
-func initTestDBNoMigration(t *testing.T) *database.DB {
- db := database.InitTestMemoryDBRaw(t, "")
- // Remove migration versions from schema.sql so tests can set their own
- database.MustExec(t, "clearing schema versions", db, "DELETE FROM system WHERE key IN (?, ?)", consts.SystemSchema, consts.SystemRemoteSchema)
- return db
-}
-
func TestExecute_bump_schema(t *testing.T) {
testCases := []struct {
schemaKey string
@@ -59,8 +52,11 @@ func TestExecute_bump_schema(t *testing.T) {
for _, tc := range testCases {
func() {
// set up
- db := initTestDBNoMigration(t)
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
database.MustExec(t, "inserting a schema", db, "INSERT INTO system (key, value) VALUES (?, ?)", tc.schemaKey, 8)
@@ -113,8 +109,11 @@ func TestRun_nonfresh(t *testing.T) {
for _, tc := range testCases {
func() {
// set up
- db := initTestDBNoMigration(t)
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
database.MustExec(t, "inserting a schema", db, "INSERT INTO system (key, value) VALUES (?, ?)", tc.schemaKey, 2)
database.MustExec(t, "creating a temporary table for testing", db,
"CREATE TABLE migrate_run_test ( name string )")
@@ -190,8 +189,11 @@ func TestRun_fresh(t *testing.T) {
for _, tc := range testCases {
func() {
// set up
- db := initTestDBNoMigration(t)
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
database.MustExec(t, "creating a temporary table for testing", db,
"CREATE TABLE migrate_run_test ( name string )")
@@ -261,8 +263,11 @@ func TestRun_up_to_date(t *testing.T) {
for _, tc := range testCases {
func() {
// set up
- db := initTestDBNoMigration(t)
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
database.MustExec(t, "creating a temporary table for testing", db,
"CREATE TABLE migrate_run_test ( name string )")
@@ -313,8 +318,11 @@ func TestRun_up_to_date(t *testing.T) {
func TestLocalMigration1(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-1-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-1-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
data := testutils.MustMarshalJSON(t, actions.AddBookDataV1{BookName: "js"})
a1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting action", db,
@@ -388,8 +396,11 @@ func TestLocalMigration1(t *testing.T) {
func TestLocalMigration2(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-1-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-1-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
c1 := "note 1 - v1"
c2 := "note 1 - v2"
css := "css"
@@ -472,8 +483,11 @@ func TestLocalMigration2(t *testing.T) {
func TestLocalMigration3(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-1-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-1-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
data := testutils.MustMarshalJSON(t, actions.AddNoteDataV2{NoteUUID: "note-1-uuid", BookName: "js", Content: "note 1", Public: false})
a1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting action", db,
@@ -544,8 +558,11 @@ func TestLocalMigration3(t *testing.T) {
func TestLocalMigration4(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-1-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-1-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting css book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "css")
@@ -585,8 +602,11 @@ func TestLocalMigration4(t *testing.T) {
func TestLocalMigration5(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-5-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-5-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting css book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "css")
@@ -644,8 +664,11 @@ func TestLocalMigration5(t *testing.T) {
func TestLocalMigration6(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-5-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-5-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
data := testutils.MustMarshalJSON(t, actions.AddBookDataV1{BookName: "js"})
a1UUID := testutils.MustGenerateUUID(t)
@@ -674,8 +697,11 @@ func TestLocalMigration6(t *testing.T) {
func TestLocalMigration7_trash(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-7-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-7-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting trash book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "trash")
@@ -704,8 +730,11 @@ func TestLocalMigration7_trash(t *testing.T) {
func TestLocalMigration7_conflicts(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-7-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-7-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "conflicts")
@@ -734,8 +763,11 @@ func TestLocalMigration7_conflicts(t *testing.T) {
func TestLocalMigration7_conflicts_dup(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-7-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-7-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "conflicts")
@@ -769,8 +801,11 @@ func TestLocalMigration7_conflicts_dup(t *testing.T) {
func TestLocalMigration8(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-8-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-8-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book 1", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1")
@@ -803,13 +838,13 @@ func TestLocalMigration8(t *testing.T) {
var n1AddedOn, n1EditedOn int64
var n1USN int
var n1Public, n1Dirty, n1Deleted bool
- database.MustScan(t, "scanning n1", db.QueryRow("SELECT book_uuid, body, added_on, edited_on, usn, public, dirty, deleted FROM notes WHERE uuid = ?", n1UUID), &n1BookUUID, &n1Body, &n1AddedOn, &n1EditedOn, &n1USN, &n1Public, &n1Dirty, &n1Deleted)
+ database.MustScan(t, "scanning n1", db.QueryRow("SELECT book_uuid, body, added_on, edited_on, usn, public, dirty, deleted FROM notes WHERE uuid = ?", n1UUID), &n1BookUUID, &n1Body, &n1AddedOn, &n1EditedOn, &n1USN, &n1Public, &n1Dirty, &n1Deleted)
var n2BookUUID, n2Body string
var n2AddedOn, n2EditedOn int64
var n2USN int
var n2Public, n2Dirty, n2Deleted bool
- database.MustScan(t, "scanning n2", db.QueryRow("SELECT book_uuid, body, added_on, edited_on, usn, public, dirty, deleted FROM notes WHERE uuid = ?", n2UUID), &n2BookUUID, &n2Body, &n2AddedOn, &n2EditedOn, &n2USN, &n2Public, &n2Dirty, &n2Deleted)
+ database.MustScan(t, "scanning n2", db.QueryRow("SELECT book_uuid, body, added_on, edited_on, usn, public, dirty, deleted FROM notes WHERE uuid = ?", n2UUID), &n2BookUUID, &n2Body, &n2AddedOn, &n2EditedOn, &n2USN, &n2Public, &n2Dirty, &n2Deleted)
assert.Equal(t, n1BookUUID, b1UUID, "n1 BookUUID mismatch")
assert.Equal(t, n1Body, "n1 Body", "n1 Body mismatch")
@@ -832,8 +867,11 @@ func TestLocalMigration8(t *testing.T) {
func TestLocalMigration9(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-9-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-9-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book 1", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1")
@@ -875,8 +913,11 @@ func TestLocalMigration9(t *testing.T) {
func TestLocalMigration10(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-10-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-10-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book ", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "123")
@@ -944,8 +985,11 @@ func TestLocalMigration10(t *testing.T) {
func TestLocalMigration11(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-11-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-11-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
+
+ db := ctx.DB
b1UUID := testutils.MustGenerateUUID(t)
database.MustExec(t, "inserting book 1", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "foo")
@@ -1021,12 +1065,13 @@ func TestLocalMigration11(t *testing.T) {
func TestLocalMigration12(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-12-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-12-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
data := []byte("editor: vim")
- path := fmt.Sprintf("%s/%s/dnoterc", ctx.Paths.Config, consts.DnoteDirName)
- if err := os.WriteFile(path, data, 0644); err != nil {
+ path := fmt.Sprintf("%s/dnoterc", ctx.DnoteDir)
+ if err := ioutil.WriteFile(path, data, 0644); err != nil {
t.Fatal(errors.Wrap(err, "Failed to write schema file"))
}
@@ -1037,7 +1082,7 @@ func TestLocalMigration12(t *testing.T) {
}
// test
- b, err := os.ReadFile(path)
+ b, err := ioutil.ReadFile(path)
if err != nil {
t.Fatal(errors.Wrap(err, "reading config"))
}
@@ -1055,98 +1100,11 @@ func TestLocalMigration12(t *testing.T) {
assert.NotEqual(t, cf.APIEndpoint, "", "apiEndpoint was not populated")
}
-func TestLocalMigration13(t *testing.T) {
- // set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-12-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
-
- data := []byte("editor: vim\napiEndpoint: https://test.com/api")
-
- path := fmt.Sprintf("%s/%s/dnoterc", ctx.Paths.Config, consts.DnoteDirName)
- if err := os.WriteFile(path, data, 0644); err != nil {
- t.Fatal(errors.Wrap(err, "Failed to write schema file"))
- }
-
- // execute
- err := lm13.run(ctx, nil)
- if err != nil {
- t.Fatal(errors.Wrap(err, "failed to run"))
- }
-
- // test
- b, err := os.ReadFile(path)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reading config"))
- }
-
- type config struct {
- Editor string `yaml:"editor"`
- ApiEndpoint string `yaml:"apiEndpoint"`
- EnableUpgradeCheck bool `yaml:"enableUpgradeCheck"`
- }
-
- var cf config
- err = yaml.Unmarshal(b, &cf)
- if err != nil {
- t.Fatal(errors.Wrap(err, "unmarshalling config"))
- }
-
- assert.Equal(t, cf.Editor, "vim", "editor mismatch")
- assert.Equal(t, cf.ApiEndpoint, "https://test.com/api", "apiEndpoint mismatch")
- assert.Equal(t, cf.EnableUpgradeCheck, true, "enableUpgradeCheck mismatch")
-}
-
-func TestLocalMigration14(t *testing.T) {
- // set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/local-14-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
-
- b1UUID := testutils.MustGenerateUUID(t)
- database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "b1")
-
- n1UUID := testutils.MustGenerateUUID(t)
- database.MustExec(t, "inserting note", db, `INSERT INTO notes
- (uuid, book_uuid, body, added_on, edited_on, public, dirty, usn, deleted) VALUES
- (?, ?, ?, ?, ?, ?, ?, ?, ?)`, n1UUID, b1UUID, "test note", 1, 2, true, false, 0, false)
-
- // Execute
- tx, err := db.Begin()
- if err != nil {
- t.Fatal(errors.Wrap(err, "beginning a transaction"))
- }
-
- err = lm14.run(ctx, tx)
- if err != nil {
- tx.Rollback()
- t.Fatal(errors.Wrap(err, "failed to run"))
- }
-
- tx.Commit()
-
- // Test - verify public column was dropped by checking column names
- rows, err := db.Query("SELECT name FROM pragma_table_info('notes')")
- if err != nil {
- t.Fatal(errors.Wrap(err, "getting table info"))
- }
- defer rows.Close()
-
- for rows.Next() {
- var name string
- err := rows.Scan(&name)
- if err != nil {
- t.Fatal(errors.Wrap(err, "scanning column name"))
- }
-
- if name == "public" {
- t.Fatal("public column still exists after migration")
- }
- }
-}
-
func TestRemoteMigration1(t *testing.T) {
// set up
- db := database.InitTestMemoryDBRaw(t, "./fixtures/remote-1-pre-schema.sql")
- ctx := context.InitTestCtxWithDB(t, db)
+ opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/remote-1-pre-schema.sql", SkipMigration: true}
+ ctx := context.InitTestCtx(t, "../tmp", &opts)
+ defer context.TeardownTestCtx(t, ctx)
testutils.Login(t, &ctx)
JSBookUUID := "existing-js-book-uuid"
@@ -1186,6 +1144,7 @@ func TestRemoteMigration1(t *testing.T) {
ctx.APIEndpoint = server.URL
+ db := ctx.DB
database.MustExec(t, "inserting js book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", JSBookUUID, "js")
database.MustExec(t, "inserting css book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", CSSBookUUID, "css")
database.MustExec(t, "inserting linux book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", linuxBookUUID, "linux")
diff --git a/pkg/cli/migrate/migrations.go b/pkg/cli/migrate/migrations.go
index 197a2b03..c6b8e5ff 100644
--- a/pkg/cli/migrate/migrations.go
+++ b/pkg/cli/migrate/migrations.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package migrate
@@ -536,10 +539,7 @@ var lm12 = migration{
return errors.Wrap(err, "reading config")
}
- // Only set if not already configured
- if cf.APIEndpoint == "" {
- cf.APIEndpoint = "https://api.getdnote.com"
- }
+ cf.APIEndpoint = "https://api.getdnote.com"
err = config.Write(ctx, cf)
if err != nil {
@@ -550,37 +550,6 @@ var lm12 = migration{
},
}
-var lm13 = migration{
- name: "add enableUpgradeCheck to the configuration file",
- run: func(ctx context.DnoteCtx, tx *database.DB) error {
- cf, err := config.Read(ctx)
- if err != nil {
- return errors.Wrap(err, "reading config")
- }
-
- cf.EnableUpgradeCheck = true
-
- err = config.Write(ctx, cf)
- if err != nil {
- return errors.Wrap(err, "writing config")
- }
-
- return nil
- },
-}
-
-var lm14 = migration{
- name: "drop-public-from-notes",
- run: func(ctx context.DnoteCtx, tx *database.DB) error {
- _, err := tx.Exec(`ALTER TABLE notes DROP COLUMN public;`)
- if err != nil {
- return errors.Wrap(err, "dropping public column from notes")
- }
-
- return nil
- },
-}
-
var rm1 = migration{
name: "sync-book-uuids-from-server",
run: func(ctx context.DnoteCtx, tx *database.DB) error {
diff --git a/pkg/cli/output/output.go b/pkg/cli/output/output.go
index d272ba88..a25666c9 100644
--- a/pkg/cli/output/output.go
+++ b/pkg/cli/output/output.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package output provides functions to print informations on the terminal
@@ -19,7 +22,6 @@ package output
import (
"fmt"
- "io"
"time"
"github.com/dnote/dnote/pkg/cli/database"
@@ -27,7 +29,7 @@ import (
)
// NoteInfo prints a note information
-func NoteInfo(w io.Writer, info database.NoteInfo) {
+func NoteInfo(info database.NoteInfo) {
log.Infof("book name: %s\n", info.BookLabel)
log.Infof("created at: %s\n", time.Unix(0, info.AddedOn).Format("Jan 2, 2006 3:04pm (MST)"))
if info.EditedOn != 0 {
@@ -36,13 +38,9 @@ func NoteInfo(w io.Writer, info database.NoteInfo) {
log.Infof("note id: %d\n", info.RowID)
log.Infof("note uuid: %s\n", info.UUID)
- fmt.Fprintf(w, "\n------------------------content------------------------\n")
- fmt.Fprintf(w, "%s", info.Content)
- fmt.Fprintf(w, "\n-------------------------------------------------------\n")
-}
-
-func NoteContent(w io.Writer, info database.NoteInfo) {
- fmt.Fprintf(w, "%s", info.Content)
+ fmt.Printf("\n------------------------content------------------------\n")
+ fmt.Printf("%s", info.Content)
+ fmt.Printf("\n-------------------------------------------------------\n")
}
// BookInfo prints a note information
diff --git a/pkg/cli/testutils/main.go b/pkg/cli/testutils/main.go
index db3282d7..68f66eaa 100644
--- a/pkg/cli/testutils/main.go
+++ b/pkg/cli/testutils/main.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package testutils provides utilities used in tests
@@ -19,7 +22,9 @@ package testutils
import (
"bytes"
"encoding/json"
+ "fmt"
"io"
+ "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -27,7 +32,6 @@ import (
"testing"
"time"
- "github.com/dnote/dnote/pkg/assert"
"github.com/dnote/dnote/pkg/cli/consts"
"github.com/dnote/dnote/pkg/cli/context"
"github.com/dnote/dnote/pkg/cli/database"
@@ -35,25 +39,12 @@ import (
"github.com/pkg/errors"
)
-// Prompts for user input
-const (
- PromptRemoveNote = "remove this note?"
- PromptDeleteBook = "delete book"
- PromptEmptyServer = "The server is empty but you have local data"
-)
-
-// Timeout for waiting for prompts in tests
-const promptTimeout = 10 * time.Second
-
-// LoginDB sets up login credentials in the database for tests
-func LoginDB(t *testing.T, db *database.DB) {
- database.MustExec(t, "inserting sessionKey", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKey, "someSessionKey")
- database.MustExec(t, "inserting sessionKeyExpiry", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKeyExpiry, time.Now().Add(24*time.Hour).Unix())
-}
-
// Login simulates a logged in user by inserting credentials in the local database
func Login(t *testing.T, ctx *context.DnoteCtx) {
- LoginDB(t, ctx.DB)
+ db := ctx.DB
+
+ database.MustExec(t, "inserting sessionKey", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKey, "someSessionKey")
+ database.MustExec(t, "inserting sessionKeyExpiry", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKeyExpiry, time.Now().Add(24*time.Hour).Unix())
ctx.SessionKey = "someSessionKey"
ctx.SessionKeyExpiry = time.Now().Add(24 * time.Hour).Unix()
@@ -73,7 +64,7 @@ func CopyFixture(t *testing.T, ctx context.DnoteCtx, fixturePath string, filenam
t.Fatal(errors.Wrap(err, "getting the absolute path for fixture"))
}
- dp, err := filepath.Abs(filepath.Join(ctx.Paths.LegacyDnote, filename))
+ dp, err := filepath.Abs(filepath.Join(ctx.DnoteDir, filename))
if err != nil {
t.Fatal(errors.Wrap(err, "getting the absolute path dnote dir"))
}
@@ -86,21 +77,21 @@ func CopyFixture(t *testing.T, ctx context.DnoteCtx, fixturePath string, filenam
// WriteFile writes a file with the given content and filename inside the dnote dir
func WriteFile(ctx context.DnoteCtx, content []byte, filename string) {
- dp, err := filepath.Abs(filepath.Join(ctx.Paths.LegacyDnote, filename))
+ dp, err := filepath.Abs(filepath.Join(ctx.DnoteDir, filename))
if err != nil {
panic(err)
}
- if err := os.WriteFile(dp, content, 0644); err != nil {
+ if err := ioutil.WriteFile(dp, content, 0644); err != nil {
panic(err)
}
}
// ReadFile reads the content of the file with the given name in dnote dir
func ReadFile(ctx context.DnoteCtx, filename string) []byte {
- path := filepath.Join(ctx.Paths.LegacyDnote, filename)
+ path := filepath.Join(ctx.DnoteDir, filename)
- b, err := os.ReadFile(path)
+ b, err := ioutil.ReadFile(path)
if err != nil {
panic(err)
}
@@ -111,7 +102,7 @@ func ReadFile(ctx context.DnoteCtx, filename string) []byte {
// ReadJSON reads JSON fixture to the struct at the destination address
func ReadJSON(path string, destination interface{}) {
var dat []byte
- dat, err := os.ReadFile(path)
+ dat, err := ioutil.ReadFile(path)
if err != nil {
panic(errors.Wrap(err, "Failed to load fixture payload"))
}
@@ -130,21 +121,21 @@ func NewDnoteCmd(opts RunDnoteCmdOptions, binaryName string, arg ...string) (*ex
}
cmd := exec.Command(binaryPath, arg...)
+ cmd.Env = []string{fmt.Sprintf("DNOTE_DIR=%s", opts.DnoteDir), fmt.Sprintf("DNOTE_HOME_DIR=%s", opts.HomeDir)}
cmd.Stderr = &stderr
cmd.Stdout = &stdout
- cmd.Env = opts.Env
-
return cmd, &stderr, &stdout, nil
}
// RunDnoteCmdOptions is an option for RunDnoteCmd
type RunDnoteCmdOptions struct {
- Env []string
+ DnoteDir string
+ HomeDir string
}
// RunDnoteCmd runs a dnote command
-func RunDnoteCmd(t *testing.T, opts RunDnoteCmdOptions, binaryName string, arg ...string) string {
+func RunDnoteCmd(t *testing.T, opts RunDnoteCmdOptions, binaryName string, arg ...string) {
t.Logf("running: %s %s", binaryName, strings.Join(arg, " "))
cmd, stderr, stdout, err := NewDnoteCmd(opts, binaryName, arg...)
@@ -162,110 +153,54 @@ func RunDnoteCmd(t *testing.T, opts RunDnoteCmdOptions, binaryName string, arg .
// Print stdout if and only if test fails later
t.Logf("\n%s", stdout)
-
- return stdout.String()
}
-// WaitDnoteCmd runs a dnote command and passes stdout to the callback.
-func WaitDnoteCmd(t *testing.T, opts RunDnoteCmdOptions, runFunc func(io.Reader, io.WriteCloser) error, binaryName string, arg ...string) (string, error) {
+// WaitDnoteCmd runs a dnote command and waits until the command is exited
+func WaitDnoteCmd(t *testing.T, opts RunDnoteCmdOptions, runFunc func(io.WriteCloser) error, binaryName string, arg ...string) {
t.Logf("running: %s %s", binaryName, strings.Join(arg, " "))
- binaryPath, err := filepath.Abs(binaryName)
+ cmd, stderr, stdout, err := NewDnoteCmd(opts, binaryName, arg...)
if err != nil {
- return "", errors.Wrap(err, "getting absolute path to test binary")
- }
-
- cmd := exec.Command(binaryPath, arg...)
- cmd.Env = opts.Env
-
- var stderr bytes.Buffer
- cmd.Stderr = &stderr
-
- stdout, err := cmd.StdoutPipe()
- if err != nil {
- return "", errors.Wrap(err, "getting stdout pipe")
+ t.Logf("\n%s", stdout)
+ t.Fatal(errors.Wrap(err, "getting command").Error())
}
stdin, err := cmd.StdinPipe()
if err != nil {
- return "", errors.Wrap(err, "getting stdin")
+ t.Logf("\n%s", stdout)
+ t.Fatal(errors.Wrap(err, "getting stdin %s"))
}
defer stdin.Close()
- if err = cmd.Start(); err != nil {
- return "", errors.Wrap(err, "starting command")
- }
-
- var output bytes.Buffer
- tee := io.TeeReader(stdout, &output)
-
- err = runFunc(tee, stdin)
+ // Start the program
+ err = cmd.Start()
if err != nil {
- t.Logf("\n%s", output.String())
- return output.String(), errors.Wrap(err, "running callback")
+ t.Logf("\n%s", stdout)
+ t.Fatal(errors.Wrap(err, "starting command"))
}
- io.Copy(&output, stdout)
-
- if err := cmd.Wait(); err != nil {
- t.Logf("\n%s", output.String())
- return output.String(), errors.Wrapf(err, "command failed: %s", stderr.String())
- }
-
- t.Logf("\n%s", output.String())
- return output.String(), nil
-}
-
-func MustWaitDnoteCmd(t *testing.T, opts RunDnoteCmdOptions, runFunc func(io.Reader, io.WriteCloser) error, binaryName string, arg ...string) string {
- output, err := WaitDnoteCmd(t, opts, runFunc, binaryName, arg...)
+ err = runFunc(stdin)
if err != nil {
- t.Fatal(err)
+ t.Logf("\n%s", stdout)
+ t.Fatal(errors.Wrap(err, "running with stdin"))
}
- return output
-}
-
-// MustWaitForPrompt waits for an expected prompt with a default timeout.
-// Fails the test if the prompt is not found or an error occurs.
-func MustWaitForPrompt(t *testing.T, stdout io.Reader, expectedPrompt string) {
- if err := assert.WaitForPrompt(stdout, expectedPrompt, promptTimeout); err != nil {
- t.Fatal(err)
- }
-}
-
-// ConfirmRemoveNote waits for prompt for removing a note and confirms.
-func ConfirmRemoveNote(stdout io.Reader, stdin io.WriteCloser) error {
- return assert.RespondToPrompt(stdout, stdin, PromptRemoveNote, "y\n", promptTimeout)
-}
-
-// ConfirmRemoveBook waits for prompt for deleting a book confirms.
-func ConfirmRemoveBook(stdout io.Reader, stdin io.WriteCloser) error {
- return assert.RespondToPrompt(stdout, stdin, PromptDeleteBook, "y\n", promptTimeout)
-}
-
-// UserConfirmEmptyServerSync waits for an empty server prompt and confirms.
-func UserConfirmEmptyServerSync(stdout io.Reader, stdin io.WriteCloser) error {
- return assert.RespondToPrompt(stdout, stdin, PromptEmptyServer, "y\n", promptTimeout)
-}
-
-// UserCancelEmptyServerSync waits for an empty server prompt and cancels.
-func UserCancelEmptyServerSync(stdout io.Reader, stdin io.WriteCloser) error {
- return assert.RespondToPrompt(stdout, stdin, PromptEmptyServer, "n\n", promptTimeout)
-}
-
-// UserContent simulates content from the user by writing to stdin.
-// This is used for piped input where no prompt is shown.
-func UserContent(stdout io.Reader, stdin io.WriteCloser) error {
- longText := `Lorem ipsum dolor sit amet, consectetur adipiscing elit,
- sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.`
-
- if _, err := io.WriteString(stdin, longText); err != nil {
- return errors.Wrap(err, "creating note from stdin")
+ err = cmd.Wait()
+ if err != nil {
+ t.Logf("\n%s", stdout)
+ t.Fatal(errors.Wrapf(err, "running command %s", stderr.String()))
}
- // stdin needs to close so stdin reader knows to stop reading
- // otherwise test case would wait until test timeout
- stdin.Close()
+ // Print stdout if and only if test fails later
+ t.Logf("\n%s", stdout)
+}
+
+// UserConfirm simulates confirmation from the user by writing to stdin
+func UserConfirm(stdin io.WriteCloser) error {
+ // confirm
+ if _, err := io.WriteString(stdin, "y\n"); err != nil {
+ return errors.Wrap(err, "indicating confirmation in stdin")
+ }
return nil
}
@@ -299,12 +234,3 @@ func MustGenerateUUID(t *testing.T) string {
return ret
}
-
-func MustOpenDatabase(t *testing.T, dbPath string) *database.DB {
- db, err := database.Open(dbPath)
- if err != nil {
- t.Fatal(errors.Wrap(err, "opening database"))
- }
-
- return db
-}
diff --git a/pkg/cli/testutils/setup.go b/pkg/cli/testutils/setup.go
index d88afd2d..33d67fa1 100644
--- a/pkg/cli/testutils/setup.go
+++ b/pkg/cli/testutils/setup.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package testutils
diff --git a/pkg/cli/ui/editor.go b/pkg/cli/ui/editor.go
index a6c165f4..4b5cb0d4 100644
--- a/pkg/cli/ui/editor.go
+++ b/pkg/cli/ui/editor.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package ui provides the user interface for the program
@@ -18,6 +21,7 @@ package ui
import (
"fmt"
+ "io/ioutil"
"os"
"os/exec"
"strings"
@@ -33,7 +37,7 @@ import (
func GetTmpContentPath(ctx context.DnoteCtx) (string, error) {
for i := 0; ; i++ {
filename := fmt.Sprintf("%s_%d.%s", consts.TmpContentFileBase, i, consts.TmpContentFileExt)
- candidate := fmt.Sprintf("%s/%s", ctx.Paths.Cache, filename)
+ candidate := fmt.Sprintf("%s/%s", ctx.DnoteDir, filename)
ok, err := utils.FileExists(candidate)
if err != nil {
@@ -118,7 +122,7 @@ func GetEditorInput(ctx context.DnoteCtx, fpath string) (string, error) {
return "", errors.Wrap(err, "waiting for the editor")
}
- b, err := os.ReadFile(fpath)
+ b, err := ioutil.ReadFile(fpath)
if err != nil {
return "", errors.Wrap(err, "reading the temporary content file")
}
diff --git a/pkg/cli/ui/editor_test.go b/pkg/cli/ui/editor_test.go
index 54538c49..d89e3d9c 100644
--- a/pkg/cli/ui/editor_test.go
+++ b/pkg/cli/ui/editor_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package ui
@@ -27,22 +30,24 @@ import (
func TestGetTmpContentPath(t *testing.T) {
t.Run("no collision", func(t *testing.T) {
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../tmp1", nil)
+ defer context.TeardownTestCtx(t, ctx)
res, err := GetTmpContentPath(ctx)
if err != nil {
t.Fatal(errors.Wrap(err, "executing"))
}
- expected := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_0.md")
+ expected := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_0.md")
assert.Equal(t, res, expected, "filename did not match")
})
t.Run("one existing session", func(t *testing.T) {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../tmp2", nil)
+ defer context.TeardownTestCtx(t, ctx)
- p := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_0.md")
+ p := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_0.md")
if _, err := os.Create(p); err != nil {
t.Fatal(errors.Wrap(err, "preparing the conflicting file"))
}
@@ -54,19 +59,20 @@ func TestGetTmpContentPath(t *testing.T) {
}
// test
- expected := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_1.md")
+ expected := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_1.md")
assert.Equal(t, res, expected, "filename did not match")
})
t.Run("two existing sessions", func(t *testing.T) {
// set up
- ctx := context.InitTestCtx(t)
+ ctx := context.InitTestCtx(t, "../tmp3", nil)
+ defer context.TeardownTestCtx(t, ctx)
- p1 := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_0.md")
+ p1 := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_0.md")
if _, err := os.Create(p1); err != nil {
t.Fatal(errors.Wrap(err, "preparing the conflicting file"))
}
- p2 := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_1.md")
+ p2 := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_1.md")
if _, err := os.Create(p2); err != nil {
t.Fatal(errors.Wrap(err, "preparing the conflicting file"))
}
@@ -78,7 +84,7 @@ func TestGetTmpContentPath(t *testing.T) {
}
// test
- expected := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_2.md")
+ expected := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_2.md")
assert.Equal(t, res, expected, "filename did not match")
})
}
diff --git a/pkg/cli/ui/terminal.go b/pkg/cli/ui/terminal.go
index 6a255766..e172343e 100644
--- a/pkg/cli/ui/terminal.go
+++ b/pkg/cli/ui/terminal.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package ui
@@ -23,7 +26,6 @@ import (
"syscall"
"github.com/dnote/dnote/pkg/cli/log"
- "github.com/dnote/dnote/pkg/prompt"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh/terminal"
)
@@ -71,31 +73,25 @@ func PromptPassword(message string, dest *string) error {
// Confirm prompts for user input to confirm a choice
func Confirm(question string, optimistic bool) (bool, error) {
- message := prompt.FormatQuestion(question, optimistic)
+ var choices string
+ if optimistic {
+ choices = "(Y/n)"
+ } else {
+ choices = "(y/N)"
+ }
- // Use log.Askf for colored prompt in CLI
- log.Askf(message, false)
+ message := fmt.Sprintf("%s %s", question, choices)
- confirmed, err := prompt.ReadYesNo(os.Stdin, optimistic)
- if err != nil {
+ var input string
+ if err := PromptInput(message, &input); err != nil {
return false, errors.Wrap(err, "Failed to get user input")
}
+ confirmed := input == "y"
+
+ if optimistic {
+ confirmed = confirmed || input == ""
+ }
+
return confirmed, nil
}
-
-// Grab text from stdin content
-func ReadStdInput() (string, error) {
- var lines []string
-
- s := bufio.NewScanner(os.Stdin)
- for s.Scan() {
- lines = append(lines, s.Text())
- }
- err := s.Err()
- if err != nil {
- return "", errors.Wrap(err, "reading pipe")
- }
-
- return strings.Join(lines, "\n"), nil
-}
diff --git a/pkg/cli/upgrade/upgrade.go b/pkg/cli/upgrade/upgrade.go
index 7c24a86d..d56e8852 100644
--- a/pkg/cli/upgrade/upgrade.go
+++ b/pkg/cli/upgrade/upgrade.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package upgrade
@@ -29,8 +32,8 @@ import (
"github.com/pkg/errors"
)
-// upgradeInterval is 8 weeks
-var upgradeInterval int64 = 86400 * 7 * 8
+// upgradeInterval is 3 weeks
+var upgradeInterval int64 = 86400 * 7 * 3
// shouldCheckUpdate checks if update should be checked
func shouldCheckUpdate(ctx context.DnoteCtx) (bool, error) {
@@ -109,11 +112,6 @@ func checkVersion(ctx context.DnoteCtx) error {
// Check triggers update if needed
func Check(ctx context.DnoteCtx) error {
- // If upgrade check is not enabled, do not proceed further
- if !ctx.EnableUpgradeCheck {
- return nil
- }
-
shouldCheck, err := shouldCheckUpdate(ctx)
if err != nil {
return errors.Wrap(err, "checking if dnote should check update")
diff --git a/pkg/cli/upgrade/upgrade_test.go b/pkg/cli/upgrade/upgrade_test.go
index 917e6754..f122ff28 100644
--- a/pkg/cli/upgrade/upgrade_test.go
+++ b/pkg/cli/upgrade/upgrade_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package upgrade
diff --git a/pkg/cli/utils/diff/diff.go b/pkg/cli/utils/diff/diff.go
index ff7e3384..774732fe 100644
--- a/pkg/cli/utils/diff/diff.go
+++ b/pkg/cli/utils/diff/diff.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package diff provides line-by-line diff feature by wrapping
diff --git a/pkg/cli/utils/diff/diff_test.go b/pkg/cli/utils/diff/diff_test.go
index f777f26c..8ad274b9 100644
--- a/pkg/cli/utils/diff/diff_test.go
+++ b/pkg/cli/utils/diff/diff_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package diff
diff --git a/pkg/cli/utils/files.go b/pkg/cli/utils/files.go
index 60f57de6..28eff024 100644
--- a/pkg/cli/utils/files.go
+++ b/pkg/cli/utils/files.go
@@ -1,22 +1,26 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package utils
import (
"io"
+ "io/ioutil"
"os"
"path/filepath"
@@ -31,7 +35,7 @@ func ReadFileAbs(relpath string) []byte {
panic(err)
}
- b, err := os.ReadFile(fp)
+ b, err := ioutil.ReadFile(fp)
if err != nil {
panic(err)
}
@@ -52,24 +56,6 @@ func FileExists(filepath string) (bool, error) {
return false, errors.Wrap(err, "getting file info")
}
-// EnsureDir creates a directory if it doesn't exist.
-// Returns nil if the directory already exists or was successfully created.
-func EnsureDir(path string) error {
- ok, err := FileExists(path)
- if err != nil {
- return errors.Wrapf(err, "checking if dir exists at %s", path)
- }
- if ok {
- return nil
- }
-
- if err := os.MkdirAll(path, 0755); err != nil {
- return errors.Wrapf(err, "creating directory at %s", path)
- }
-
- return nil
-}
-
// CopyDir copies a directory from src to dest, recursively copying nested
// directories
func CopyDir(src, dest string) error {
@@ -94,7 +80,7 @@ func CopyDir(src, dest string) error {
return errors.Wrap(err, "creating destination")
}
- entries, err := os.ReadDir(src)
+ entries, err := ioutil.ReadDir(src)
if err != nil {
return errors.Wrap(err, "reading the directory listing for the input")
}
diff --git a/pkg/cli/utils/files_test.go b/pkg/cli/utils/files_test.go
deleted file mode 100644
index 7f26e19c..00000000
--- a/pkg/cli/utils/files_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package utils
-
-import (
- "os"
- "path/filepath"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
-)
-
-func TestEnsureDir(t *testing.T) {
- tmpDir := t.TempDir()
- testPath := filepath.Join(tmpDir, "test", "nested", "dir")
-
- // Create directory
- err := EnsureDir(testPath)
- assert.Equal(t, err, nil, "EnsureDir should succeed")
-
- // Verify it exists
- info, err := os.Stat(testPath)
- assert.Equal(t, err, nil, "directory should exist")
- assert.Equal(t, info.IsDir(), true, "should be a directory")
-
- // Call again on existing directory - should not error
- err = EnsureDir(testPath)
- assert.Equal(t, err, nil, "EnsureDir should succeed on existing directory")
-}
diff --git a/pkg/cli/utils/utils.go b/pkg/cli/utils/utils.go
index 417963ce..dfff484b 100644
--- a/pkg/cli/utils/utils.go
+++ b/pkg/cli/utils/utils.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package utils
diff --git a/pkg/cli/validate/book_test.go b/pkg/cli/validate/book_test.go
index 97a384fc..f26d51ac 100644
--- a/pkg/cli/validate/book_test.go
+++ b/pkg/cli/validate/book_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package validate
diff --git a/pkg/cli/validate/books.go b/pkg/cli/validate/books.go
index b0e4c0ed..c220e0c9 100644
--- a/pkg/cli/validate/books.go
+++ b/pkg/cli/validate/books.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package validate
diff --git a/pkg/clock/clock.go b/pkg/clock/clock.go
index 061bb1a3..a1a4ad26 100644
--- a/pkg/clock/clock.go
+++ b/pkg/clock/clock.go
@@ -1,26 +1,30 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
// Package clock provides an abstract layer over the standard time package
package clock
import (
- "sync"
"time"
)
+//TODO: use mutex to avoid race
+
// Clock is an interface to the standard library time.
// It is used to implement a real or a mock clock. The latter is used in tests.
type Clock interface {
@@ -35,21 +39,16 @@ func (c *clock) Now() time.Time {
// Mock is a mock instance of clock
type Mock struct {
- mu sync.RWMutex
currentTime time.Time
}
// SetNow sets the current time for the mock clock
func (c *Mock) SetNow(t time.Time) {
- c.mu.Lock()
- defer c.mu.Unlock()
c.currentTime = t
}
// Now returns the current time
func (c *Mock) Now() time.Time {
- c.mu.RLock()
- defer c.mu.RUnlock()
return c.currentTime
}
diff --git a/pkg/dirs/dirs.go b/pkg/dirs/dirs.go
deleted file mode 100644
index 3eb57a7f..00000000
--- a/pkg/dirs/dirs.go
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Package dirs provides base directory definitions for the system
-package dirs
-
-import (
- "os"
- "os/user"
-
- "github.com/pkg/errors"
-)
-
-var (
- // Home is the home directory of the user
- Home string
- // ConfigHome is the full path to the directory in which user-specific
- // configurations should be written.
- ConfigHome string
- // DataHome is the full path to the directory in which user-specific data
- // files should be written.
- DataHome string
- // CacheHome is the full path to the directory in which user-specific
- // non-essential cached data should be writte
- CacheHome string
-)
-
-func init() {
- Reload()
-}
-
-// Reload reloads the directory definitions
-func Reload() {
- initDirs()
-}
-
-func getHomeDir() string {
- usr, err := user.Current()
- if err != nil {
- panic(errors.Wrap(err, "getting home dir"))
- }
-
- return usr.HomeDir
-}
-
-func readPath(envName, defaultPath string) string {
- if dir := os.Getenv(envName); dir != "" {
- return dir
- }
-
- return defaultPath
-}
diff --git a/pkg/dirs/dirs_test.go b/pkg/dirs/dirs_test.go
deleted file mode 100644
index 0c1ecb1f..00000000
--- a/pkg/dirs/dirs_test.go
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dirs
-
-import (
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
-)
-
-type envTestCase struct {
- envKey string
- envVal string
- got *string
- expected string
-}
-
-func testCustomDirs(t *testing.T, testCases []envTestCase) {
- for _, tc := range testCases {
- t.Setenv(tc.envKey, tc.envVal)
-
- Reload()
-
- assert.Equal(t, *tc.got, tc.expected, "result mismatch")
- }
-}
diff --git a/pkg/dirs/dirs_unix.go b/pkg/dirs/dirs_unix.go
deleted file mode 100644
index 6c7696c6..00000000
--- a/pkg/dirs/dirs_unix.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//go:build linux || darwin || freebsd
-
-
-package dirs
-
-import (
- "path/filepath"
-)
-
-// The environment variable names for the XDG base directory specification
-var (
- envConfigHome = "XDG_CONFIG_HOME"
- envDataHome = "XDG_DATA_HOME"
- envCacheHome = "XDG_CACHE_HOME"
-)
-
-func initDirs() {
- Home = getHomeDir()
- ConfigHome = readPath(envConfigHome, getConfigHome(Home))
- DataHome = readPath(envDataHome, getDataHome(Home))
- CacheHome = readPath(envCacheHome, getCacheHome(Home))
-}
-
-func getConfigHome(homeDir string) string {
- return filepath.Join(homeDir, ".config")
-}
-
-func getDataHome(homeDir string) string {
- return filepath.Join(homeDir, ".local/share")
-}
-
-func getCacheHome(homeDir string) string {
- return filepath.Join(homeDir, ".cache")
-}
diff --git a/pkg/dirs/dirs_unix_test.go b/pkg/dirs/dirs_unix_test.go
deleted file mode 100644
index 9ea5805a..00000000
--- a/pkg/dirs/dirs_unix_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//go:build linux || darwin || freebsd
-
-
-package dirs
-
-import (
- "path/filepath"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
-)
-
-func TestDirs(t *testing.T) {
- home := Home
- assert.NotEqual(t, home, "", "home is empty")
-
- configHome := filepath.Join(home, ".config")
- dataHome := filepath.Join(home, ".local", "share")
- cacheHome := filepath.Join(home, ".cache")
-
- testCases := []struct {
- got string
- expected string
- }{
- {
- got: ConfigHome,
- expected: configHome,
- },
- {
- got: DataHome,
- expected: dataHome,
- },
- {
- got: CacheHome,
- expected: cacheHome,
- },
- }
-
- for _, tc := range testCases {
- assert.Equal(t, tc.got, tc.expected, "result mismatch")
- }
-}
-
-func TestCustomDirs(t *testing.T) {
- testCases := []envTestCase{
- {
- envKey: "XDG_CONFIG_HOME",
- envVal: "~/custom/config",
- got: &ConfigHome,
- expected: "~/custom/config",
- },
- {
- envKey: "XDG_DATA_HOME",
- envVal: "~/custom/data",
- got: &DataHome,
- expected: "~/custom/data",
- },
- {
- envKey: "XDG_CACHE_HOME",
- envVal: "~/custom/cache",
- got: &CacheHome,
- expected: "~/custom/cache",
- },
- }
-
- testCustomDirs(t, testCases)
-}
diff --git a/pkg/dirs/dirs_windows.go b/pkg/dirs/dirs_windows.go
deleted file mode 100644
index 7159ae8d..00000000
--- a/pkg/dirs/dirs_windows.go
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//go:build windows
-
-
-package dirs
-
-import (
- "path/filepath"
-)
-
-func initDirs() {
- Home = getHomeDir()
- ConfigHome = filepath.Join(Home, ".dnote")
- DataHome = filepath.Join(Home, ".dnote")
- CacheHome = filepath.Join(Home, ".dnote")
-}
diff --git a/pkg/dirs/dirs_windows_test.go b/pkg/dirs/dirs_windows_test.go
deleted file mode 100644
index 101071f5..00000000
--- a/pkg/dirs/dirs_windows_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//go:build windows
-
-
-package dirs
-
-import (
- "path/filepath"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
-)
-
-func TestDirs(t *testing.T) {
- home := Home
- assert.NotEqual(t, home, "", "home is empty")
-
- configHome := filepath.Join(home, ".dnote")
- dataHome := filepath.Join(home, ".dnote")
- cacheHome := filepath.Join(home, ".dnote")
-
- testCases := []struct {
- got string
- expected string
- }{
- {
- got: ConfigHome,
- expected: configHome,
- },
- {
- got: DataHome,
- expected: dataHome,
- },
- {
- got: CacheHome,
- expected: cacheHome,
- },
- }
-
- for _, tc := range testCases {
- assert.Equal(t, tc.got, tc.expected, "result mismatch")
- }
-}
diff --git a/pkg/e2e/server_test.go b/pkg/e2e/server_test.go
deleted file mode 100644
index e8ca3da6..00000000
--- a/pkg/e2e/server_test.go
+++ /dev/null
@@ -1,353 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "bytes"
- "fmt"
- "net/http"
- "os"
- "os/exec"
- "strings"
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
- "gorm.io/driver/sqlite"
- "gorm.io/gorm"
-)
-
-var testServerBinary string
-
-func init() {
- // Build server binary in temp directory
- tmpDir := os.TempDir()
- testServerBinary = fmt.Sprintf("%s/dnote-test-server", tmpDir)
- buildCmd := exec.Command("go", "build", "-tags", "fts5", "-o", testServerBinary, "../server")
- if out, err := buildCmd.CombinedOutput(); err != nil {
- panic(fmt.Sprintf("failed to build server: %v\n%s", err, out))
- }
-}
-
-func TestServerStart(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
- port := "13456" // Use different port to avoid conflicts with main test server
-
- // Start server in background
- cmd := exec.Command(testServerBinary, "start", "--port", port)
- cmd.Env = append(os.Environ(),
- "DBPath="+tmpDB,
- )
-
- if err := cmd.Start(); err != nil {
- t.Fatalf("failed to start server: %v", err)
- }
-
- // Ensure cleanup
- cleanup := func() {
- if cmd.Process != nil {
- cmd.Process.Kill()
- cmd.Wait() // Wait for process to fully exit
- }
- }
- defer cleanup()
-
- // Wait for server to start and migrations to run
- time.Sleep(3 * time.Second)
-
- // Verify server responds to health check
- resp, err := http.Get(fmt.Sprintf("http://localhost:%s/health", port))
- if err != nil {
- t.Fatalf("failed to reach server health endpoint: %v", err)
- }
- defer resp.Body.Close()
-
- assert.Equal(t, resp.StatusCode, 200, "health endpoint should return 200")
-
- // Kill server before checking database to avoid locks
- cleanup()
-
- // Verify database file was created
- if _, err := os.Stat(tmpDB); os.IsNotExist(err) {
- t.Fatalf("database file was not created at %s", tmpDB)
- }
-
- // Verify migrations ran by checking database
- db, err := gorm.Open(sqlite.Open(tmpDB), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open test database: %v", err)
- }
-
- // Verify migrations ran
- var count int64
- if err := db.Raw("SELECT COUNT(*) FROM schema_migrations").Scan(&count).Error; err != nil {
- t.Fatalf("schema_migrations table not found: %v", err)
- }
- if count == 0 {
- t.Fatal("no migrations were run")
- }
-
- // Verify FTS table exists and is functional
- if err := db.Exec("SELECT * FROM notes_fts LIMIT 1").Error; err != nil {
- t.Fatalf("notes_fts table not found or not functional: %v", err)
- }
-}
-
-func TestServerVersion(t *testing.T) {
- cmd := exec.Command("go", "run", "-tags", "fts5", "../server", "version")
- output, err := cmd.CombinedOutput()
- if err != nil {
- t.Fatalf("version command failed: %v", err)
- }
-
- outputStr := string(output)
- if !strings.Contains(outputStr, "dnote-server-") {
- t.Errorf("expected version output to contain 'dnote-server-', got: %s", outputStr)
- }
-}
-
-func TestServerRootCommand(t *testing.T) {
- cmd := exec.Command(testServerBinary)
- output, err := cmd.CombinedOutput()
- if err != nil {
- t.Fatalf("server command failed: %v", err)
- }
-
- outputStr := string(output)
- assert.Equal(t, strings.Contains(outputStr, "Dnote server - a simple command line notebook"), true, "output should contain description")
- assert.Equal(t, strings.Contains(outputStr, "start: Start the server"), true, "output should contain start command")
- assert.Equal(t, strings.Contains(outputStr, "version: Print the version"), true, "output should contain version command")
-}
-
-func TestServerStartHelp(t *testing.T) {
- cmd := exec.Command(testServerBinary, "start", "--help")
- output, _ := cmd.CombinedOutput()
-
- outputStr := string(output)
- assert.Equal(t, strings.Contains(outputStr, "dnote-server start [flags]"), true, "output should contain usage")
- assert.Equal(t, strings.Contains(outputStr, "--port"), true, "output should contain port flag")
- assert.Equal(t, strings.Contains(outputStr, "--baseUrl"), true, "output should contain baseUrl flag")
- assert.Equal(t, strings.Contains(outputStr, "--dbPath"), true, "output should contain dbPath flag")
- assert.Equal(t, strings.Contains(outputStr, "--disableRegistration"), true, "output should contain disableRegistration flag")
-}
-
-func TestServerStartInvalidConfig(t *testing.T) {
- cmd := exec.Command(testServerBinary, "start")
- // Set invalid BaseURL to trigger validation failure
- cmd.Env = []string{"BaseURL=not-a-valid-url"}
-
- output, err := cmd.CombinedOutput()
-
- // Should exit with non-zero status
- if err == nil {
- t.Fatal("expected command to fail with invalid config")
- }
-
- outputStr := string(output)
- assert.Equal(t, strings.Contains(outputStr, "Error:"), true, "output should contain error message")
- assert.Equal(t, strings.Contains(outputStr, "Invalid BaseURL"), true, "output should mention invalid BaseURL")
- assert.Equal(t, strings.Contains(outputStr, "dnote-server start [flags]"), true, "output should show usage")
- assert.Equal(t, strings.Contains(outputStr, "--baseUrl"), true, "output should show flags")
-}
-
-func TestServerUnknownCommand(t *testing.T) {
- cmd := exec.Command(testServerBinary, "unknown")
- output, err := cmd.CombinedOutput()
-
- // Should exit with non-zero status
- if err == nil {
- t.Fatal("expected command to fail with unknown command")
- }
-
- outputStr := string(output)
- assert.Equal(t, strings.Contains(outputStr, "Unknown command"), true, "output should contain unknown command message")
- assert.Equal(t, strings.Contains(outputStr, "Dnote server - a simple command line notebook"), true, "output should show help")
-}
-
-func TestServerUserCreate(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- cmd := exec.Command(testServerBinary, "user", "create",
- "--dbPath", tmpDB,
- "--email", "test@example.com",
- "--password", "password123")
- output, err := cmd.CombinedOutput()
-
- if err != nil {
- t.Fatalf("user create failed: %v\nOutput: %s", err, output)
- }
-
- outputStr := string(output)
- assert.Equal(t, strings.Contains(outputStr, "User created successfully"), true, "output should show success message")
- assert.Equal(t, strings.Contains(outputStr, "test@example.com"), true, "output should show email")
-
- // Verify user exists in database
- db, err := gorm.Open(sqlite.Open(tmpDB), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
- defer func() {
- sqlDB, _ := db.DB()
- sqlDB.Close()
- }()
-
- var count int64
- db.Table("users").Count(&count)
- assert.Equal(t, count, int64(1), "should have created 1 user")
-}
-
-func TestServerUserCreateShortPassword(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- cmd := exec.Command(testServerBinary, "user", "create",
- "--dbPath", tmpDB,
- "--email", "test@example.com",
- "--password", "short")
- output, err := cmd.CombinedOutput()
-
- // Should fail with short password
- if err == nil {
- t.Fatal("expected command to fail with short password")
- }
-
- outputStr := string(output)
- assert.Equal(t, strings.Contains(outputStr, "password should be longer than 8 characters"), true, "output should show password error")
-}
-
-func TestServerUserResetPassword(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- // Create user first
- createCmd := exec.Command(testServerBinary, "user", "create",
- "--dbPath", tmpDB,
- "--email", "test@example.com",
- "--password", "oldpassword123")
- if output, err := createCmd.CombinedOutput(); err != nil {
- t.Fatalf("failed to create user: %v\nOutput: %s", err, output)
- }
-
- // Reset password
- resetCmd := exec.Command(testServerBinary, "user", "reset-password",
- "--dbPath", tmpDB,
- "--email", "test@example.com",
- "--password", "newpassword123")
- output, err := resetCmd.CombinedOutput()
-
- if err != nil {
- t.Fatalf("reset-password failed: %v\nOutput: %s", err, output)
- }
-
- outputStr := string(output)
- assert.Equal(t, strings.Contains(outputStr, "Password reset successfully"), true, "output should show success message")
-}
-
-func TestServerUserRemove(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- // Create user first
- createCmd := exec.Command(testServerBinary, "user", "create",
- "--dbPath", tmpDB,
- "--email", "test@example.com",
- "--password", "password123")
- if output, err := createCmd.CombinedOutput(); err != nil {
- t.Fatalf("failed to create user: %v\nOutput: %s", err, output)
- }
-
- // Remove user with confirmation
- removeCmd := exec.Command(testServerBinary, "user", "remove",
- "--dbPath", tmpDB,
- "--email", "test@example.com")
-
- // Pipe "y" to stdin to confirm removal
- stdin, err := removeCmd.StdinPipe()
- if err != nil {
- t.Fatalf("failed to create stdin pipe: %v", err)
- }
-
- // Capture output
- stdout, err := removeCmd.StdoutPipe()
- if err != nil {
- t.Fatalf("failed to create stdout pipe: %v", err)
- }
-
- var stderr bytes.Buffer
- removeCmd.Stderr = &stderr
-
- // Start command
- if err := removeCmd.Start(); err != nil {
- t.Fatalf("failed to start remove command: %v", err)
- }
-
- // Wait for prompt and send "y" to confirm
- if err := assert.RespondToPrompt(stdout, stdin, "Remove user test@example.com?", "y\n", 10*time.Second); err != nil {
- t.Fatalf("failed to confirm removal: %v", err)
- }
-
- // Wait for command to finish
- if err := removeCmd.Wait(); err != nil {
- t.Fatalf("user remove failed: %v\nStderr: %s", err, stderr.String())
- }
-
- // Verify user was removed
- db, err := gorm.Open(sqlite.Open(tmpDB), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
- defer func() {
- sqlDB, _ := db.DB()
- sqlDB.Close()
- }()
-
- var count int64
- db.Table("users").Count(&count)
- assert.Equal(t, count, int64(0), "should have 0 users after removal")
-}
-
-func TestServerUserCreateHelp(t *testing.T) {
- cmd := exec.Command(testServerBinary, "user", "create", "--help")
- output, err := cmd.CombinedOutput()
-
- if err != nil {
- t.Fatalf("help command failed: %v\nOutput: %s", err, output)
- }
-
- outputStr := string(output)
-
- // Verify help shows double-dash flags for consistency with CLI
- assert.Equal(t, strings.Contains(outputStr, "--email"), true, "help should show --email (double dash)")
- assert.Equal(t, strings.Contains(outputStr, "--password"), true, "help should show --password (double dash)")
- assert.Equal(t, strings.Contains(outputStr, "--dbPath"), true, "help should show --dbPath (double dash)")
-}
-
-func TestServerUserList(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- // Create two users
- exec.Command(testServerBinary, "user", "create", "--dbPath", tmpDB, "--email", "alice@example.com", "--password", "password123").CombinedOutput()
- exec.Command(testServerBinary, "user", "create", "--dbPath", tmpDB, "--email", "bob@example.com", "--password", "password123").CombinedOutput()
-
- // List users
- listCmd := exec.Command(testServerBinary, "user", "list", "--dbPath", tmpDB)
- output, err := listCmd.CombinedOutput()
-
- if err != nil {
- t.Fatalf("user list failed: %v\nOutput: %s", err, output)
- }
-
- outputStr := string(output)
- assert.Equal(t, strings.Contains(outputStr, "alice@example.com"), true, "output should have alice")
- assert.Equal(t, strings.Contains(outputStr, "bob@example.com"), true, "output should have bob")
-}
diff --git a/pkg/e2e/sync/basic_test.go b/pkg/e2e/sync/basic_test.go
deleted file mode 100644
index d49b0cd9..00000000
--- a/pkg/e2e/sync/basic_test.go
+++ /dev/null
@@ -1,3811 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package sync
-
-import (
- "fmt"
- "os"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- cliDatabase "github.com/dnote/dnote/pkg/cli/database"
- "github.com/dnote/dnote/pkg/cli/testutils"
- clitest "github.com/dnote/dnote/pkg/cli/testutils"
- "github.com/dnote/dnote/pkg/server/database"
- apitest "github.com/dnote/dnote/pkg/server/testutils"
-)
-
-func TestSync_Empty(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- return map[string]string{}
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- // Test
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 0,
- clientLastMaxUSN: 0,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 0,
- serverBookCount: 0,
- serverUserMaxUSN: 0,
- })
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
-}
-
-func TestSync_oneway(t *testing.T) {
- t.Run("cli to api only", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) {
- apitest.MustExec(t, env.ServerDB.Model(&user).Update("max_usn", 0), "updating user max_usn")
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js2")
- }
-
- assert := func(t *testing.T, env testEnv, user database.User) {
- cliDB := env.DB
-
- // test client
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 3,
- clientBookCount: 2,
- clientLastMaxUSN: 5,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 3,
- serverBookCount: 2,
- serverUserMaxUSN: 5,
- })
-
- var cliBookJS, cliBookCSS cliDatabase.Book
- var cliNote1JS, cliNote2JS, cliNote1CSS cliDatabase.Note
- cliDatabase.MustScan(t, "finding cli book js", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cli book css", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote2JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js2"), &cliNote2JS.UUID, &cliNote2JS.Body, &cliNote2JS.USN)
- cliDatabase.MustScan(t, "finding cliNote1CSS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css1"), &cliNote1CSS.UUID, &cliNote1CSS.Body, &cliNote1CSS.USN)
-
- // assert on usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- assert.NotEqual(t, cliNote2JS.USN, 0, "cliNote2JS USN mismatch")
- assert.NotEqual(t, cliNote1CSS.USN, 0, "cliNote1CSS USN mismatch")
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliBookCSS.USN, 0, "cliBookCSS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote2JS.Body, "js2", "cliNote2JS Body mismatch")
- assert.Equal(t, cliNote1CSS.Body, "css1", "cliNote1CSS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote2JS.Deleted, false, "cliNote2JS Deleted mismatch")
- assert.Equal(t, cliNote1CSS.Deleted, false, "cliNote1CSS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
-
- // test server
- var apiBookJS, apiBookCSS database.Book
- var apiNote1JS, apiNote2JS, apiNote1CSS database.Note
- apitest.MustExec(t, env.ServerDB.Model(&database.Note{}).Where("uuid = ?", cliNote1JS.UUID).First(&apiNote1JS), "getting js1 note")
- apitest.MustExec(t, env.ServerDB.Model(&database.Note{}).Where("uuid = ?", cliNote2JS.UUID).First(&apiNote2JS), "getting js2 note")
- apitest.MustExec(t, env.ServerDB.Model(&database.Note{}).Where("uuid = ?", cliNote1CSS.UUID).First(&apiNote1CSS), "getting css1 note")
- apitest.MustExec(t, env.ServerDB.Model(&database.Book{}).Where("uuid = ?", cliBookJS.UUID).First(&apiBookJS), "getting js book")
- apitest.MustExec(t, env.ServerDB.Model(&database.Book{}).Where("uuid = ?", cliBookCSS.UUID).First(&apiBookCSS), "getting css book")
-
- // assert usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS usn mismatch")
- assert.NotEqual(t, apiNote2JS.USN, 0, "apiNote2JS usn mismatch")
- assert.NotEqual(t, apiNote1CSS.USN, 0, "apiNote1CSS usn mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS usn mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS usn mismatch")
- // client must have generated uuids
- assert.NotEqual(t, apiNote1JS.UUID, "", "apiNote1JS UUID mismatch")
- assert.NotEqual(t, apiNote2JS.UUID, "", "apiNote2JS UUID mismatch")
- assert.NotEqual(t, apiNote1CSS.UUID, "", "apiNote1CSS UUID mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiNote2JS.Deleted, false, "apiNote2JS Deleted mismatch")
- assert.Equal(t, apiNote1CSS.Deleted, false, "apiNote1CSS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
- // assert on body and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote2JS.Body, "js2", "apiNote2JS Body mismatch")
- assert.Equal(t, apiNote1CSS.Body, "css1", "apiNote1CSS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- }
-
- t.Run("stepSync", func(t *testing.T) {
-
- env := setupTestEnv(t)
- user := setupUserAndLogin(t, env)
- setup(t, env, user)
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- assert(t, env, user)
- })
-
- t.Run("fullSync", func(t *testing.T) {
-
- env := setupTestEnv(t)
- user := setupUserAndLogin(t, env)
- setup(t, env, user)
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync", "-f")
-
- assert(t, env, user)
- })
- })
-
- t.Run("cli to api with edit and delete", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) {
- apiDB := env.ServerDB
- apitest.MustExec(t, apiDB.Model(&user).Update("max_usn", 0), "updating user max_usn")
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js2")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js3")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css2")
-
- var nid, nid2 string
- cliDB := env.DB
- cliDatabase.MustScan(t, "getting id of note to edit", cliDB.QueryRow("SELECT rowid FROM notes WHERE body = ?", "js3"), &nid)
- cliDatabase.MustScan(t, "getting id of note to delete", cliDB.QueryRow("SELECT rowid FROM notes WHERE body = ?", "css2"), &nid2)
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", nid, "-c", "js3-edited")
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveNote, cliBinaryName, "remove", "css", nid2)
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css3")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css4")
- }
-
- assert := func(t *testing.T, env testEnv, user database.User) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 6,
- clientBookCount: 2,
- clientLastMaxUSN: 8,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 6,
- serverBookCount: 2,
- serverUserMaxUSN: 8,
- })
-
- // test cli
- var cliN1, cliN2, cliN3, cliN4, cliN5, cliN6 cliDatabase.Note
- var cliB1, cliB2 cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliN1", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliN1.UUID, &cliN1.Body, &cliN1.USN)
- cliDatabase.MustScan(t, "finding cliN2", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js2"), &cliN2.UUID, &cliN2.Body, &cliN2.USN)
- cliDatabase.MustScan(t, "finding cliN3", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js3-edited"), &cliN3.UUID, &cliN3.Body, &cliN3.USN)
- cliDatabase.MustScan(t, "finding cliN4", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css1"), &cliN4.UUID, &cliN4.Body, &cliN4.USN)
- cliDatabase.MustScan(t, "finding cliN5", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css3"), &cliN5.UUID, &cliN5.Body, &cliN5.USN)
- cliDatabase.MustScan(t, "finding cliN6", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css4"), &cliN6.UUID, &cliN6.Body, &cliN6.USN)
- cliDatabase.MustScan(t, "finding cliB1", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliB1.UUID, &cliB1.Label, &cliB1.USN)
- cliDatabase.MustScan(t, "finding cliB2", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliB2.UUID, &cliB2.Label, &cliB2.USN)
-
- // assert on usn
- assert.NotEqual(t, cliN1.USN, 0, "cliN1 USN mismatch")
- assert.NotEqual(t, cliN2.USN, 0, "cliN2 USN mismatch")
- assert.NotEqual(t, cliN3.USN, 0, "cliN3 USN mismatch")
- assert.NotEqual(t, cliN4.USN, 0, "cliN4 USN mismatch")
- assert.NotEqual(t, cliN5.USN, 0, "cliN5 USN mismatch")
- assert.NotEqual(t, cliN6.USN, 0, "cliN6 USN mismatch")
- assert.NotEqual(t, cliB1.USN, 0, "cliB1 USN mismatch")
- assert.NotEqual(t, cliB2.USN, 0, "cliB2 USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliN1.Body, "js1", "cliN1 Body mismatch")
- assert.Equal(t, cliN2.Body, "js2", "cliN2 Body mismatch")
- assert.Equal(t, cliN3.Body, "js3-edited", "cliN3 Body mismatch")
- assert.Equal(t, cliN4.Body, "css1", "cliN4 Body mismatch")
- assert.Equal(t, cliN5.Body, "css3", "cliN5 Body mismatch")
- assert.Equal(t, cliN6.Body, "css4", "cliN6 Body mismatch")
- assert.Equal(t, cliB1.Label, "js", "cliB1 Label mismatch")
- assert.Equal(t, cliB2.Label, "css", "cliB2 Label mismatch")
- // assert on deleted
- assert.Equal(t, cliN1.Deleted, false, "cliN1 Deleted mismatch")
- assert.Equal(t, cliN2.Deleted, false, "cliN2 Deleted mismatch")
- assert.Equal(t, cliN3.Deleted, false, "cliN3 Deleted mismatch")
- assert.Equal(t, cliN4.Deleted, false, "cliN4 Deleted mismatch")
- assert.Equal(t, cliN5.Deleted, false, "cliN5 Deleted mismatch")
- assert.Equal(t, cliN6.Deleted, false, "cliN6 Deleted mismatch")
- assert.Equal(t, cliB1.Deleted, false, "cliB1 Deleted mismatch")
- assert.Equal(t, cliB2.Deleted, false, "cliB2 Deleted mismatch")
-
- // test api
- var apiN1, apiN2, apiN3, apiN4, apiN5, apiN6 database.Note
- var apiB1, apiB2 database.Book
- apitest.MustExec(t, apiDB.Where("uuid = ?", cliN1.UUID).First(&apiN1), "finding apiN1")
- apitest.MustExec(t, apiDB.Where("uuid = ?", cliN2.UUID).First(&apiN2), "finding apiN2")
- apitest.MustExec(t, apiDB.Where("uuid = ?", cliN3.UUID).First(&apiN3), "finding apiN3")
- apitest.MustExec(t, apiDB.Where("uuid = ?", cliN4.UUID).First(&apiN4), "finding apiN4")
- apitest.MustExec(t, apiDB.Where("uuid = ?", cliN5.UUID).First(&apiN5), "finding apiN5")
- apitest.MustExec(t, apiDB.Where("uuid = ?", cliN6.UUID).First(&apiN6), "finding apiN6")
- apitest.MustExec(t, apiDB.Where("uuid = ?", cliB1.UUID).First(&apiB1), "finding apiB1")
- apitest.MustExec(t, apiDB.Where("uuid = ?", cliB2.UUID).First(&apiB2), "finding apiB2")
-
- // assert on usn
- assert.NotEqual(t, apiN1.USN, 0, "apiN1 usn mismatch")
- assert.NotEqual(t, apiN2.USN, 0, "apiN2 usn mismatch")
- assert.NotEqual(t, apiN3.USN, 0, "apiN3 usn mismatch")
- assert.NotEqual(t, apiN4.USN, 0, "apiN4 usn mismatch")
- assert.NotEqual(t, apiN5.USN, 0, "apiN5 usn mismatch")
- assert.NotEqual(t, apiN6.USN, 0, "apiN6 usn mismatch")
- assert.NotEqual(t, apiB1.USN, 0, "apiB1 usn mismatch")
- assert.NotEqual(t, apiB2.USN, 0, "apiB2 usn mismatch")
- // client must have generated uuids
- assert.NotEqual(t, apiN1.UUID, "", "apiN1 UUID mismatch")
- assert.NotEqual(t, apiN2.UUID, "", "apiN2 UUID mismatch")
- assert.NotEqual(t, apiN3.UUID, "", "apiN3 UUID mismatch")
- assert.NotEqual(t, apiN4.UUID, "", "apiN4 UUID mismatch")
- assert.NotEqual(t, apiN5.UUID, "", "apiN5 UUID mismatch")
- assert.NotEqual(t, apiN6.UUID, "", "apiN6 UUID mismatch")
- assert.NotEqual(t, apiB1.UUID, "", "apiB1 UUID mismatch")
- assert.NotEqual(t, apiB2.UUID, "", "apiB2 UUID mismatch")
- // assert on deleted
- assert.Equal(t, apiN1.Deleted, false, "apiN1 Deleted mismatch")
- assert.Equal(t, apiN2.Deleted, false, "apiN2 Deleted mismatch")
- assert.Equal(t, apiN3.Deleted, false, "apiN3 Deleted mismatch")
- assert.Equal(t, apiN4.Deleted, false, "apiN4 Deleted mismatch")
- assert.Equal(t, apiN5.Deleted, false, "apiN5 Deleted mismatch")
- assert.Equal(t, apiN6.Deleted, false, "apiN6 Deleted mismatch")
- assert.Equal(t, apiB1.Deleted, false, "apiB1 Deleted mismatch")
- assert.Equal(t, apiB2.Deleted, false, "apiB2 Deleted mismatch")
- // assert on body and labels
- assert.Equal(t, apiN1.Body, "js1", "apiN1 Body mismatch")
- assert.Equal(t, apiN2.Body, "js2", "apiN2 Body mismatch")
- assert.Equal(t, apiN3.Body, "js3-edited", "apiN3 Body mismatch")
- assert.Equal(t, apiN4.Body, "css1", "apiN4 Body mismatch")
- assert.Equal(t, apiN5.Body, "css3", "apiN5 Body mismatch")
- assert.Equal(t, apiN6.Body, "css4", "apiN6 Body mismatch")
- assert.Equal(t, apiB1.Label, "js", "apiB1 Label mismatch")
- assert.Equal(t, apiB2.Label, "css", "apiB2 Label mismatch")
- }
-
- t.Run("stepSync", func(t *testing.T) {
-
- env := setupTestEnv(t)
- user := setupUserAndLogin(t, env)
- setup(t, env, user)
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- assert(t, env, user)
- })
-
- t.Run("fullSync", func(t *testing.T) {
-
- env := setupTestEnv(t)
- user := setupUserAndLogin(t, env)
- setup(t, env, user)
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync", "-f")
-
- assert(t, env, user)
- })
- })
-
- t.Run("api to cli", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- apiDB := env.ServerDB
-
- apitest.MustExec(t, apiDB.Model(&user).Update("max_usn", 0), "updating user max_usn")
-
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding css book")
- cssNote1UUID := apiCreateNote(t, env, user, cssBookUUID, "css1", "adding css note 1")
- jsNote2UUID := apiCreateNote(t, env, user, jsBookUUID, "js2", "adding js note 2")
- cssNote2UUID := apiCreateNote(t, env, user, cssBookUUID, "css2", "adding css note 2")
- linuxBookUUID := apiCreateBook(t, env, user, "linux", "adding linux book")
- linuxNote1UUID := apiCreateNote(t, env, user, linuxBookUUID, "linux1", "adding linux note 1")
- apiPatchNote(t, env, user, jsNote2UUID, fmt.Sprintf(`{"book_uuid": "%s"}`, linuxBookUUID), "moving js note 2 to linux")
- apiDeleteNote(t, env, user, jsNote1UUID, "deleting js note 1")
- cssNote3UUID := apiCreateNote(t, env, user, cssBookUUID, "css3", "adding css note 3")
- bashBookUUID := apiCreateBook(t, env, user, "bash", "adding bash book")
- bashNote1UUID := apiCreateNote(t, env, user, bashBookUUID, "bash1", "adding bash note 1")
-
- // delete the linux book and its two notes
- apiDeleteBook(t, env, user, linuxBookUUID, "deleting linux book")
-
- apiPatchNote(t, env, user, cssNote2UUID, fmt.Sprintf(`{"content": "%s"}`, "css2-edited"), "editing css 2 body")
- bashNote2UUID := apiCreateNote(t, env, user, bashBookUUID, "bash2", "adding bash note 2")
- linuxBook2UUID := apiCreateBook(t, env, user, "linux", "adding new linux book")
- linux2Note1UUID := apiCreateNote(t, env, user, linuxBookUUID, "linux-new-1", "adding linux note 1")
- apiDeleteBook(t, env, user, jsBookUUID, "deleting js book")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- "jsNote2UUID": jsNote2UUID,
- "cssBookUUID": cssBookUUID,
- "cssNote1UUID": cssNote1UUID,
- "cssNote2UUID": cssNote2UUID,
- "cssNote3UUID": cssNote3UUID,
- "linuxBookUUID": linuxBookUUID,
- "linuxNote1UUID": linuxNote1UUID,
- "bashBookUUID": bashBookUUID,
- "bashNote1UUID": bashNote1UUID,
- "bashNote2UUID": bashNote2UUID,
- "linuxBook2UUID": linuxBook2UUID,
- "linux2Note1UUID": linux2Note1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 6,
- clientBookCount: 3,
- clientLastMaxUSN: 21,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 9,
- serverBookCount: 5,
- serverUserMaxUSN: 21,
- })
-
- // test server
- var apiNote1JS, apiNote2JS, apiNote1CSS, apiNote2CSS, apiNote3CSS, apiNote1Bash, apiNote2Bash, apiNote1Linux, apiNote2Linux, apiNote1LinuxDup database.Note
- var apiBookJS, apiBookCSS, apiBookBash, apiBookLinux, apiBookLinuxDup database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding api js note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote2UUID"]).First(&apiNote2JS), "finding api js note 2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssNote1UUID"]).First(&apiNote1CSS), "finding api css note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssNote2UUID"]).First(&apiNote2CSS), "finding api css note 2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssNote3UUID"]).First(&apiNote3CSS), "finding api css note 3")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["linuxNote1UUID"]).First(&apiNote1Linux), "finding api linux note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote2UUID"]).First(&apiNote2Linux), "finding api linux note 2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["bashNote1UUID"]).First(&apiNote1Bash), "finding api bash note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["bashNote2UUID"]).First(&apiNote2Bash), "finding api bash note 2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["linux2Note1UUID"]).First(&apiNote1LinuxDup), "finding api linux 2 note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding api js book")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding api css book")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["bashBookUUID"]).First(&apiBookBash), "finding api bash book")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["linuxBookUUID"]).First(&apiBookLinux), "finding api linux book")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["linuxBook2UUID"]).First(&apiBookLinuxDup), "finding api linux book 2")
-
- // assert on server Label
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiNote2JS.USN, 0, "apiNote2JS USN mismatch")
- assert.NotEqual(t, apiNote1CSS.USN, 0, "apiNote1CSS USN mismatch")
- assert.NotEqual(t, apiNote2CSS.USN, 0, "apiNote2CSS USN mismatch")
- assert.NotEqual(t, apiNote3CSS.USN, 0, "apiNote3CSS USN mismatch")
- assert.NotEqual(t, apiNote1Linux.USN, 0, "apiNote1Linux USN mismatch")
- assert.NotEqual(t, apiNote2Linux.USN, 0, "apiNote2Linux USN mismatch")
- assert.NotEqual(t, apiNote1Bash.USN, 0, "apiNote1Bash USN mismatch")
- assert.NotEqual(t, apiNote2Bash.USN, 0, "apiNote2Bash USN mismatch")
- assert.NotEqual(t, apiNote1LinuxDup.USN, 0, "apiNote1LinuxDup USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apibookJS USN mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apibookCSS USN mismatch")
- assert.NotEqual(t, apiBookBash.USN, 0, "apibookBash USN mismatch")
- assert.NotEqual(t, apiBookLinux.USN, 0, "apibookLinux USN mismatch")
- assert.NotEqual(t, apiBookLinuxDup.USN, 0, "apiBookLinuxDup USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote2JS.Body, "", "apiNote2JS Body mismatch")
- assert.Equal(t, apiNote1CSS.Body, "css1", "apiNote1CSS Body mismatch")
- assert.Equal(t, apiNote2CSS.Body, "css2-edited", "apiNote2CSS Body mismatch")
- assert.Equal(t, apiNote3CSS.Body, "css3", "apiNote3CSS Body mismatch")
- assert.Equal(t, apiNote1Linux.Body, "", "apiNote1Linux Body mismatch")
- assert.Equal(t, apiNote2Linux.Body, "", "apiNote2Linux Body mismatch")
- assert.Equal(t, apiNote1Bash.Body, "bash1", "apiNote1Bash Body mismatch")
- assert.Equal(t, apiNote2Bash.Body, "bash2", "apiNote2Bash Body mismatch")
- assert.Equal(t, apiNote1LinuxDup.Body, "linux-new-1", "apiNote1LinuxDup Body mismatch")
- assert.Equal(t, apiBookJS.Label, "", "apibookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apibookCSS Label mismatch")
- assert.Equal(t, apiBookBash.Label, "bash", "apibookBash Label mismatch")
- assert.Equal(t, apiBookLinux.Label, "", "apibookLinux Label mismatch")
- assert.Equal(t, apiBookLinuxDup.Label, "linux", "apiBookLinuxDup Label mismatch")
- // assert on uuids
- assert.NotEqual(t, apiNote1JS.UUID, "", "apiNote1JS UUID mismatch")
- assert.NotEqual(t, apiNote2JS.UUID, "", "apiNote2JS UUID mismatch")
- assert.NotEqual(t, apiNote1CSS.UUID, "", "apiNote1CSS UUID mismatch")
- assert.NotEqual(t, apiNote2CSS.UUID, "", "apiNote2CSS UUID mismatch")
- assert.NotEqual(t, apiNote3CSS.UUID, "", "apiNote3CSS UUID mismatch")
- assert.NotEqual(t, apiNote1Linux.UUID, "", "apiNote1Linux UUID mismatch")
- assert.NotEqual(t, apiNote2Linux.UUID, "", "apiNote2Linux UUID mismatch")
- assert.NotEqual(t, apiNote1Bash.UUID, "", "apiNote1Bash UUID mismatch")
- assert.NotEqual(t, apiNote2Bash.UUID, "", "apiNote2Bash UUID mismatch")
- assert.NotEqual(t, apiNote2Bash.UUID, "", "apiNote2Bash UUID mismatch")
- assert.NotEqual(t, apiBookJS.UUID, "", "apibookJS UUID mismatch")
- assert.NotEqual(t, apiBookCSS.UUID, "", "apibookCSS UUID mismatch")
- assert.NotEqual(t, apiBookBash.UUID, "", "apibookBash UUID mismatch")
- assert.NotEqual(t, apiBookLinux.UUID, "", "apibookLinux UUID mismatch")
- assert.NotEqual(t, apiBookLinuxDup.UUID, "", "apiBookLinuxDup UUID mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiNote2JS.Deleted, true, "apiNote2JS Deleted mismatch")
- assert.Equal(t, apiNote1CSS.Deleted, false, "apiNote1CSS Deleted mismatch")
- assert.Equal(t, apiNote2CSS.Deleted, false, "apiNote2CSS Deleted mismatch")
- assert.Equal(t, apiNote3CSS.Deleted, false, "apiNote3CSS Deleted mismatch")
- assert.Equal(t, apiNote1Linux.Deleted, true, "apiNote1Linux Deleted mismatch")
- assert.Equal(t, apiNote2Linux.Deleted, true, "apiNote2Linux Deleted mismatch")
- assert.Equal(t, apiNote1Bash.Deleted, false, "apiNote1Bash Deleted mismatch")
- assert.Equal(t, apiNote2Bash.Deleted, false, "apiNote2Bash Deleted mismatch")
- assert.Equal(t, apiNote2Bash.Deleted, false, "apiNote2Bash Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, true, "apibookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apibookCSS Deleted mismatch")
- assert.Equal(t, apiBookBash.Deleted, false, "apibookBash Deleted mismatch")
- assert.Equal(t, apiBookLinux.Deleted, true, "apibookLinux Deleted mismatch")
- assert.Equal(t, apiBookLinuxDup.Deleted, false, "apiBookLinuxDup Deleted mismatch")
-
- // test client
- var cliBookCSS, cliBookBash, cliBookLinux cliDatabase.Book
- var cliNote1CSS, cliNote2CSS, cliNote3CSS, cliNote1Bash, cliNote2Bash, cliNote1Linux cliDatabase.Note
- cliDatabase.MustScan(t, "finding cli book css", cliDB.QueryRow("SELECT label FROM books WHERE uuid = ?", ids["cssBookUUID"]), &cliBookCSS.Label)
- cliDatabase.MustScan(t, "finding cli book bash", cliDB.QueryRow("SELECT label FROM books WHERE uuid = ?", ids["bashBookUUID"]), &cliBookBash.Label)
- cliDatabase.MustScan(t, "finding cli book linux2", cliDB.QueryRow("SELECT label FROM books WHERE uuid = ?", ids["linuxBook2UUID"]), &cliBookLinux.Label)
- cliDatabase.MustScan(t, "finding cliNote1CSS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", apiNote1CSS.UUID), &cliNote1CSS.Body, &cliNote1CSS.USN)
- cliDatabase.MustScan(t, "finding cliNote2CSS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", apiNote2CSS.UUID), &cliNote2CSS.Body, &cliNote2CSS.USN)
- cliDatabase.MustScan(t, "finding cliNote3CSS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", apiNote3CSS.UUID), &cliNote3CSS.Body, &cliNote3CSS.USN)
- cliDatabase.MustScan(t, "finding cliNote1Bash", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", apiNote1Bash.UUID), &cliNote1Bash.Body, &cliNote1Bash.USN)
- cliDatabase.MustScan(t, "finding cliNote2Bash", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", apiNote2Bash.UUID), &cliNote2Bash.Body, &cliNote2Bash.USN)
- cliDatabase.MustScan(t, "finding cliNote2Bash", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", apiNote1LinuxDup.UUID), &cliNote1Linux.Body, &cliNote1Linux.USN)
-
- // assert on usn
- assert.NotEqual(t, cliNote1CSS.USN, 0, "cliNote1CSS usn mismatch")
- assert.NotEqual(t, cliNote2CSS.USN, 0, "cliNote2CSS usn mismatch")
- assert.NotEqual(t, cliNote3CSS.USN, 0, "cliNote3CSS usn mismatch")
- assert.NotEqual(t, cliNote1Bash.USN, 0, "cliNote1Bash usn mismatch")
- assert.NotEqual(t, cliNote2Bash.USN, 0, "cliNote2Bash usn mismatch")
- assert.NotEqual(t, cliNote1Linux.USN, 0, "cliNote1Linux usn mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1CSS.Body, "css1", "cliNote1CSS Body mismatch")
- assert.Equal(t, cliNote2CSS.Body, "css2-edited", "cliNote2CSS Body mismatch")
- assert.Equal(t, cliNote3CSS.Body, "css3", "cliNote3CSS Body mismatch")
- assert.Equal(t, cliNote1Bash.Body, "bash1", "cliNote1Bash Body mismatch")
- assert.Equal(t, cliNote2Bash.Body, "bash2", "cliNote2Bash Body mismatch")
- assert.Equal(t, cliNote1Linux.Body, "linux-new-1", "cliNote1Linux Body mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- assert.Equal(t, cliBookBash.Label, "bash", "cliBookBash Label mismatch")
- assert.Equal(t, cliBookLinux.Label, "linux", "cliBookLinux Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1CSS.Deleted, false, "cliNote1CSS Deleted mismatch")
- assert.Equal(t, cliNote2CSS.Deleted, false, "cliNote2CSS Deleted mismatch")
- assert.Equal(t, cliNote3CSS.Deleted, false, "cliNote3CSS Deleted mismatch")
- assert.Equal(t, cliNote1Bash.Deleted, false, "cliNote1Bash Deleted mismatch")
- assert.Equal(t, cliNote2Bash.Deleted, false, "cliNote2Bash Deleted mismatch")
- assert.Equal(t, cliNote1Linux.Deleted, false, "cliNote1Linux Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- assert.Equal(t, cliBookBash.Deleted, false, "cliBookBash Deleted mismatch")
- assert.Equal(t, cliBookLinux.Deleted, false, "cliBookLinux Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-}
-
-func TestSync_twoway(t *testing.T) {
- t.Run("once", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- cliDB := env.DB
-
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding css book")
- cssNote1UUID := apiCreateNote(t, env, user, cssBookUUID, "css1", "adding css note 1")
- jsNote2UUID := apiCreateNote(t, env, user, jsBookUUID, "js2", "adding js note 2")
- cssNote2UUID := apiCreateNote(t, env, user, cssBookUUID, "css2", "adding css note 2")
- linuxBookUUID := apiCreateBook(t, env, user, "linux", "adding linux book")
- linuxNote1UUID := apiCreateNote(t, env, user, linuxBookUUID, "linux1", "adding linux note 1")
- apiPatchNote(t, env, user, jsNote2UUID, fmt.Sprintf(`{"book_uuid": "%s"}`, linuxBookUUID), "moving js note 2 to linux")
- apiDeleteNote(t, env, user, jsNote1UUID, "deleting js note 1")
- cssNote3UUID := apiCreateNote(t, env, user, cssBookUUID, "css3", "adding css note 3")
- bashBookUUID := apiCreateBook(t, env, user, "bash", "adding bash book")
- bashNote1UUID := apiCreateNote(t, env, user, bashBookUUID, "bash1", "adding bash note 1")
- apiDeleteBook(t, env, user, linuxBookUUID, "deleting linux book")
- apiPatchNote(t, env, user, cssNote2UUID, fmt.Sprintf(`{"content": "%s"}`, "css2-edited"), "editing css 2 body")
- bashNote2UUID := apiCreateNote(t, env, user, bashBookUUID, "bash2", "adding bash note 2")
- linuxBook2UUID := apiCreateBook(t, env, user, "linux", "adding new linux book")
- linux2Note1UUID := apiCreateNote(t, env, user, linuxBookUUID, "linux-new-1", "adding linux note 1")
- apiDeleteBook(t, env, user, jsBookUUID, "deleting js book")
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js3")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "algorithms", "-c", "algorithms1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js4")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "algorithms", "-c", "algorithms2")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "math", "-c", "math1")
-
- var nid string
- cliDatabase.MustScan(t, "getting id of note to remove", cliDB.QueryRow("SELECT rowid FROM notes WHERE body = ?", "js3"), &nid)
-
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveBook, cliBinaryName, "remove", "algorithms")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css4")
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveNote, cliBinaryName, "remove", "js", nid)
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- "jsNote2UUID": jsNote2UUID,
- "cssBookUUID": cssBookUUID,
- "cssNote1UUID": cssNote1UUID,
- "cssNote2UUID": cssNote2UUID,
- "cssNote3UUID": cssNote3UUID,
- "linuxBookUUID": linuxBookUUID,
- "linuxNote1UUID": linuxNote1UUID,
- "bashBookUUID": bashBookUUID,
- "bashNote1UUID": bashNote1UUID,
- "bashNote2UUID": bashNote2UUID,
- "linuxBook2UUID": linuxBook2UUID,
- "linux2Note1UUID": linux2Note1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 9,
- clientBookCount: 6,
- clientLastMaxUSN: 27,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 12,
- serverBookCount: 8,
- serverUserMaxUSN: 27,
- })
-
- // test client
- var cliNote1CSS, cliNote2CSS, cliNote3CSS, cliNote1CSS2, cliNote1Bash, cliNote2Bash, cliNote1Linux, cliNote1Math, cliNote1JS cliDatabase.Note
- var cliBookCSS, cliBookCSS2, cliBookBash, cliBookLinux, cliBookMath, cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1CSS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css1"), &cliNote1CSS.UUID, &cliNote1CSS.Body, &cliNote1CSS.USN)
- cliDatabase.MustScan(t, "finding cliNote2CSS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css2-edited"), &cliNote2CSS.UUID, &cliNote2CSS.Body, &cliNote2CSS.USN)
- cliDatabase.MustScan(t, "finding cliNote3CSS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css3"), &cliNote3CSS.UUID, &cliNote3CSS.Body, &cliNote3CSS.USN)
- cliDatabase.MustScan(t, "finding cliNote1CSS2", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css4"), &cliNote1CSS2.UUID, &cliNote1CSS2.Body, &cliNote1CSS2.USN)
- cliDatabase.MustScan(t, "finding cliNote1Bash", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "bash1"), &cliNote1Bash.UUID, &cliNote1Bash.Body, &cliNote1Bash.USN)
- cliDatabase.MustScan(t, "finding cliNote2Bash", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "bash2"), &cliNote2Bash.UUID, &cliNote2Bash.Body, &cliNote2Bash.USN)
- cliDatabase.MustScan(t, "finding cliNote1Linux", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "linux-new-1"), &cliNote1Linux.UUID, &cliNote1Linux.Body, &cliNote1Linux.USN)
- cliDatabase.MustScan(t, "finding cliNote1Math", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "math1"), &cliNote1Math.UUID, &cliNote1Math.Body, &cliNote1Math.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js4"), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS2", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css_2"), &cliBookCSS2.UUID, &cliBookCSS2.Label, &cliBookCSS2.USN)
- cliDatabase.MustScan(t, "finding cliBookBash", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "bash"), &cliBookBash.UUID, &cliBookBash.Label, &cliBookBash.USN)
- cliDatabase.MustScan(t, "finding cliBookLinux", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "linux"), &cliBookLinux.UUID, &cliBookLinux.Label, &cliBookLinux.USN)
- cliDatabase.MustScan(t, "finding cliBookMath", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "math"), &cliBookMath.UUID, &cliBookMath.Label, &cliBookMath.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1CSS.USN, 0, "cliNote1CSS USN mismatch")
- assert.NotEqual(t, cliNote2CSS.USN, 0, "cliNote2CSS USN mismatch")
- assert.NotEqual(t, cliNote3CSS.USN, 0, "cliNote3CSS USN mismatch")
- assert.NotEqual(t, cliNote1CSS2.USN, 0, "cliNote1CSS2 USN mismatch")
- assert.NotEqual(t, cliNote1Bash.USN, 0, "cliNote1Bash USN mismatch")
- assert.NotEqual(t, cliNote2Bash.USN, 0, "cliNote2Bash USN mismatch")
- assert.NotEqual(t, cliNote1Linux.USN, 0, "cliNote1Linux USN mismatch")
- assert.NotEqual(t, cliNote1Math.USN, 0, "cliNote1Math USN mismatch")
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- assert.NotEqual(t, cliBookCSS.USN, 0, "cliBookCSS USN mismatch")
- assert.NotEqual(t, cliBookCSS2.USN, 0, "cliBookCSS2 USN mismatch")
- assert.NotEqual(t, cliBookBash.USN, 0, "cliBookBash USN mismatch")
- assert.NotEqual(t, cliBookMath.USN, 0, "cliBookMath USN mismatch")
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1CSS.Body, "css1", "cliNote1CSS Body mismatch")
- assert.Equal(t, cliNote2CSS.Body, "css2-edited", "cliNote2CSS Body mismatch")
- assert.Equal(t, cliNote3CSS.Body, "css3", "cliNote3CSS Body mismatch")
- assert.Equal(t, cliNote1CSS2.Body, "css4", "cliNote1CSS2 Body mismatch")
- assert.Equal(t, cliNote1Bash.Body, "bash1", "cliNote1Bash Body mismatch")
- assert.Equal(t, cliNote2Bash.Body, "bash2", "cliNote2Bash Body mismatch")
- assert.Equal(t, cliNote1Linux.Body, "linux-new-1", "cliNote1Linux Body mismatch")
- assert.Equal(t, cliNote1Math.Body, "math1", "cliNote1Math Body mismatch")
- assert.Equal(t, cliNote1JS.Body, "js4", "cliNote1JS Body mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- assert.Equal(t, cliBookCSS2.Label, "css_2", "cliBookCSS2 Label mismatch")
- assert.Equal(t, cliBookBash.Label, "bash", "cliBookBash Label mismatch")
- assert.Equal(t, cliBookMath.Label, "math", "cliBookMath Label mismatch")
- assert.Equal(t, cliBookLinux.Label, "linux", "cliBookLinux Label mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1CSS.Deleted, false, "cliNote1CSS Deleted mismatch")
- assert.Equal(t, cliNote2CSS.Deleted, false, "cliNote2CSS Deleted mismatch")
- assert.Equal(t, cliNote3CSS.Deleted, false, "cliNote3CSS Deleted mismatch")
- assert.Equal(t, cliNote1CSS2.Deleted, false, "cliNote1CSS2 Deleted mismatch")
- assert.Equal(t, cliNote1Bash.Deleted, false, "cliNote1Bash Deleted mismatch")
- assert.Equal(t, cliNote2Bash.Deleted, false, "cliNote2Bash Deleted mismatch")
- assert.Equal(t, cliNote1Linux.Deleted, false, "cliNote1Linux Deleted mismatch")
- assert.Equal(t, cliNote1Math.Deleted, false, "cliNote1Math Deleted mismatch")
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- assert.Equal(t, cliBookCSS2.Deleted, false, "cliBookCSS2 Deleted mismatch")
- assert.Equal(t, cliBookBash.Deleted, false, "cliBookBash Deleted mismatch")
- assert.Equal(t, cliBookMath.Deleted, false, "cliBookMath Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
-
- // test server
- var apiNote1JS, apiNote1CSS, apiNote2CSS, apiNote3CSS, apiNote1Linux, apiNote2Linux, apiNote1Bash, apiNote2Bash, apiNote1LinuxDup, apiNote1CSS2, apiNote1Math, apiNote1JS2 database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding api js note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssNote1UUID"]).First(&apiNote1CSS), "finding api css note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssNote2UUID"]).First(&apiNote2CSS), "finding api css note 2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssNote3UUID"]).First(&apiNote3CSS), "finding api css note 3")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["linuxNote1UUID"]).First(&apiNote1Linux), "finding api linux note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote2UUID"]).First(&apiNote2Linux), "finding api linux note 2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["bashNote1UUID"]).First(&apiNote1Bash), "finding api bash note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["bashNote2UUID"]).First(&apiNote2Bash), "finding api bash note 2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["linux2Note1UUID"]).First(&apiNote1LinuxDup), "finding api linux 2 note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1CSS2.UUID).First(&apiNote1CSS2), "finding apiNote1CSS2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1Math.UUID).First(&apiNote1Math), "finding apiNote1Math")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1JS.UUID).First(&apiNote1JS2), "finding apiNote1JS2")
- var apiBookJS, apiBookCSS, apiBookLinux, apiBookBash, apiBookLinuxDup, apiBookCSS2, apiBookMath, apiBookJS2 database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding api js book")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding api css book")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["bashBookUUID"]).First(&apiBookBash), "finding api bash book")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["linuxBookUUID"]).First(&apiBookLinux), "finding api linux book")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["linuxBook2UUID"]).First(&apiBookLinuxDup), "finding api linux book 2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookCSS2.UUID).First(&apiBookCSS2), "finding apiBookCSS2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookMath.UUID).First(&apiBookMath), "finding apiBookMath")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookJS.UUID).First(&apiBookJS2), "finding apiBookJS2")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS usn mismatch")
- assert.NotEqual(t, apiNote1CSS.USN, 0, "apiNote1CSS usn mismatch")
- assert.NotEqual(t, apiNote2CSS.USN, 0, "apiNote2CSS usn mismatch")
- assert.NotEqual(t, apiNote3CSS.USN, 0, "apiNote3CSS usn mismatch")
- assert.NotEqual(t, apiNote1Linux.USN, 0, "apiNote1Linux usn mismatch")
- assert.NotEqual(t, apiNote2Linux.USN, 0, "apiNote2Linux usn mismatch")
- assert.NotEqual(t, apiNote1Bash.USN, 0, "apiNote1Bash usn mismatch")
- assert.NotEqual(t, apiNote2Bash.USN, 0, "apiNote2Bash usn mismatch")
- assert.NotEqual(t, apiNote1LinuxDup.USN, 0, "apiNote1LinuxDup usn mismatch")
- assert.NotEqual(t, apiNote1CSS2.USN, 0, "apiNoteCSS2 usn mismatch")
- assert.NotEqual(t, apiNote1Math.USN, 0, "apiNote1Math usn mismatch")
- assert.NotEqual(t, apiNote1JS2.USN, 0, "apiNote1JS2 usn mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS usn mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS usn mismatch")
- assert.NotEqual(t, apiBookLinux.USN, 0, "apiBookLinux usn mismatch")
- assert.NotEqual(t, apiBookBash.USN, 0, "apiBookBash usn mismatch")
- assert.NotEqual(t, apiBookLinuxDup.USN, 0, "apiBookLinuxDup usn mismatch")
- assert.NotEqual(t, apiBookCSS2.USN, 0, "apiBookCSS2 usn mismatch")
- assert.NotEqual(t, apiBookMath.USN, 0, "apiBookMath usn mismatch")
- assert.NotEqual(t, apiBookJS2.USN, 0, "apiBookJS2 usn mismatch")
- // assert on note bodys
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1CSS.Body, "css1", "apiNote1CSS Body mismatch")
- assert.Equal(t, apiNote2CSS.Body, "css2-edited", "apiNote2CSS Body mismatch")
- assert.Equal(t, apiNote3CSS.Body, "css3", "apiNote3CSS Body mismatch")
- assert.Equal(t, apiNote1Linux.Body, "", "apiNote1Linux Body mismatch")
- assert.Equal(t, apiNote2Linux.Body, "", "apiNote2Linux Body mismatch")
- assert.Equal(t, apiNote1Bash.Body, "bash1", "apiNote1Bash Body mismatch")
- assert.Equal(t, apiNote2Bash.Body, "bash2", "apiNote2Bash Body mismatch")
- assert.Equal(t, apiNote1LinuxDup.Body, "linux-new-1", "apiNote1LinuxDup Body mismatch")
- assert.Equal(t, apiNote1CSS2.Body, "css4", "apiNote1CSS2 Body mismatch")
- assert.Equal(t, apiNote1Math.Body, "math1", "apiNote1Math Body mismatch")
- assert.Equal(t, apiNote1JS2.Body, "js4", "apiNote1JS2 Body mismatch")
- // client must have generated uuids
- assert.NotEqual(t, apiNote1CSS2.UUID, "", "apiNote1CSS2 uuid mismatch")
- assert.NotEqual(t, apiNote1Math.UUID, "", "apiNote1Math uuid mismatch")
- assert.NotEqual(t, apiNote1JS2.UUID, "", "apiNote1JS2 uuid mismatch")
- // assert on labels
- assert.Equal(t, apiBookJS.Label, "", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- assert.Equal(t, apiBookLinux.Label, "", "apiBookLinux Label mismatch")
- assert.Equal(t, apiBookBash.Label, "bash", "apiBookBash Label mismatch")
- assert.Equal(t, apiBookLinuxDup.Label, "linux", "apiBookLinuxDup Label mismatch")
- assert.Equal(t, apiBookCSS2.Label, "css_2", "apiBookCSS2 Label mismatch")
- assert.Equal(t, apiBookMath.Label, "math", "apiBookMath Label mismatch")
- assert.Equal(t, apiBookJS2.Label, "js", "apiBookJS2 Label mismatch")
- // assert on note deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiNote1CSS.Deleted, false, "apiNote1CSS Deleted mismatch")
- assert.Equal(t, apiNote2CSS.Deleted, false, "apiNote2CSS Deleted mismatch")
- assert.Equal(t, apiNote3CSS.Deleted, false, "apiNote3CSS Deleted mismatch")
- assert.Equal(t, apiNote1Linux.Deleted, true, "apiNote1Linux Deleted mismatch")
- assert.Equal(t, apiNote2Linux.Deleted, true, "apiNote2Linux Deleted mismatch")
- assert.Equal(t, apiNote1Bash.Deleted, false, "apiNote1Bash Deleted mismatch")
- assert.Equal(t, apiNote2Bash.Deleted, false, "apiNote2Bash Deleted mismatch")
- assert.Equal(t, apiNote1LinuxDup.Deleted, false, "apiNote1LinuxDup Deleted mismatch")
- assert.Equal(t, apiNote1CSS2.Deleted, false, "apiNote1CSS2 Deleted mismatch")
- assert.Equal(t, apiNote1Math.Deleted, false, "apiNote1Math Deleted mismatch")
- assert.Equal(t, apiNote1JS2.Deleted, false, "apiNote1JS2 Deleted mismatch")
- // assert on book deleted
- assert.Equal(t, apiBookJS.Deleted, true, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
- assert.Equal(t, apiBookLinux.Deleted, true, "apiBookLinux Deleted mismatch")
- assert.Equal(t, apiBookBash.Deleted, false, "apiBookBash Deleted mismatch")
- assert.Equal(t, apiBookLinuxDup.Deleted, false, "apiBookLinuxDup Deleted mismatch")
- assert.Equal(t, apiBookCSS2.Deleted, false, "apiBookCSS2 Deleted mismatch")
- assert.Equal(t, apiBookMath.Deleted, false, "apiBookMath Deleted mismatch")
- assert.Equal(t, apiBookJS2.Deleted, false, "apiBookJS2 Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("twice", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
-
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding css book")
- cssNote1UUID := apiCreateNote(t, env, user, cssBookUUID, "css1", "adding css note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js2")
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveBook, cliBinaryName, "remove", "js")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "math", "-c", "math1")
-
- var nid string
- cliDB := env.DB
- cliDatabase.MustScan(t, "getting id of note to edit", cliDB.QueryRow("SELECT rowid FROM notes WHERE body = ?", "math1"), &nid)
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "math", nid, "-c", "math1-edited")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- scssBookUUID := apiCreateBook(t, env, user, "scss", "adding a scss book")
- apiPatchNote(t, env, user, cssNote1UUID, fmt.Sprintf(`{"book_uuid": "%s"}`, scssBookUUID), "moving css note 1 to scss")
-
- var n1UUID string
- cliDatabase.MustScan(t, "getting math1-edited note UUID", cliDB.QueryRow("SELECT uuid FROM notes WHERE body = ?", "math1-edited"), &n1UUID)
- apiPatchNote(t, env, user, n1UUID, fmt.Sprintf(`{"content": "%s", "public": true}`, "math1-edited"), "editing math1 note")
-
- cssNote2UUID := apiCreateNote(t, env, user, cssBookUUID, "css2", "adding css note 2")
- apiDeleteBook(t, env, user, cssBookUUID, "deleting css book")
-
- bashBookUUID := apiCreateBook(t, env, user, "bash", "adding a bash book")
- algorithmsBookUUID := apiCreateBook(t, env, user, "algorithms", "adding a algorithms book")
-
- // 4. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js3")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "algorithms", "-c", "algorithms1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- "cssBookUUID": cssBookUUID,
- "scssBookUUID": scssBookUUID,
- "cssNote1UUID": cssNote1UUID,
- "cssNote2UUID": cssNote2UUID,
- "bashBookUUID": bashBookUUID,
- "algorithmsBookUUID": algorithmsBookUUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- apiDB := env.ServerDB
- cliDB := env.DB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 5,
- clientBookCount: 6,
- clientLastMaxUSN: 17,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 6,
- serverBookCount: 7,
- serverUserMaxUSN: 17,
- })
-
- // test client
- var cliNote1JS, cliNote2JS, cliNote1SCSS, cliNote1Math, cliNote1Alg2 cliDatabase.Note
- var cliBookJS, cliBookSCSS, cliBookMath, cliBookBash, cliBookAlg, cliBookAlg2 cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote2JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js3"), &cliNote2JS.UUID, &cliNote2JS.Body, &cliNote2JS.USN)
- cliDatabase.MustScan(t, "finding cliNote1SCSS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css1"), &cliNote1SCSS.UUID, &cliNote1SCSS.Body, &cliNote1SCSS.USN)
- cliDatabase.MustScan(t, "finding cliNote1Math", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "math1-edited"), &cliNote1Math.UUID, &cliNote1Math.Body, &cliNote1Math.USN)
- cliDatabase.MustScan(t, "finding cliNote1Alg2", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "algorithms1"), &cliNote1Alg2.UUID, &cliNote1Alg2.Body, &cliNote1Alg2.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliBookSCSS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "scss"), &cliBookSCSS.UUID, &cliBookSCSS.Label, &cliBookSCSS.USN)
- cliDatabase.MustScan(t, "finding cliBookMath", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "math"), &cliBookMath.UUID, &cliBookMath.Label, &cliBookMath.USN)
- cliDatabase.MustScan(t, "finding cliBookBash", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "bash"), &cliBookBash.UUID, &cliBookBash.Label, &cliBookBash.USN)
- cliDatabase.MustScan(t, "finding cliBookAlg", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "algorithms"), &cliBookAlg.UUID, &cliBookAlg.Label, &cliBookAlg.USN)
- cliDatabase.MustScan(t, "finding cliBookAlg2", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "algorithms_2"), &cliBookAlg2.UUID, &cliBookAlg2.Label, &cliBookAlg2.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- assert.NotEqual(t, cliNote2JS.USN, 0, "cliNote2JS USN mismatch")
- assert.NotEqual(t, cliNote1SCSS.USN, 0, "cliNote1SCSS USN mismatch")
- assert.NotEqual(t, cliNote1Math.USN, 0, "cliNote1Math USN mismatch")
- assert.NotEqual(t, cliNote1Alg2.USN, 0, "cliNote1Alg2 USN mismatch")
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliBookSCSS.USN, 0, "cliBookSCSS USN mismatch")
- assert.NotEqual(t, cliBookMath.USN, 0, "cliBookMath USN mismatch")
- assert.NotEqual(t, cliBookBash.USN, 0, "cliBookBash USN mismatch")
- assert.NotEqual(t, cliBookAlg.USN, 0, "cliBookAlg USN mismatch")
- assert.NotEqual(t, cliBookAlg2.USN, 0, "cliBookAlg2 USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote2JS.Body, "js3", "cliNote2JS Body mismatch")
- assert.Equal(t, cliNote1SCSS.Body, "css1", "cliNote1SCSS Body mismatch")
- assert.Equal(t, cliNote1Math.Body, "math1-edited", "cliNote1Math Body mismatch")
- assert.Equal(t, cliNote1Alg2.Body, "algorithms1", "cliNote1Alg2 Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookSCSS.Label, "scss", "cliBookSCSS Label mismatch")
- assert.Equal(t, cliBookMath.Label, "math", "cliBookMath Label mismatch")
- assert.Equal(t, cliBookBash.Label, "bash", "cliBookBash Label mismatch")
- assert.Equal(t, cliBookAlg.Label, "algorithms", "cliBookAlg Label mismatch")
- assert.Equal(t, cliBookAlg2.Label, "algorithms_2", "cliBookAlg2 Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote2JS.Deleted, false, "cliNote2JS Deleted mismatch")
- assert.Equal(t, cliNote1SCSS.Deleted, false, "cliNote1SCSS Deleted mismatch")
- assert.Equal(t, cliNote1Math.Deleted, false, "cliNote1Math Deleted mismatch")
- assert.Equal(t, cliNote1Alg2.Deleted, false, "cliNote1Alg2 Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookSCSS.Deleted, false, "cliBookSCSS Deleted mismatch")
- assert.Equal(t, cliBookMath.Deleted, false, "cliBookMath Deleted mismatch")
- assert.Equal(t, cliBookBash.Deleted, false, "cliBookBash Deleted mismatch")
- assert.Equal(t, cliBookAlg.Deleted, false, "cliBookAlg Deleted mismatch")
- assert.Equal(t, cliBookAlg2.Deleted, false, "cliBookAlg2 Deleted mismatch")
-
- // test server
- var apiNote1JS, apiNote2JS, apiNote1SCSS, apiNote2CSS, apiNote1Math, apiNote1Alg database.Note
- var apiBookJS, apiBookCSS, apiBookSCSS, apiBookMath, apiBookBash, apiBookAlg, apiBookAlg2 database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssNote2UUID"]).First(&apiNote2CSS), "finding apiNote2CSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote2JS.UUID).First(&apiNote2JS), "finding apiNote2JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssNote1UUID"]).First(&apiNote1SCSS), "finding apiNote1SCSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1Math.UUID).First(&apiNote1Math), "finding apiNote1Math")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1Alg2.UUID).First(&apiNote1Alg), "finding apiNote1Alg")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding apiBookCSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["bashBookUUID"]).First(&apiBookBash), "finding apiBookBash")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["scssBookUUID"]).First(&apiBookSCSS), "finding apiBookSCSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["algorithmsBookUUID"]).First(&apiBookAlg), "finding apiBookAlg")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookAlg2.UUID).First(&apiBookAlg2), "finding apiBookAlg2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookMath.UUID).First(&apiBookMath), "finding apiBookMath")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS usn mismatch")
- assert.NotEqual(t, apiNote2JS.USN, 0, "apiNote1JS usn mismatch")
- assert.NotEqual(t, apiNote1SCSS.USN, 0, "apiNote1JS usn mismatch")
- assert.NotEqual(t, apiNote2CSS.USN, 0, "apiNote1JS usn mismatch")
- assert.NotEqual(t, apiNote1Math.USN, 0, "apiNote1JS usn mismatch")
- assert.NotEqual(t, apiNote1Alg.USN, 0, "apiNote1JS usn mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBook1Alg usn mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS usn mismatch")
- assert.NotEqual(t, apiBookSCSS.USN, 0, "apibookSCSS usn mismatch")
- assert.NotEqual(t, apiBookMath.USN, 0, "apiBookMath usn mismatch")
- assert.NotEqual(t, apiBookBash.USN, 0, "apiBookBash usn mismatch")
- assert.NotEqual(t, apiBookAlg.USN, 0, "apiBookAlg usn mismatch")
- assert.NotEqual(t, apiBookAlg2.USN, 0, "apiBookAlg2 usn mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote2JS.Body, "js3", "apiNote2JS Body mismatch")
- assert.Equal(t, apiNote1SCSS.Body, "css1", "apiNote1SCSS Body mismatch")
- assert.Equal(t, apiNote2CSS.Body, "", "apiNote2CSS Body mismatch")
- assert.Equal(t, apiNote1Math.Body, "math1-edited", "apiNote1Math Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "", "apiBookCSS Label mismatch")
- assert.Equal(t, apiBookSCSS.Label, "scss", "apiBookSCSS Label mismatch")
- assert.Equal(t, apiBookMath.Label, "math", "apiBookMath Label mismatch")
- assert.Equal(t, apiBookBash.Label, "bash", "apiBookBash Label mismatch")
- assert.Equal(t, apiBookAlg.Label, "algorithms", "apiBookAlg Label mismatch")
- assert.Equal(t, apiBookAlg2.Label, "algorithms_2", "apiBookAlg2 Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiNote2JS.Deleted, false, "apiNote2JS Deleted mismatch")
- assert.Equal(t, apiNote1SCSS.Deleted, false, "apiNote1SCSS Deleted mismatch")
- assert.Equal(t, apiNote2CSS.Deleted, true, "apiNote2CSS Deleted mismatch")
- assert.Equal(t, apiNote1Math.Deleted, false, "apiNote1Math Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, true, "apiBookCSS Deleted mismatch")
- assert.Equal(t, apiBookSCSS.Deleted, false, "apiBookSCSS Deleted mismatch")
- assert.Equal(t, apiBookMath.Deleted, false, "apiBookMath Deleted mismatch")
- assert.Equal(t, apiBookBash.Deleted, false, "apiBookBash Deleted mismatch")
- assert.Equal(t, apiBookAlg.Deleted, false, "apiBookAlg Deleted mismatch")
- assert.Equal(t, apiBookAlg2.Deleted, false, "apiBookAlg2 Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("three times", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- goBookUUID := apiCreateBook(t, env, user, "go", "adding a go book")
- goNote1UUID := apiCreateNote(t, env, user, goBookUUID, "go1", "adding go note 1")
-
- // 4. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "html", "-c", "html1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- "goBookUUID": goBookUUID,
- "goNote1UUID": goNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 4,
- clientBookCount: 4,
- clientLastMaxUSN: 8,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 4,
- serverBookCount: 4,
- serverUserMaxUSN: 8,
- })
-
- // test client
- var cliNote1JS, cliNote1CSS, cliNote1Go, cliNote1HTML cliDatabase.Note
- var cliBookJS, cliBookCSS, cliBookGo, cliBookHTML cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote1CSS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css1"), &cliNote1CSS.UUID, &cliNote1CSS.Body, &cliNote1CSS.USN)
- cliDatabase.MustScan(t, "finding cliNote1Go", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "go1"), &cliNote1Go.UUID, &cliNote1Go.Body, &cliNote1Go.USN)
- cliDatabase.MustScan(t, "finding cliNote1HTML", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "html1"), &cliNote1HTML.UUID, &cliNote1HTML.Body, &cliNote1HTML.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding cliBookGo", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "go"), &cliBookGo.UUID, &cliBookGo.Label, &cliBookGo.USN)
- cliDatabase.MustScan(t, "finding cliBookHTML", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "html"), &cliBookHTML.UUID, &cliBookHTML.Label, &cliBookHTML.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- assert.NotEqual(t, cliNote1CSS.USN, 0, "cliNote1CSS USN mismatch")
- assert.NotEqual(t, cliNote1Go.USN, 0, "cliNote1Go USN mismatch")
- assert.NotEqual(t, cliNote1HTML.USN, 0, "cliNote1HTML USN mismatch")
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliBookCSS.USN, 0, "cliBookCSS USN mismatch")
- assert.NotEqual(t, cliBookGo.USN, 0, "cliBookGo USN mismatch")
- assert.NotEqual(t, cliBookHTML.USN, 0, "cliBookHTML USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1CSS.Body, "css1", "cliNote1CSS Body mismatch")
- assert.Equal(t, cliNote1Go.Body, "go1", "cliNote1Go Body mismatch")
- assert.Equal(t, cliNote1HTML.Body, "html1", "cliNote1HTML Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- assert.Equal(t, cliBookGo.Label, "go", "cliBookGo Label mismatch")
- assert.Equal(t, cliBookHTML.Label, "html", "cliBookHTML Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote1CSS.Deleted, false, "cliNote1CSS Deleted mismatch")
- assert.Equal(t, cliNote1Go.Deleted, false, "cliNote1Go Deleted mismatch")
- assert.Equal(t, cliNote1HTML.Deleted, false, "cliNote1HTML Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- assert.Equal(t, cliBookGo.Deleted, false, "cliBookGo Deleted mismatch")
- assert.Equal(t, cliBookHTML.Deleted, false, "cliBookHTML Deleted mismatch")
-
- // test server
- var apiNote1JS, apiNote1CSS, apiNote1Go, apiNote1HTML database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["goNote1UUID"]).First(&apiNote1Go), "finding apiNote1Go")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1CSS.UUID).First(&apiNote1CSS), "finding apiNote1CSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1HTML.UUID).First(&apiNote1HTML), "finding apiNote1HTML")
- var apiBookJS, apiBookCSS, apiBookGo, apiBookHTML database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["goBookUUID"]).First(&apiBookGo), "finding apiBookGo")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookCSS.UUID).First(&apiBookCSS), "finding apiBookCSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookHTML.UUID).First(&apiBookHTML), "finding apiBookHTML")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiNote1CSS.USN, 0, "apiNote1CSS USN mismatch")
- assert.NotEqual(t, apiNote1Go.USN, 0, "apiNote1Go USN mismatch")
- assert.NotEqual(t, apiNote1HTML.USN, 0, "apiNote1HTM USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- assert.NotEqual(t, apiBookGo.USN, 0, "apiBookGo USN mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS USN mismatch")
- assert.NotEqual(t, apiBookHTML.USN, 0, "apiBookHTML USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1CSS.Body, "css1", "apiNote1CSS Body mismatch")
- assert.Equal(t, apiNote1Go.Body, "go1", "apiNote1Go Body mismatch")
- assert.Equal(t, apiNote1HTML.Body, "html1", "apiNote1HTM Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookGo.Label, "go", "apiBookGo Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- assert.Equal(t, apiBookHTML.Label, "html", "apiBookHTML Label mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-}
-
-func TestSync(t *testing.T) {
- t.Run("client adds a book and a note", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
-
- return map[string]string{}
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 2,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 2,
- })
-
- // test client
- // assert on bodys and labels
- var cliNote1JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1JS.UUID).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookJS.UUID).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client deletes a book", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveBook, cliBinaryName, "remove", "js")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 0,
- clientLastMaxUSN: 5,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 5,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, true, "apiBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client deletes a note", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- cliDB := env.DB
-
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- var nid string
- cliDatabase.MustScan(t, "getting id of note to remove", cliDB.QueryRow("SELECT rowid FROM notes WHERE uuid = ?", jsNote1UUID), &nid)
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveNote, cliBinaryName, "remove", "js", nid)
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 1,
- clientLastMaxUSN: 3,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 3,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE label = ?", "js"), &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client edits a note", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- cliDB := env.DB
-
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- var nid string
- cliDatabase.MustScan(t, "getting id of note to edit", cliDB.QueryRow("SELECT rowid FROM notes WHERE uuid = ?", jsNote1UUID), &nid)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", nid, "-c", "js1-edited")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 3,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 3,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1-edited", "apiNote1JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliNote1JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1-edited", "cliNote1JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client edits a book by renaming it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", "-n", "js-edited")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 3,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 3,
- })
-
- // test client
- var cliBookJS cliDatabase.Book
- var cliNote1JS cliDatabase.Note
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, book_uuid, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.BookUUID, &cliNote1JS.USN)
-
- // assert on usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, cliBookJS.UUID, "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js-edited", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- // assert on dirty
- assert.Equal(t, cliNote1JS.Dirty, false, "cliNote1JS Dirty mismatch")
- assert.Equal(t, cliBookJS.Dirty, false, "cliBookJS Dirty mismatch")
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js-edited", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server adds a book", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 1,
- clientLastMaxUSN: 1,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 0,
- serverBookCount: 1,
- serverUserMaxUSN: 1,
- })
-
- // test server
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- // assert on bodys and labels
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE label = ?", "js"), &cliBookJS.Label, &cliBookJS.USN)
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server edits a book by renaming it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiPatchBook(t, env, user, jsBookUUID, fmt.Sprintf(`{"name": "%s"}`, "js-new-label"), "editing js book")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 1,
- clientLastMaxUSN: 2,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 0,
- serverBookCount: 1,
- serverUserMaxUSN: 2,
- })
-
- // test server
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiBookJS.Label, "js-new-label", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- // assert on bodys and labels
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
- assert.Equal(t, cliBookJS.Label, "js-new-label", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server deletes a book", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiDeleteBook(t, env, user, jsBookUUID, "deleting js book")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 0,
- clientLastMaxUSN: 2,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 0,
- serverBookCount: 1,
- serverUserMaxUSN: 2,
- })
-
- // test server
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiBookJS.Label, "", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiBookJS.Deleted, true, "apiBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server adds a note", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 2,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 2,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliNote1JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server edits a note body", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiPatchNote(t, env, user, jsNote1UUID, fmt.Sprintf(`{"content": "%s"}`, "js1-edited"), "editing js note 1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 3,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 3,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1-edited", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliNote1JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1-edited", "cliNote1JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server moves a note to another book", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding css book")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiPatchNote(t, env, user, jsNote1UUID, fmt.Sprintf(`{"book_uuid": "%s"}`, cssBookUUID), "moving js note 1 to css book")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- "cssBookUUID": cssBookUUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS, apiBookCSS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding apiBookCSS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["cssBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
-
- // test client
- var cliNote1JS cliDatabase.Note
- var cliBookJS, cliBookCSS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["cssBookUUID"]), &cliBookCSS.Label, &cliBookCSS.USN)
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server deletes a note", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiDeleteNote(t, env, user, jsNote1UUID, "deleting js note 1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 1,
- clientLastMaxUSN: 3,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 3,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
- // assert on bodys and labels
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client and server deletes the same book", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiDeleteBook(t, env, user, jsBookUUID, "deleting js book")
-
- // 4. on cli
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveBook, cliBinaryName, "remove", "js")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 0,
- clientLastMaxUSN: 6,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 6,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, true, "apiBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client and server deletes the same note", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- cliDB := env.DB
-
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiDeleteNote(t, env, user, jsNote1UUID, "deleting js note 1")
-
- // 4. on cli
- var nid string
- cliDatabase.MustScan(t, "getting id of note to remove", cliDB.QueryRow("SELECT rowid FROM notes WHERE body = ?", "js1"), &nid)
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveNote, cliBinaryName, "remove", "js", nid)
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- apiDB := env.ServerDB
- cliDB := env.DB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 1,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 4,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server and client adds a note with same body", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 4. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 1,
- clientLastMaxUSN: 3,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 1,
- serverUserMaxUSN: 3,
- })
-
- // test client
- var cliNote1JS, cliNote2JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote2JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ? and uuid != ?", "js1", ids["jsNote1UUID"]), &cliNote2JS.UUID, &cliNote2JS.Body, &cliNote2JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote2JS.Body, "js1", "cliNote2JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote2JS.Deleted, false, "cliNote2JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
-
- // test server
- var apiNote1JS, apiNote2JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote2JS.UUID).First(&apiNote2JS), "finding apiNote2JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiNote2JS.USN, 0, "apiNote2JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote2JS.Body, "js1", "apiNote2JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server and client adds a book with same label", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // test client
- var cliNote1JS, cliNote1JS2 cliDatabase.Note
- var cliBookJS, cliBookJS2 cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS2",
- cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ? AND uuid !=?", "js1", ids["jsNote1UUID"]), &cliNote1JS2.UUID, &cliNote1JS2.Body, &cliNote1JS2.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS2", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js_2"), &cliBookJS2.UUID, &cliBookJS2.Label, &cliBookJS2.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS2.Body, "js1", "cliNote1JS2 Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookJS2.Label, "js_2", "cliBookJS2 Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote1JS2.Deleted, false, "cliNote1JS2 Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookJS2.Deleted, false, "cliBookJS2 Deleted mismatch")
-
- // test server
- var apiNote1JS, apiNote1JS2 database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1JS2.UUID).First(&apiNote1JS2), "finding apiNote1JS2")
- var apiBookJS, apiBookJS2 database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookJS2.UUID).First(&apiBookJS2), "finding apiBookJS2")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiNote1JS2.USN, 0, "apiNote1JS2 USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- assert.NotEqual(t, apiBookJS2.USN, 0, "apiBookJS2 USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS2.Body, "js1", "apiNote1JS2 Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookJS2.Label, "js_2", "apiBookJS2 Label mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server and client adds two sets of books with same labels", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding css book")
- cssNote1UUID := apiCreateNote(t, env, user, cssBookUUID, "css1", "adding css note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- "cssBookUUID": cssBookUUID,
- "cssNote1UUID": cssNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 4,
- clientBookCount: 4,
- clientLastMaxUSN: 8,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 4,
- serverBookCount: 4,
- serverUserMaxUSN: 8,
- })
-
- // test client
- var cliNote1JS, cliNote1JS2, cliNote1CSS, cliNote1CSS2 cliDatabase.Note
- var cliBookJS, cliBookJS2, cliBookCSS, cliBookCSS2 cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS2",
- cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ? AND uuid != ?", "js1", ids["jsNote1UUID"]), &cliNote1JS2.UUID, &cliNote1JS2.Body, &cliNote1JS2.USN)
- cliDatabase.MustScan(t, "finding cliNote1CSS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE uuid = ?", ids["cssNote1UUID"]), &cliNote1CSS.UUID, &cliNote1CSS.Body, &cliNote1CSS.USN)
- cliDatabase.MustScan(t, "finding cliNote1CSS2",
- cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ? AND uuid != ?", "css1", ids["cssNote1UUID"]), &cliNote1CSS2.UUID, &cliNote1CSS2.Body, &cliNote1CSS2.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS2", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js_2"), &cliBookJS2.UUID, &cliBookJS2.Label, &cliBookJS2.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS2", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css_2"), &cliBookCSS2.UUID, &cliBookCSS2.Label, &cliBookCSS2.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS2.Body, "js1", "cliNote1JS2 Body mismatch")
- assert.Equal(t, cliNote1CSS.Body, "css1", "cliNote1CSS Body mismatch")
- assert.Equal(t, cliNote1CSS2.Body, "css1", "cliNote1CSS2 Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookJS2.Label, "js_2", "cliBookJS2 Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- assert.Equal(t, cliBookCSS2.Label, "css_2", "cliBookCSS2 Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote1JS2.Deleted, false, "cliNote1JS2 Deleted mismatch")
- assert.Equal(t, cliNote1CSS.Deleted, false, "cliNote1CSS Deleted mismatch")
- assert.Equal(t, cliNote1CSS2.Deleted, false, "cliNote1CSS2 Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookJS2.Deleted, false, "cliBookJS2 Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- assert.Equal(t, cliBookCSS2.Deleted, false, "cliBookCSS2 Deleted mismatch")
-
- // test server
- var apiNote1JS, apiNote1JS2, apiNote1CSS, apiNote1CSS2 database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1JS2.UUID).First(&apiNote1JS2), "finding apiNote1JS2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssNote1UUID"]).First(&apiNote1CSS), "finding apiNote1CSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1CSS2.UUID).First(&apiNote1CSS2), "finding apiNote1CSS2")
- var apiBookJS, apiBookJS2, apiBookCSS, apiBookCSS2 database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookJS2.UUID).First(&apiBookJS2), "finding apiBookJS2")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding apiBookCSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookCSS2.UUID).First(&apiBookCSS2), "finding apiBookCSS2")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiNote1JS2.USN, 0, "apiNote1JS2 USN mismatch")
- assert.NotEqual(t, apiNote1CSS.USN, 0, "apiNote1CSS USN mismatch")
- assert.NotEqual(t, apiNote1CSS2.USN, 0, "apiNote1CSS2 USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- assert.NotEqual(t, apiBookJS2.USN, 0, "apiBookJS2 USN mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS USN mismatch")
- assert.NotEqual(t, apiBookCSS2.USN, 0, "apiBookCSS2 USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS2.Body, "js1", "apiNote1JS2 Body mismatch")
- assert.Equal(t, apiNote1CSS.Body, "css1", "apiNote1CSS2 Body mismatch")
- assert.Equal(t, apiNote1CSS2.Body, "css1", "apiNote1CSS2 Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookJS2.Label, "js_2", "apiBookJS2 Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- assert.Equal(t, apiBookCSS2.Label, "css_2", "apiBookCSS2 Label mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server and client adds notes to the same book", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 4. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js2")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 1,
- clientLastMaxUSN: 3,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 1,
- serverUserMaxUSN: 3,
- })
-
- // test client
- var cliNote1JS, cliNote2JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote2JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js2"), &cliNote2JS.UUID, &cliNote2JS.Body, &cliNote2JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote2JS.Body, "js2", "cliNote2JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote2JS.Deleted, false, "cliNote2JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
-
- // test server
- var apiNote1JS, apiNote2JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote2JS.UUID).First(&apiNote2JS), "finding apiNote2JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiNote2JS.USN, 0, "apiNote2JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote2JS.Body, "js2", "apiNote2JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server and client adds a book with the same label and notes in it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js2")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // test client
- var cliNote1JS, cliNote2JS cliDatabase.Note
- var cliBookJS, cliBookJS2 cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote2JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js2"), &cliNote2JS.UUID, &cliNote2JS.Body, &cliNote2JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS2", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js_2"), &cliBookJS2.UUID, &cliBookJS2.Label, &cliBookJS2.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote2JS.Body, "js2", "cliNote2JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookJS2.Label, "js_2", "cliBookJS2 Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote2JS.Deleted, false, "cliNote2JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookJS2.Deleted, false, "cliBookJS2 Deleted mismatch")
-
- // test server
- var apiNote1JS, apiNote2JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote2JS.UUID).First(&apiNote2JS), "finding apiNote2JS")
- var apiBookJS, apiBookJS2 database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookJS2.UUID).First(&apiBookJS2), "finding apiBookJS2")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiNote2JS.USN, 0, "apiNote2JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- assert.NotEqual(t, apiBookJS2.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote2JS.Body, "js2", "apiNote2JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookJS2.Label, "js_2", "apiBookJS2 USN mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client and server edits bodys of the same note", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- cliDB := env.DB
-
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- var nid string
- cliDatabase.MustScan(t, "getting id of note to edit", cliDB.QueryRow("SELECT rowid FROM notes WHERE uuid = ?", jsNote1UUID), &nid)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", nid, "-c", "js1-edited-from-client")
-
- // 3. on server
- apiPatchNote(t, env, user, jsNote1UUID, fmt.Sprintf(`{"content": "%s"}`, "js1-edited-from-server"), "editing js note 1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- resolvedBody := "<<<<<<< Local\njs1-edited-from-client\n=======\njs1-edited-from-server\n>>>>>>> Server\n"
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 4,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, resolvedBody, "apiNote1JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliNote1JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, resolvedBody, "cliNote1JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("clients deletes a note and server edits its body", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- cliDB := env.DB
-
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- var nid string
- cliDatabase.MustScan(t, "getting id of note to remove", cliDB.QueryRow("SELECT rowid FROM notes WHERE uuid = ?", jsNote1UUID), &nid)
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveNote, cliBinaryName, "remove", "js", nid)
-
- // 3. on server
- apiPatchNote(t, env, user, jsNote1UUID, fmt.Sprintf(`{"content": "%s"}`, "js1-edited"), "editing js note 1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 3,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 3,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1-edited", "apiNote1JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliNote1JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1-edited", "cliNote1JS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("clients deletes a note and server moves it to another book", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- cliDB := env.DB
-
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding css book")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- var nid string
- cliDatabase.MustScan(t, "getting id of note to remove", cliDB.QueryRow("SELECT rowid FROM notes WHERE uuid = ?", jsNote1UUID), &nid)
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveNote, cliBinaryName, "remove", "js", nid)
-
- // 3. on server
- apiPatchNote(t, env, user, jsNote1UUID, fmt.Sprintf(`{"book_uuid": "%s"}`, cssBookUUID), "moving js note 1 to css book")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- "cssBookUUID": cssBookUUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS, apiBookCSS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding apiBookCSS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["cssBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
-
- // test client
- var cliNote1JS cliDatabase.Note
- var cliBookJS, cliBookCSS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["cssBookUUID"]), &cliBookCSS.Label, &cliBookCSS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, ids["cssNote1UUID"], "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server deletes a note and client edits it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- cliDB := env.DB
-
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiDeleteNote(t, env, user, jsNote1UUID, "deleting js note 1")
-
- // 4. on cli
- var nid string
- cliDatabase.MustScan(t, "getting id of note to edit", cliDB.QueryRow("SELECT rowid FROM notes WHERE body = ?", "js1"), &nid)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", nid, "-c", "js1-edited")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 4,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1-edited", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliNote1JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT body, book_uuid, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.Body, &cliNote1JS.BookUUID, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1-edited", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, ids["jsBookUUID"], "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server deletes a book and client edits it by renaming it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiDeleteNote(t, env, user, jsNote1UUID, "deleting js note 1")
-
- // 4. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", "-n", "js-edited")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 1,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 4,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js-edited", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliBookJS.Label, "js-edited", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("server deletes a book and client edits a note in it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- cliDB := env.DB
-
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiDeleteBook(t, env, user, jsBookUUID, "deleting js book")
-
- // 4. on cli
- var nid string
- cliDatabase.MustScan(t, "getting id of note to edit", cliDB.QueryRow("SELECT rowid FROM notes WHERE body = ?", "js1"), &nid)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", nid, "-c", "js1-edited")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 6,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 6,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1-edited", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliNote1JS cliDatabase.Note
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT body, book_uuid, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.Body, &cliNote1JS.BookUUID, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1-edited", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, ids["jsBookUUID"], "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client deletes a book and server edits it by renaming it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveBook, cliBinaryName, "remove", "js")
-
- // 3. on server
- apiPatchBook(t, env, user, jsBookUUID, fmt.Sprintf(`{"name": "%s"}`, "js-edited"), "editing js book")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 1,
- clientLastMaxUSN: 5,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 5,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js-edited", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
-
- // test client
- var cliBookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.Label, &cliBookJS.USN)
-
- // test usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliBookJS.Label, "js-edited", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client deletes a book and server edits a note in it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiPatchNote(t, env, user, jsNote1UUID, fmt.Sprintf(`{"content": "%s"}`, "js1-edited"), "editing js1 note")
-
- // 4. on cli
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.ConfirmRemoveBook, cliBinaryName, "remove", "js")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 0,
- clientBookCount: 0,
- clientLastMaxUSN: 6,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 6,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["jsBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, true, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, true, "apiBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client and server edit a book by renaming it to a same name", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", "-n", "js-edited")
-
- // 3. on server
- apiPatchBook(t, env, user, jsBookUUID, fmt.Sprintf(`{"name": "%s"}`, "js-edited"), "editing js book")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 4,
- })
-
- // test client
- var cliBookJS cliDatabase.Book
- var cliNote1JS cliDatabase.Note
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, book_uuid, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.BookUUID, &cliNote1JS.USN)
-
- // assert on usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, cliBookJS.UUID, "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js-edited", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- // assert on dirty
- assert.Equal(t, cliNote1JS.Dirty, false, "cliNote1JS Dirty mismatch")
- assert.Equal(t, cliBookJS.Dirty, false, "cliBookJS Dirty mismatch")
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js-edited", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client and server edit a book by renaming it to different names", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", "-n", "js-edited-client")
-
- // 3. on server
- apiPatchBook(t, env, user, jsBookUUID, fmt.Sprintf(`{"name": "%s"}`, "js-edited-server"), "editing js book")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- // In this case, server's change wins and overwrites that of client's
-
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 4,
- })
-
- // test client
- var cliBookJS cliDatabase.Book
- var cliNote1JS cliDatabase.Note
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE uuid = ?", ids["jsBookUUID"]), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, book_uuid, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.BookUUID, &cliNote1JS.USN)
-
- // assert on usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, cliBookJS.UUID, "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js-edited-server", "cliBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- // assert on dirty
- assert.Equal(t, cliNote1JS.Dirty, false, "cliNote1JS Dirty mismatch")
- assert.Equal(t, cliBookJS.Dirty, false, "cliBookJS Dirty mismatch")
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js-edited-server", "apiBookJS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client moves a note", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding a css book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "1", "-b", "css")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "cssBookUUID": cssBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS, apiBookCSS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding apiBookCSS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["cssBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
-
- // test client
- var cliBookJS, cliBookCSS cliDatabase.Book
- var cliNote1JS cliDatabase.Note
- cliDatabase.MustScan(t, "finding cli book js", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cli book css", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, book_uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.BookUUID, &cliNote1JS.Body, &cliNote1JS.USN)
-
- // assert on usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliBookCSS.USN, 0, "cliBookCSS USN mismatch")
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, cliBookCSS.UUID, "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- // assert on dirty
- assert.Equal(t, cliNote1JS.Dirty, false, "cliNote1JS Dirty mismatch")
- assert.Equal(t, cliBookJS.Dirty, false, "cliBookJS Dirty mismatch")
- assert.Equal(t, cliBookCSS.Dirty, false, "cliBookCSS Dirty mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client and server each moves a note to a same book", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding a css book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiPatchNote(t, env, user, jsNote1UUID, fmt.Sprintf(`{"book_uuid": "%s"}`, cssBookUUID), "moving js note 1 to css book")
-
- // 3. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "1", "-b", "css")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "cssBookUUID": cssBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 2,
- clientLastMaxUSN: 5,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 2,
- serverUserMaxUSN: 5,
- })
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS, apiBookCSS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding apiBookCSS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, ids["cssBookUUID"], "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
-
- // test client
- var cliBookJS, cliBookCSS cliDatabase.Book
- var cliNote1JS cliDatabase.Note
- cliDatabase.MustScan(t, "finding cli book js", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cli book css", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, book_uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.BookUUID, &cliNote1JS.Body, &cliNote1JS.USN)
-
- // assert on usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliBookCSS.USN, 0, "cliBookCSS USN mismatch")
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, cliBookCSS.UUID, "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- // assert on dirty
- assert.Equal(t, cliNote1JS.Dirty, false, "cliNote1JS Dirty mismatch")
- assert.Equal(t, cliBookJS.Dirty, false, "cliBookJS Dirty mismatch")
- assert.Equal(t, cliBookCSS.Dirty, false, "cliBookCSS Dirty mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client and server each moves a note to different books", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding a css book")
- linuxBookUUID := apiCreateBook(t, env, user, "linux", "adding a linux book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- apiPatchNote(t, env, user, jsNote1UUID, fmt.Sprintf(`{"book_uuid": "%s"}`, cssBookUUID), "moving js note 1 to css book")
-
- // 3. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "1", "-b", "linux")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "cssBookUUID": cssBookUUID,
- "jsNote1UUID": jsNote1UUID,
- "linuxBookUUID": linuxBookUUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- expectedNote1JSBody := `<<<<<<< Local
-Moved to the book linux
-=======
-Moved to the book css
->>>>>>> Server
-
-js1`
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 4,
- clientLastMaxUSN: 7,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 4,
- serverUserMaxUSN: 7,
- })
-
- // test client
- var cliBookJS, cliBookCSS, cliBookLinux, cliBookConflicts cliDatabase.Book
- var cliNote1JS cliDatabase.Note
- cliDatabase.MustScan(t, "finding cli book js", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cli book css", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding cliBookLinux", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "linux"), &cliBookLinux.UUID, &cliBookLinux.Label, &cliBookLinux.USN)
- cliDatabase.MustScan(t, "finding cliBookConflicts", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "conflicts"), &cliBookConflicts.UUID, &cliBookConflicts.Label, &cliBookConflicts.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, book_uuid, body, usn FROM notes WHERE uuid = ?", ids["jsNote1UUID"]), &cliNote1JS.UUID, &cliNote1JS.BookUUID, &cliNote1JS.Body, &cliNote1JS.USN)
-
- // assert on usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliBookCSS.USN, 0, "cliBookCSS USN mismatch")
- assert.NotEqual(t, cliBookLinux.USN, 0, "cliBookLinux USN mismatch")
- assert.NotEqual(t, cliBookConflicts.USN, 0, "cliBookConflicts USN mismatch")
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, expectedNote1JSBody, "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, cliBookConflicts.UUID, "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- assert.Equal(t, cliBookLinux.Label, "linux", "cliBookLinux Label mismatch")
- assert.Equal(t, cliBookConflicts.Label, "conflicts", "cliBookConflicts Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- assert.Equal(t, cliBookLinux.Deleted, false, "cliBookLinux Deleted mismatch")
- assert.Equal(t, cliBookConflicts.Deleted, false, "cliBookConflicts Deleted mismatch")
- // assert on dirty
- assert.Equal(t, cliNote1JS.Dirty, false, "cliNote1JS Dirty mismatch")
- assert.Equal(t, cliBookJS.Dirty, false, "cliBookJS Dirty mismatch")
- assert.Equal(t, cliBookCSS.Dirty, false, "cliBookCSS Dirty mismatch")
- assert.Equal(t, cliBookLinux.Dirty, false, "cliBookLinux Dirty mismatch")
- assert.Equal(t, cliBookConflicts.Dirty, false, "cliBookConflicts Dirty mismatch")
-
- // test server
- var apiNote1JS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- var apiBookJS, apiBookCSS, apiBookLinux, apiBookConflicts database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding apiBookCSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["linuxBookUUID"]).First(&apiBookLinux), "finding apiBookLinux")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookConflicts.UUID).First(&apiBookConflicts), "finding apiBookConflicts")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS USN mismatch")
- assert.NotEqual(t, apiBookConflicts.USN, 0, "apiBookConflicts USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, expectedNote1JSBody, "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, apiBookConflicts.UUID, "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- assert.Equal(t, apiBookLinux.Label, "linux", "apiBookLinux Label mismatch")
- assert.Equal(t, apiBookConflicts.Label, "conflicts", "apiBookConflicts Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
- assert.Equal(t, apiBookLinux.Deleted, false, "apiBookLinux Deleted mismatch")
- assert.Equal(t, apiBookConflicts.Deleted, false, "apiBookConflicts Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client adds a new book and moves a note into it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
-
- cliDB := env.DB
- var nid string
- cliDatabase.MustScan(t, "getting id of note to edit", cliDB.QueryRow("SELECT rowid FROM notes WHERE body = ?", "js1"), &nid)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", "js", nid, "-b", "css")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 5,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 5,
- })
-
- // test client
- var cliBookJS, cliBookCSS cliDatabase.Book
- var cliNote1JS, cliNote1CSS cliDatabase.Note
- cliDatabase.MustScan(t, "finding cli book js", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cli book css", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, book_uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.BookUUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote1CSS", cliDB.QueryRow("SELECT uuid, book_uuid, body, usn FROM notes WHERE body = ?", "css1"), &cliNote1CSS.UUID, &cliNote1CSS.BookUUID, &cliNote1CSS.Body, &cliNote1CSS.USN)
-
- // assert on usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliBookCSS.USN, 0, "cliBookCSS USN mismatch")
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- assert.NotEqual(t, cliNote1CSS.USN, 0, "cliNote1CSS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, cliBookCSS.UUID, "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliNote1CSS.Body, "css1", "cliNote1CSS Body mismatch")
- assert.Equal(t, cliNote1CSS.BookUUID, cliBookCSS.UUID, "cliNote1CSS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote1CSS.Deleted, false, "cliNote1CSS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- // assert on dirty
- assert.Equal(t, cliNote1JS.Dirty, false, "cliNote1JS Dirty mismatch")
- assert.Equal(t, cliNote1CSS.Dirty, false, "cliNote1CSS Dirty mismatch")
- assert.Equal(t, cliBookJS.Dirty, false, "cliBookJS Dirty mismatch")
- assert.Equal(t, cliBookCSS.Dirty, false, "cliBookCSS Dirty mismatch")
-
- // test server
- var apiNote1JS, apiNote1CSS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1CSS.UUID).First(&apiNote1CSS), "finding apiNote1CSS")
- var apiBookJS, apiBookCSS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookCSS.UUID).First(&apiBookCSS), "finding apiBookCSS")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiNote1CSS.USN, 0, "apiNote1CSS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, apiBookCSS.UUID, "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiNote1CSS.Body, "css1", "apiNote1CSS Body mismatch")
- assert.Equal(t, apiNote1CSS.BookUUID, apiBookCSS.UUID, "apiNote1CSS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiNote1CSS.Deleted, false, "apiNote1CSS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-
- t.Run("client adds a duplicate book and moves a note into it", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- // 1. on server
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- // 2. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // 3. on server
- cssBookUUID := apiCreateBook(t, env, user, "css", "adding a css book")
-
- // 3. on cli
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
-
- var nid string
- cliDatabase.MustScan(t, "getting id of note to edit", env.DB.QueryRow("SELECT rowid FROM notes WHERE body = ?", "js1"), &nid)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "edit", nid, "-b", "css")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "cssBookUUID": cssBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 3,
- clientLastMaxUSN: 6,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 3,
- serverUserMaxUSN: 6,
- })
-
- // test client
- var cliBookJS, cliBookCSS, cliBookCSS2 cliDatabase.Book
- var cliNote1JS, cliNote1CSS cliDatabase.Note
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS2", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css_2"), &cliBookCSS2.UUID, &cliBookCSS2.Label, &cliBookCSS2.USN)
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, book_uuid, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.BookUUID, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote1CSS", cliDB.QueryRow("SELECT uuid, body, book_uuid, usn FROM notes WHERE body = ?", "css1"), &cliNote1CSS.UUID, &cliNote1CSS.Body, &cliNote1CSS.BookUUID, &cliNote1CSS.USN)
-
- // assert on usn
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliBookCSS.USN, 0, "cliBookCSS USN mismatch")
- assert.NotEqual(t, cliBookCSS2.USN, 0, "cliBookCSS2 USN mismatch")
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- assert.NotEqual(t, cliNote1CSS.USN, 0, "cliNote1CSS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1JS.BookUUID, cliBookCSS2.UUID, "cliNote1JS BookUUID mismatch")
- assert.Equal(t, cliNote1CSS.Body, "css1", "cliNote1CSS Body mismatch")
- assert.Equal(t, cliNote1CSS.BookUUID, cliBookCSS2.UUID, "cliNote1CSS BookUUID mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- assert.Equal(t, cliBookCSS2.Label, "css_2", "cliBookCSS2 Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote1CSS.Deleted, false, "cliNote1CSS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
- assert.Equal(t, cliBookCSS2.Deleted, false, "cliBookCSS2 Deleted mismatch")
- // assert on dirty
- assert.Equal(t, cliNote1JS.Dirty, false, "cliNote1JS Dirty mismatch")
- assert.Equal(t, cliNote1CSS.Dirty, false, "cliNote1CSS Dirty mismatch")
- assert.Equal(t, cliBookJS.Dirty, false, "cliBookJS Dirty mismatch")
- assert.Equal(t, cliBookCSS.Dirty, false, "cliBookCSS Dirty mismatch")
- assert.Equal(t, cliBookCSS2.Dirty, false, "cliBookCSS2 Dirty mismatch")
-
- // test server
- var apiNote1JS, apiNote1CSS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding apiNote1JS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1CSS.UUID).First(&apiNote1CSS), "finding apiNote1CSS")
- var apiBookJS, apiBookCSS, apiBookCSS2 database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding apiBookJS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["cssBookUUID"]).First(&apiBookCSS), "finding apiBookCSS")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookCSS2.UUID).First(&apiBookCSS2), "finding apiBookCSS2")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS USN mismatch")
- assert.NotEqual(t, apiNote1CSS.USN, 0, "apiNote1CSS USN mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS USN mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS USN mismatch")
- assert.NotEqual(t, apiBookCSS2.USN, 0, "apiBookCSS2 USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1JS.BookUUID, apiBookCSS2.UUID, "apiNote1JS BookUUID mismatch")
- assert.Equal(t, apiNote1CSS.Body, "css1", "apiNote1CSS Body mismatch")
- assert.Equal(t, apiNote1CSS.BookUUID, apiBookCSS2.UUID, "apiNote1CSS BookUUID mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- assert.Equal(t, apiBookCSS2.Label, "css_2", "apiBookCSS2 Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiNote1CSS.Deleted, false, "apiNote1CSS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
- assert.Equal(t, apiBookCSS2.Deleted, false, "apiBookCSS2 Deleted mismatch")
- }
-
- testSyncCmd(t, false, setup, assert)
- testSyncCmd(t, true, setup, assert)
- })
-}
-
-func TestFullSync(t *testing.T) {
- t.Run("consecutively with stepSync", func(t *testing.T) {
- setup := func(t *testing.T, env testEnv, user database.User) map[string]string {
- jsBookUUID := apiCreateBook(t, env, user, "js", "adding a js book")
- jsNote1UUID := apiCreateNote(t, env, user, jsBookUUID, "js1", "adding js note 1")
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
-
- return map[string]string{
- "jsBookUUID": jsBookUUID,
- "jsNote1UUID": jsNote1UUID,
- }
- }
-
- assert := func(t *testing.T, env testEnv, user database.User, ids map[string]string) {
- cliDB := env.DB
- apiDB := env.ServerDB
-
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // test client
- var cliNote1JS, cliNote1CSS cliDatabase.Note
- var cliBookJS, cliBookCSS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.Body, &cliNote1JS.USN)
- cliDatabase.MustScan(t, "finding cliNote1CSS", cliDB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css1"), &cliNote1CSS.UUID, &cliNote1CSS.Body, &cliNote1CSS.USN)
- cliDatabase.MustScan(t, "finding cliBookJS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding cliBookCSS", cliDB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
-
- // test usn
- assert.NotEqual(t, cliNote1JS.USN, 0, "cliNote1JS USN mismatch")
- assert.NotEqual(t, cliNote1CSS.USN, 0, "cliNote1CSS USN mismatch")
- assert.NotEqual(t, cliBookJS.USN, 0, "cliBookJS USN mismatch")
- assert.NotEqual(t, cliBookCSS.USN, 0, "cliBookCSS USN mismatch")
- // assert on bodys and labels
- assert.Equal(t, cliNote1JS.Body, "js1", "cliNote1JS Body mismatch")
- assert.Equal(t, cliNote1CSS.Body, "css1", "cliNote1CSS Body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "cliBookJS Label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "cliBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, cliNote1JS.Deleted, false, "cliNote1JS Deleted mismatch")
- assert.Equal(t, cliNote1CSS.Deleted, false, "cliNote1CSS Deleted mismatch")
- assert.Equal(t, cliBookJS.Deleted, false, "cliBookJS Deleted mismatch")
- assert.Equal(t, cliBookCSS.Deleted, false, "cliBookCSS Deleted mismatch")
-
- // test server
- var apiNote1JS, apiNote1CSS database.Note
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsNote1UUID"]).First(&apiNote1JS), "finding api js note 1")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliNote1CSS.UUID).First(&apiNote1CSS), "finding api css note 1")
- var apiBookJS, apiBookCSS database.Book
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, ids["jsBookUUID"]).First(&apiBookJS), "finding api js book")
- apitest.MustExec(t, apiDB.Where("user_id = ? AND uuid = ?", user.ID, cliBookCSS.UUID).First(&apiBookCSS), "finding api css book")
-
- // assert on usn
- assert.NotEqual(t, apiNote1JS.USN, 0, "apiNote1JS usn mismatch")
- assert.NotEqual(t, apiNote1CSS.USN, 0, "apiNote1CSS usn mismatch")
- assert.NotEqual(t, apiBookJS.USN, 0, "apiBookJS usn mismatch")
- assert.NotEqual(t, apiBookCSS.USN, 0, "apiBookCSS usn mismatch")
- // assert on bodys and labels
- assert.Equal(t, apiNote1JS.Body, "js1", "apiNote1JS Body mismatch")
- assert.Equal(t, apiNote1CSS.Body, "css1", "apiNote1CSS Body mismatch")
- assert.Equal(t, apiBookJS.Label, "js", "apiBookJS Label mismatch")
- assert.Equal(t, apiBookCSS.Label, "css", "apiBookCSS Label mismatch")
- // assert on deleted
- assert.Equal(t, apiNote1JS.Deleted, false, "apiNote1JS Deleted mismatch")
- assert.Equal(t, apiNote1CSS.Deleted, false, "apiNote1CSS Deleted mismatch")
- assert.Equal(t, apiBookJS.Deleted, false, "apiBookJS Deleted mismatch")
- assert.Equal(t, apiBookCSS.Deleted, false, "apiBookCSS Deleted mismatch")
- }
-
- t.Run("stepSync then fullSync", func(t *testing.T) {
- env := setupTestEnv(t)
- user := setupUserAndLogin(t, env)
- ids := setup(t, env, user)
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- assert(t, env, user, ids)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync", "-f")
- assert(t, env, user, ids)
- })
-
- t.Run("fullSync then stepSync", func(t *testing.T) {
- env := setupTestEnv(t)
-
- user := setupUserAndLogin(t, env)
- ids := setup(t, env, user)
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync", "-f")
- assert(t, env, user, ids)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- assert(t, env, user, ids)
- })
- })
-}
-
-func TestSync_FreshClientConcurrent(t *testing.T) {
- // Test the core issue: Fresh client (never synced, lastMaxUSN=0) syncing to a server
- // that already has data uploaded by another client.
- //
- // Scenario:
- // 1. Client A creates local notes (never synced, lastMaxUSN=0, lastSyncAt=0)
- // 2. Client B uploads same book names to server first
- // 3. Client A syncs
- //
- // Expected: Client A should pull server data first, detect duplicate book names,
- // rename local books to avoid conflicts (js→js_2), then upload successfully.
-
- env := setupTestEnv(t)
-
- user := setupUserAndLogin(t, env)
-
- // Client A: Create local data (never sync)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
-
- // Client B: Upload same book names to server via API
- jsBookUUID := apiCreateBook(t, env, user, "js", "client B creating js book")
- cssBookUUID := apiCreateBook(t, env, user, "css", "client B creating css book")
- apiCreateNote(t, env, user, jsBookUUID, "js2", "client B note")
- apiCreateNote(t, env, user, cssBookUUID, "css2", "client B note")
-
- // Client A syncs - should handle the conflict gracefully
- // Expected: pulls server data, renames local books to js_2/css_2, uploads successfully
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // Verify: Should have 4 books and 4 notes on both client and server
- // USN breakdown: 2 books + 2 notes from Client B (USN 1-4), then 2 books + 2 notes from Client A (USN 5-8)
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 4,
- clientBookCount: 4,
- clientLastMaxUSN: 8,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 4,
- serverBookCount: 4,
- serverUserMaxUSN: 8,
- })
-
- // Verify server has all 4 books with correct names
- var svrBookJS, svrBookCSS, svrBookJS2, svrBookCSS2 database.Book
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "js").First(&svrBookJS), "finding server book 'js'")
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "css").First(&svrBookCSS), "finding server book 'css'")
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "js_2").First(&svrBookJS2), "finding server book 'js_2'")
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "css_2").First(&svrBookCSS2), "finding server book 'css_2'")
-
- assert.Equal(t, svrBookJS.Label, "js", "server should have book 'js' (Client B)")
- assert.Equal(t, svrBookCSS.Label, "css", "server should have book 'css' (Client B)")
- assert.Equal(t, svrBookJS2.Label, "js_2", "server should have book 'js_2' (Client A renamed)")
- assert.Equal(t, svrBookCSS2.Label, "css_2", "server should have book 'css_2' (Client A renamed)")
-
- // Verify server has all 4 notes with correct content
- var svrNoteJS1, svrNoteJS2, svrNoteCSS1, svrNoteCSS2 database.Note
- apitest.MustExec(t, env.ServerDB.Where("body = ?", "js1").First(&svrNoteJS1), "finding server note 'js1'")
- apitest.MustExec(t, env.ServerDB.Where("body = ?", "js2").First(&svrNoteJS2), "finding server note 'js2'")
- apitest.MustExec(t, env.ServerDB.Where("body = ?", "css1").First(&svrNoteCSS1), "finding server note 'css1'")
- apitest.MustExec(t, env.ServerDB.Where("body = ?", "css2").First(&svrNoteCSS2), "finding server note 'css2'")
-
- assert.Equal(t, svrNoteJS1.BookUUID, svrBookJS2.UUID, "note 'js1' should belong to book 'js_2' (Client A)")
- assert.Equal(t, svrNoteJS2.BookUUID, svrBookJS.UUID, "note 'js2' should belong to book 'js' (Client B)")
- assert.Equal(t, svrNoteCSS1.BookUUID, svrBookCSS2.UUID, "note 'css1' should belong to book 'css_2' (Client A)")
- assert.Equal(t, svrNoteCSS2.BookUUID, svrBookCSS.UUID, "note 'css2' should belong to book 'css' (Client B)")
-
- // Verify client has all 4 books
- var cliBookJS, cliBookCSS, cliBookJS2, cliBookCSS2 cliDatabase.Book
- cliDatabase.MustScan(t, "finding client book 'js'", env.DB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding client book 'css'", env.DB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding client book 'js_2'", env.DB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js_2"), &cliBookJS2.UUID, &cliBookJS2.Label, &cliBookJS2.USN)
- cliDatabase.MustScan(t, "finding client book 'css_2'", env.DB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css_2"), &cliBookCSS2.UUID, &cliBookCSS2.Label, &cliBookCSS2.USN)
-
- // Verify client UUIDs match server
- assert.Equal(t, cliBookJS.UUID, svrBookJS.UUID, "client 'js' UUID should match server")
- assert.Equal(t, cliBookCSS.UUID, svrBookCSS.UUID, "client 'css' UUID should match server")
- assert.Equal(t, cliBookJS2.UUID, svrBookJS2.UUID, "client 'js_2' UUID should match server")
- assert.Equal(t, cliBookCSS2.UUID, svrBookCSS2.UUID, "client 'css_2' UUID should match server")
-
- // Verify all books have non-zero USN (synced successfully)
- assert.NotEqual(t, cliBookJS.USN, 0, "client 'js' should have non-zero USN")
- assert.NotEqual(t, cliBookCSS.USN, 0, "client 'css' should have non-zero USN")
- assert.NotEqual(t, cliBookJS2.USN, 0, "client 'js_2' should have non-zero USN")
- assert.NotEqual(t, cliBookCSS2.USN, 0, "client 'css_2' should have non-zero USN")
-
- // Verify client has all 4 notes
- var cliNoteJS1, cliNoteJS2, cliNoteCSS1, cliNoteCSS2 cliDatabase.Note
- cliDatabase.MustScan(t, "finding client note 'js1'", env.DB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js1"), &cliNoteJS1.UUID, &cliNoteJS1.Body, &cliNoteJS1.USN)
- cliDatabase.MustScan(t, "finding client note 'js2'", env.DB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "js2"), &cliNoteJS2.UUID, &cliNoteJS2.Body, &cliNoteJS2.USN)
- cliDatabase.MustScan(t, "finding client note 'css1'", env.DB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css1"), &cliNoteCSS1.UUID, &cliNoteCSS1.Body, &cliNoteCSS1.USN)
- cliDatabase.MustScan(t, "finding client note 'css2'", env.DB.QueryRow("SELECT uuid, body, usn FROM notes WHERE body = ?", "css2"), &cliNoteCSS2.UUID, &cliNoteCSS2.Body, &cliNoteCSS2.USN)
-
- // Verify client note UUIDs match server
- assert.Equal(t, cliNoteJS1.UUID, svrNoteJS1.UUID, "client note 'js1' UUID should match server")
- assert.Equal(t, cliNoteJS2.UUID, svrNoteJS2.UUID, "client note 'js2' UUID should match server")
- assert.Equal(t, cliNoteCSS1.UUID, svrNoteCSS1.UUID, "client note 'css1' UUID should match server")
- assert.Equal(t, cliNoteCSS2.UUID, svrNoteCSS2.UUID, "client note 'css2' UUID should match server")
-
- // Verify all notes have non-zero USN (synced successfully)
- assert.NotEqual(t, cliNoteJS1.USN, 0, "client note 'js1' should have non-zero USN")
- assert.NotEqual(t, cliNoteJS2.USN, 0, "client note 'js2' should have non-zero USN")
- assert.NotEqual(t, cliNoteCSS1.USN, 0, "client note 'css1' should have non-zero USN")
- assert.NotEqual(t, cliNoteCSS2.USN, 0, "client note 'css2' should have non-zero USN")
-}
-
-// TestSync_ConvergeSameBookNames tests that two clients don't enter an infinite sync loop if they
-// try to sync books with the same names. Books shouldn't get marked dirty when re-downloaded from server.
-func TestSync_ConvergeSameBookNames(t *testing.T) {
- env := setupTestEnv(t)
- tmpDir := t.TempDir()
-
- // Setup two separate client databases
- client1DB := fmt.Sprintf("%s/client1.db", tmpDir)
- client2DB := fmt.Sprintf("%s/client2.db", tmpDir)
- defer os.Remove(client1DB)
- defer os.Remove(client2DB)
-
- // Set up sessions
- user := setupUser(t, env)
- db1 := testutils.MustOpenDatabase(t, client1DB)
- db2 := testutils.MustOpenDatabase(t, client2DB)
- defer db1.Close()
- defer db2.Close()
-
- // Client 1: First sync to empty server
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client1DB, "add", "testbook", "-c", "client1 note1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client1DB, "add", "anotherbook", "-c", "client1 note2")
- login(t, db1, env.ServerDB, user)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client1DB, "sync")
- checkState(t, db1, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // Client 2: Sync (downloads client 1's data, adds own notes) =====
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client2DB, "add", "testbook", "-c", "client2 note1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client2DB, "add", "anotherbook", "-c", "client2 note2")
- login(t, db2, env.ServerDB, user)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client2DB, "sync")
- // Verify state after client2 sync
- checkState(t, db2, user, env.ServerDB, systemState{
- clientNoteCount: 4,
- clientBookCount: 2,
- clientLastMaxUSN: 8,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 4,
- serverBookCount: 2,
- serverUserMaxUSN: 8,
- })
-
- // Client 1: Sync again. It downloads client2's changes (2 extra notes).
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client1DB, "sync")
-
- // Verify MaxUSN did not increase (client1 should only download, not upload)
- // Client1 still has: 2 original books + 4 notes (2 own + 2 from client2)
- checkState(t, db1, user, env.ServerDB, systemState{
- clientNoteCount: 4,
- clientBookCount: 2,
- clientLastMaxUSN: 8,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 4,
- serverBookCount: 2,
- serverUserMaxUSN: 8,
- })
-
- // Verify no infinite loop: alternate syncing
- // Both clients should be able to sync without any changes (MaxUSN stays at 8)
- for range 3 {
- // Client 2 syncs
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client2DB, "sync")
-
- // Verify client2 state unchanged
- checkState(t, db2, user, env.ServerDB, systemState{
- clientNoteCount: 4,
- clientBookCount: 2,
- clientLastMaxUSN: 8,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 4,
- serverBookCount: 2,
- serverUserMaxUSN: 8,
- })
-
- // Client 1 syncs
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client1DB, "sync")
-
- // Verify client1 state unchanged
- checkState(t, db1, user, env.ServerDB, systemState{
- clientNoteCount: 4,
- clientBookCount: 2,
- clientLastMaxUSN: 8,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 4,
- serverBookCount: 2,
- serverUserMaxUSN: 8,
- })
- }
-}
diff --git a/pkg/e2e/sync/edge_cases_test.go b/pkg/e2e/sync/edge_cases_test.go
deleted file mode 100644
index f833cadc..00000000
--- a/pkg/e2e/sync/edge_cases_test.go
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package sync
-
-import (
- "io"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/cli/consts"
- cliDatabase "github.com/dnote/dnote/pkg/cli/database"
- clitest "github.com/dnote/dnote/pkg/cli/testutils"
- "github.com/google/uuid"
- "github.com/pkg/errors"
-)
-
-// TestSync_EmptyFragmentPreservesLastMaxUSN verifies that last_max_usn is not reset to 0
-// when sync receives an empty response from the server.
-//
-// Scenario: Client has orphaned note (references non-existent book). During sync:
-// 1. Downloads data successfully (last_max_usn=3)
-// 2. Upload fails (orphaned note -> 500 error, triggers retry stepSync)
-// 3. Retry stepSync gets 0 fragments (already at latest USN)
-// 4. last_max_usn should stay at 3, not reset to 0
-func TestSync_EmptyFragmentPreservesLastMaxUSN(t *testing.T) {
- env := setupTestEnv(t)
- user := setupUserAndLogin(t, env)
-
- // Create data on server (max_usn=3)
- bookUUID := apiCreateBook(t, env, user, "javascript", "creating book via API")
- apiCreateNote(t, env, user, bookUUID, "note1 content", "creating note1 via API")
- apiCreateNote(t, env, user, bookUUID, "note2 content", "creating note2 via API")
-
- // Create orphaned note locally (will fail to upload)
- orphanedNote := cliDatabase.Note{
- UUID: uuid.New().String(),
- BookUUID: uuid.New().String(), // non-existent book
- Body: "orphaned note content",
- AddedOn: 1234567890,
- EditedOn: 0,
- USN: 0,
- Deleted: false,
- Dirty: true,
- }
- if err := orphanedNote.Insert(env.DB); err != nil {
- t.Fatal(err)
- }
-
- // Run sync (downloads data, upload fails, retry gets 0 fragments)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // Verify last_max_usn is preserved at 3, not reset to 0
- var lastMaxUSN int
- cliDatabase.MustScan(t, "finding system last_max_usn",
- env.DB.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN),
- &lastMaxUSN)
-
- assert.Equal(t, lastMaxUSN, 3, "last_max_usn should be 3 after syncing")
-}
-
-// TestSync_ConcurrentInitialSync reproduces the issue where two clients with identical
-// local data syncing simultaneously to an empty server results in 500 errors.
-//
-// This demonstrates the race condition:
-// - Client1 starts sync to empty server, gets empty server state
-// - Client2 syncs.
-// - Client1 tries to create same books → 409 "duplicate"
-// - Client1 tries to create notes with wrong UUIDs → 500 "record not found"
-// - stepSync recovers by renaming local books with _2 suffix
-func TestSync_ConcurrentInitialSync(t *testing.T) {
- env := setupTestEnv(t)
-
- user := setupUserAndLogin(t, env)
-
- // Step 1: Create local data and sync
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "javascript", "-c", "js note from client1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 1,
- clientBookCount: 1,
- clientLastMaxUSN: 2,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 1,
- serverBookCount: 1,
- serverUserMaxUSN: 2,
- })
-
- // Step 2: Switch to new empty server to simulate concurrent initial sync scenario
- switchToEmptyServer(t, &env)
- user = setupUserAndLogin(t, env)
-
- // Set up client2 with separate database
- client2DB, client2DBPath := cliDatabase.InitTestFileDB(t)
- login(t, client2DB, env.ServerDB, user)
- client2DB.Close() // Close so CLI can access the database
-
- // Step 3: Client1 syncs to empty server, but during sync Client2 uploads same data
- // This simulates the race condition deterministically
- raceCallback := func(stdout io.Reader, stdin io.WriteCloser) error {
- // Wait for empty server prompt to ensure Client1 has called GetSyncState
- clitest.MustWaitForPrompt(t, stdout, clitest.PromptEmptyServer)
-
- // Now Client2 creates the same book and note via CLI (creating the race condition)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client2DBPath, "add", "javascript", "-c", "js note from client2")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client2DBPath, "sync")
-
- // User confirms sync
- if _, err := io.WriteString(stdin, "y\n"); err != nil {
- return errors.Wrap(err, "confirming sync")
- }
-
- return nil
- }
-
- // Client1 continues sync - will hit 409 conflict, then 500 error, then recover
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, raceCallback, cliBinaryName, "sync")
-
- // After sync:
- // - Server has 2 books: "javascript" (from client2) and "javascript_2" (from client1 renamed)
- // - Server has 2 notes
- // - Both clients should converge to the same state
- expectedState := systemState{
- clientNoteCount: 2, // both notes
- clientBookCount: 2, // javascript and javascript_2
- clientLastMaxUSN: 4, // 2 books + 2 notes
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- }
- checkState(t, env.DB, user, env.ServerDB, expectedState)
-
- // Client2 syncs again to download client1's data
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "--dbPath", client2DBPath, "sync")
- client2DB = clitest.MustOpenDatabase(t, client2DBPath)
- defer client2DB.Close()
-
- // Client2 should have converged to the same state as client1
- checkState(t, client2DB, user, env.ServerDB, expectedState)
-
- // Verify no orphaned notes on server
- var orphanedCount int
- if err := env.ServerDB.Raw(`
- SELECT COUNT(*) FROM notes
- WHERE book_uuid NOT IN (SELECT uuid FROM books)
- `).Scan(&orphanedCount).Error; err != nil {
- t.Fatal(err)
- }
- assert.Equal(t, orphanedCount, 0, "server should have no orphaned notes after sync")
-}
diff --git a/pkg/e2e/sync/empty_server_test.go b/pkg/e2e/sync/empty_server_test.go
deleted file mode 100644
index 31756ed2..00000000
--- a/pkg/e2e/sync/empty_server_test.go
+++ /dev/null
@@ -1,728 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package sync
-
-import (
- "database/sql"
- "fmt"
- "io"
- "os"
- "strconv"
- "strings"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/cli/consts"
- cliDatabase "github.com/dnote/dnote/pkg/cli/database"
- clitest "github.com/dnote/dnote/pkg/cli/testutils"
- "github.com/dnote/dnote/pkg/server/database"
- apitest "github.com/dnote/dnote/pkg/server/testutils"
- "github.com/pkg/errors"
-)
-
-func TestSync_EmptyServer(t *testing.T) {
- t.Run("sync to empty server after syncing to non-empty server", func(t *testing.T) {
- // Test server data loss/wipe scenario (disaster recovery):
- // Verify empty server detection works when the server loses all its data
-
- env := setupTestEnv(t)
-
- user := setupUserAndLogin(t, env)
-
- // Step 1: Create local data and sync to server
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // Verify sync succeeded
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // Step 2: Switch to a completely new empty server
- switchToEmptyServer(t, &env)
-
- // Recreate user and session on new server
- user = setupUserAndLogin(t, env)
-
- // Step 3: Sync again - should detect empty server and prompt user
- // User confirms with "y"
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.UserConfirmEmptyServerSync, cliBinaryName, "sync")
-
- // Step 4: Verify data was uploaded to the empty server
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // Verify the content is correct on both client and server
- var cliNote1JS, cliNote1CSS cliDatabase.Note
- var cliBookJS, cliBookCSS cliDatabase.Book
- cliDatabase.MustScan(t, "finding cliNote1JS", env.DB.QueryRow("SELECT uuid, body FROM notes WHERE body = ?", "js1"), &cliNote1JS.UUID, &cliNote1JS.Body)
- cliDatabase.MustScan(t, "finding cliNote1CSS", env.DB.QueryRow("SELECT uuid, body FROM notes WHERE body = ?", "css1"), &cliNote1CSS.UUID, &cliNote1CSS.Body)
- cliDatabase.MustScan(t, "finding cliBookJS", env.DB.QueryRow("SELECT uuid, label FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label)
- cliDatabase.MustScan(t, "finding cliBookCSS", env.DB.QueryRow("SELECT uuid, label FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label)
-
- assert.Equal(t, cliNote1JS.Body, "js1", "js note body mismatch")
- assert.Equal(t, cliNote1CSS.Body, "css1", "css note body mismatch")
- assert.Equal(t, cliBookJS.Label, "js", "js book label mismatch")
- assert.Equal(t, cliBookCSS.Label, "css", "css book label mismatch")
-
- // Verify on server side
- var serverNoteJS, serverNoteCSS database.Note
- var serverBookJS, serverBookCSS database.Book
- apitest.MustExec(t, env.ServerDB.Where("body = ?", "js1").First(&serverNoteJS), "finding server note js1")
- apitest.MustExec(t, env.ServerDB.Where("body = ?", "css1").First(&serverNoteCSS), "finding server note css1")
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "js").First(&serverBookJS), "finding server book js")
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "css").First(&serverBookCSS), "finding server book css")
-
- assert.Equal(t, serverNoteJS.Body, "js1", "server js note body mismatch")
- assert.Equal(t, serverNoteCSS.Body, "css1", "server css note body mismatch")
- assert.Equal(t, serverBookJS.Label, "js", "server js book label mismatch")
- assert.Equal(t, serverBookCSS.Label, "css", "server css book label mismatch")
- })
-
- t.Run("user cancels empty server prompt", func(t *testing.T) {
- env := setupTestEnv(t)
-
- user := setupUserAndLogin(t, env)
-
- // Step 1: Create local data and sync to server
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // Verify initial sync succeeded
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // Step 2: Switch to empty server
- switchToEmptyServer(t, &env)
- user = setupUserAndLogin(t, env)
-
- // Step 3: Sync again but user cancels with "n"
- output, err := clitest.WaitDnoteCmd(t, env.CmdOpts, clitest.UserCancelEmptyServerSync, cliBinaryName, "sync")
- if err == nil {
- t.Fatal("Expected sync to fail when user cancels, but it succeeded")
- }
-
- // Verify the prompt appeared
- if !strings.Contains(output, clitest.PromptEmptyServer) {
- t.Fatalf("Expected empty server warning in output, got: %s", output)
- }
-
- // Step 4: Verify local state unchanged (transaction rolled back)
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 0,
- serverBookCount: 0,
- serverUserMaxUSN: 0,
- })
-
- // Verify items still have original USN and dirty=false
- var book cliDatabase.Book
- var note cliDatabase.Note
- cliDatabase.MustScan(t, "checking book state", env.DB.QueryRow("SELECT usn, dirty FROM books WHERE label = ?", "js"), &book.USN, &book.Dirty)
- cliDatabase.MustScan(t, "checking note state", env.DB.QueryRow("SELECT usn, dirty FROM notes WHERE body = ?", "js1"), ¬e.USN, ¬e.Dirty)
-
- assert.NotEqual(t, book.USN, 0, "book USN should not be reset")
- assert.NotEqual(t, note.USN, 0, "note USN should not be reset")
- assert.Equal(t, book.Dirty, false, "book should not be marked dirty")
- assert.Equal(t, note.Dirty, false, "note should not be marked dirty")
- })
-
- t.Run("all local data is marked deleted - should not upload", func(t *testing.T) {
- // Test edge case: Server MaxUSN=0, local MaxUSN>0, but all items are deleted=true
- // Should NOT prompt because there's nothing to upload
-
- env := setupTestEnv(t)
-
- user := setupUserAndLogin(t, env)
-
- // Step 1: Create local data and sync to server
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // Verify initial sync succeeded
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // Step 2: Delete all local notes and books (mark as deleted)
- cliDatabase.MustExec(t, "marking all books deleted", env.DB, "UPDATE books SET deleted = 1")
- cliDatabase.MustExec(t, "marking all notes deleted", env.DB, "UPDATE notes SET deleted = 1")
-
- // Step 3: Switch to empty server
- switchToEmptyServer(t, &env)
- user = setupUserAndLogin(t, env)
-
- // Step 4: Sync - should NOT prompt because bookCount=0 and noteCount=0 (counting only deleted=0)
- // This should complete without user interaction
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // Verify no data was uploaded (server still empty, but client still has deleted items)
- // Check server is empty
- var serverNoteCount, serverBookCount int64
- apitest.MustExec(t, env.ServerDB.Model(&database.Note{}).Count(&serverNoteCount), "counting server notes")
- apitest.MustExec(t, env.ServerDB.Model(&database.Book{}).Count(&serverBookCount), "counting server books")
- assert.Equal(t, serverNoteCount, int64(0), "server should have no notes")
- assert.Equal(t, serverBookCount, int64(0), "server should have no books")
-
- // Check client still has the deleted items locally
- var clientNoteCount, clientBookCount int
- cliDatabase.MustScan(t, "counting client notes", env.DB.QueryRow("SELECT count(*) FROM notes WHERE deleted = 1"), &clientNoteCount)
- cliDatabase.MustScan(t, "counting client books", env.DB.QueryRow("SELECT count(*) FROM books WHERE deleted = 1"), &clientBookCount)
- assert.Equal(t, clientNoteCount, 2, "client should still have 2 deleted notes")
- assert.Equal(t, clientBookCount, 2, "client should still have 2 deleted books")
-
- // Verify lastMaxUSN was reset to 0
- var lastMaxUSN int
- cliDatabase.MustScan(t, "getting lastMaxUSN", env.DB.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN), &lastMaxUSN)
- assert.Equal(t, lastMaxUSN, 0, "lastMaxUSN should be reset to 0")
- })
-
- t.Run("race condition - other client uploads first", func(t *testing.T) {
- // This test exercises a race condition that can occur during sync:
- // While Client A is waiting for user input, Client B uploads data to the server.
- //
- // The empty server scenario is the natural place to test this because
- // an empty server detection triggers a prompt, at which point the test
- // can make client B upload data. We trigger the race condition deterministically.
- //
- // Test flow:
- // - Client A detects empty server and prompts user
- // - While waiting for confirmation, Client B uploads the same data via API
- // - Client A continues and handles the 409 conflict gracefully by:
- // 1. Detecting the 409 error when trying to CREATE books that already exist
- // 2. Running stepSync to pull the server's books (js, css)
- // 3. mergeBook renames local conflicts (js→js_2, css→css_2)
- // 4. Retrying sendChanges to upload the renamed books
- // - Result: Both clients' data is preserved (4 books total)
-
- env := setupTestEnv(t)
-
- user := setupUserAndLogin(t, env)
-
- // Step 1: Create local data and sync to establish lastMaxUSN > 0
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
-
- // Verify initial sync succeeded
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // Step 2: Switch to new empty server to simulate switching to empty server
- switchToEmptyServer(t, &env)
-
- // Create user on new server and login
- user = setupUserAndLogin(t, env)
-
- // Step 3: Trigger sync which will detect empty server and prompt user
- // Inside the callback (before confirming), we simulate Client B uploading via API.
- // We wait for the empty server prompt to ensure Client B uploads AFTER
- // GetSyncState but BEFORE the sync decision, creating the race condition deterministically
- raceCallback := func(stdout io.Reader, stdin io.WriteCloser) error {
- // First, wait for the prompt to ensure Client A has obtained the sync state from the server.
- clitest.MustWaitForPrompt(t, stdout, clitest.PromptEmptyServer)
-
- // Now Client B uploads the same data via API (after Client A got the sync state from the server
- // but before its sync decision)
- // This creates the race condition: Client A thinks server is empty, but Client B uploads data
- jsBookUUID := apiCreateBook(t, env, user, "js", "client B creating js book")
- cssBookUUID := apiCreateBook(t, env, user, "css", "client B creating css book")
- apiCreateNote(t, env, user, jsBookUUID, "js1", "client B creating js note")
- apiCreateNote(t, env, user, cssBookUUID, "css1", "client B creating css note")
-
- // Now user confirms
- if _, err := io.WriteString(stdin, "y\n"); err != nil {
- return errors.Wrap(err, "confirming sync")
- }
-
- return nil
- }
-
- // Step 4: Client A runs sync with race condition
- // The 409 conflict is automatically handled:
- // - When 409 is detected, isBehind flag is set
- // - stepSync pulls Client B's data
- // - mergeBook renames Client A's books to js_2, css_2
- // - Renamed books are uploaded
- // - Both clients' data is preserved.
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, raceCallback, cliBinaryName, "sync")
-
- // Verify final state - both clients' data preserved
- checkState(t, env.DB, user, env.ServerDB, systemState{
- clientNoteCount: 4, // Both clients' notes
- clientBookCount: 4, // js, css, js_2, css_2
- clientLastMaxUSN: 8, // 4 from Client B + 4 from Client A's renamed books/notes
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 4,
- serverBookCount: 4,
- serverUserMaxUSN: 8,
- })
-
- // Verify server has both clients' books
- var svrBookJS, svrBookCSS, svrBookJS2, svrBookCSS2 database.Book
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "js").First(&svrBookJS), "finding server book 'js'")
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "css").First(&svrBookCSS), "finding server book 'css'")
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "js_2").First(&svrBookJS2), "finding server book 'js_2'")
- apitest.MustExec(t, env.ServerDB.Where("label = ?", "css_2").First(&svrBookCSS2), "finding server book 'css_2'")
-
- assert.Equal(t, svrBookJS.Label, "js", "server should have book 'js' (Client B)")
- assert.Equal(t, svrBookCSS.Label, "css", "server should have book 'css' (Client B)")
- assert.Equal(t, svrBookJS2.Label, "js_2", "server should have book 'js_2' (Client A renamed)")
- assert.Equal(t, svrBookCSS2.Label, "css_2", "server should have book 'css_2' (Client A renamed)")
-
- // Verify client has all books
- var cliBookJS, cliBookCSS, cliBookJS2, cliBookCSS2 cliDatabase.Book
- cliDatabase.MustScan(t, "finding client book 'js'", env.DB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js"), &cliBookJS.UUID, &cliBookJS.Label, &cliBookJS.USN)
- cliDatabase.MustScan(t, "finding client book 'css'", env.DB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css"), &cliBookCSS.UUID, &cliBookCSS.Label, &cliBookCSS.USN)
- cliDatabase.MustScan(t, "finding client book 'js_2'", env.DB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "js_2"), &cliBookJS2.UUID, &cliBookJS2.Label, &cliBookJS2.USN)
- cliDatabase.MustScan(t, "finding client book 'css_2'", env.DB.QueryRow("SELECT uuid, label, usn FROM books WHERE label = ?", "css_2"), &cliBookCSS2.UUID, &cliBookCSS2.Label, &cliBookCSS2.USN)
-
- // Verify client UUIDs match server
- assert.Equal(t, cliBookJS.UUID, svrBookJS.UUID, "client 'js' UUID should match server")
- assert.Equal(t, cliBookCSS.UUID, svrBookCSS.UUID, "client 'css' UUID should match server")
- assert.Equal(t, cliBookJS2.UUID, svrBookJS2.UUID, "client 'js_2' UUID should match server")
- assert.Equal(t, cliBookCSS2.UUID, svrBookCSS2.UUID, "client 'css_2' UUID should match server")
-
- // Verify all items have non-zero USN (synced successfully)
- assert.NotEqual(t, cliBookJS.USN, 0, "client 'js' should have non-zero USN")
- assert.NotEqual(t, cliBookCSS.USN, 0, "client 'css' should have non-zero USN")
- assert.NotEqual(t, cliBookJS2.USN, 0, "client 'js_2' should have non-zero USN")
- assert.NotEqual(t, cliBookCSS2.USN, 0, "client 'css_2' should have non-zero USN")
- })
-
- t.Run("sync to server A, then B, then back to A, then back to B", func(t *testing.T) {
- // Test switching between two actual servers to verify:
- // 1. Empty server detection works when switching to empty server
- // 2. No false detection when switching back to non-empty servers
- // 3. Both servers maintain independent state across multiple switches
-
- env := setupTestEnv(t)
-
- // Create Server A with its own database
- serverA, serverDBA, err := setupTestServer(t, serverTime)
- if err != nil {
- t.Fatal(errors.Wrap(err, "setting up server A"))
- }
- defer serverA.Close()
-
- // Create Server B with its own database
- serverB, serverDBB, err := setupTestServer(t, serverTime)
- if err != nil {
- t.Fatal(errors.Wrap(err, "setting up server B"))
- }
- defer serverB.Close()
-
- // Step 1: Set up user on Server A and sync
- apiEndpointA := fmt.Sprintf("%s/api", serverA.URL)
-
- userA := apitest.SetupUserData(serverDBA, "alice@example.com", "pass1234")
- sessionA := apitest.SetupSession(serverDBA, userA)
- cliDatabase.MustExec(t, "inserting session_key", env.DB, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKey, sessionA.Key)
- cliDatabase.MustExec(t, "inserting session_key_expiry", env.DB, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKeyExpiry, sessionA.ExpiresAt.Unix())
-
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync", "--apiEndpoint", apiEndpointA)
-
- // Verify sync to Server A succeeded
- checkState(t, env.DB, userA, serverDBA, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // Step 2: Switch to Server B (empty) and sync
- apiEndpointB := fmt.Sprintf("%s/api", serverB.URL)
-
- // Set up user on Server B
- userB := apitest.SetupUserData(serverDBB, "alice@example.com", "pass1234")
- sessionB := apitest.SetupSession(serverDBB, userB)
- cliDatabase.MustExec(t, "updating session_key for B", env.DB, "UPDATE system SET value = ? WHERE key = ?", sessionB.Key, consts.SystemSessionKey)
- cliDatabase.MustExec(t, "updating session_key_expiry for B", env.DB, "UPDATE system SET value = ? WHERE key = ?", sessionB.ExpiresAt.Unix(), consts.SystemSessionKeyExpiry)
-
- // Should detect empty server and prompt
- clitest.MustWaitDnoteCmd(t, env.CmdOpts, clitest.UserConfirmEmptyServerSync, cliBinaryName, "sync", "--apiEndpoint", apiEndpointB)
-
- // Verify Server B now has data
- checkState(t, env.DB, userB, serverDBB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // Step 3: Switch back to Server A and sync
- cliDatabase.MustExec(t, "updating session_key back to A", env.DB, "UPDATE system SET value = ? WHERE key = ?", sessionA.Key, consts.SystemSessionKey)
- cliDatabase.MustExec(t, "updating session_key_expiry back to A", env.DB, "UPDATE system SET value = ? WHERE key = ?", sessionA.ExpiresAt.Unix(), consts.SystemSessionKeyExpiry)
-
- // Should NOT trigger empty server detection (Server A has MaxUSN > 0)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync", "--apiEndpoint", apiEndpointA)
-
- // Verify Server A still has its data
- checkState(t, env.DB, userA, serverDBA, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
-
- // Step 4: Switch back to Server B and sync again
- cliDatabase.MustExec(t, "updating session_key back to B", env.DB, "UPDATE system SET value = ? WHERE key = ?", sessionB.Key, consts.SystemSessionKey)
- cliDatabase.MustExec(t, "updating session_key_expiry back to B", env.DB, "UPDATE system SET value = ? WHERE key = ?", sessionB.ExpiresAt.Unix(), consts.SystemSessionKeyExpiry)
-
- // Should NOT trigger empty server detection (Server B now has MaxUSN > 0 from Step 2)
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync", "--apiEndpoint", apiEndpointB)
-
- // Verify both servers maintain independent state
- checkState(t, env.DB, userB, serverDBB, systemState{
- clientNoteCount: 2,
- clientBookCount: 2,
- clientLastMaxUSN: 4,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 2,
- serverBookCount: 2,
- serverUserMaxUSN: 4,
- })
- })
-
- t.Run("two clients with identical copied database sync to empty server", func(t *testing.T) {
- // Suppose we have two clients and server becomes empty (migration).
- // After the first client sync to empty server, the second client should trigger full sync.
- // Without the full sync, client2 will do step sync asking for changes after its stale USN,
- // get nothing from server, and potentially orphan notes during full sync.
-
- // Step 1: Create client1 with data and sync to ORIGINAL server
- env1 := setupTestEnv(t)
- user := setupUserAndLogin(t, env1)
-
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "add", "js", "-c", "js1")
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "add", "css", "-c", "css1")
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "sync")
- // Add more data to create a higher USN
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "add", "go", "-c", "go1")
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "add", "rust", "-c", "rust1")
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "sync")
- // Verify initial sync succeeded (now with 4 notes, 4 books, USN=8)
- checkState(t, env1.DB, user, env1.ServerDB, systemState{
- clientNoteCount: 4,
- clientBookCount: 4,
- clientLastMaxUSN: 8,
- clientLastSyncAt: serverTime.Unix(),
- serverNoteCount: 4,
- serverBookCount: 4,
- serverUserMaxUSN: 8,
- })
-
- // Step 2: Create client2 by copying client1's database (simulating same DB on two devices)
- env2 := setupTestEnv(t)
- // Copy the database file from client1 to client2
- dbPath1 := env1.DB.Filepath
- dbPath2 := env2.DB.Filepath
- // Close both DBs before copying
- env1.DB.Close()
- env2.DB.Close()
-
- // Copy the database file
- input, err := os.ReadFile(dbPath1)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reading client1 database"))
- }
- if err := os.WriteFile(dbPath2, input, 0644); err != nil {
- t.Fatal(errors.Wrap(err, "writing client2 database"))
- }
-
- // Reopen databases
- env1.DB, err = cliDatabase.Open(dbPath1)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reopening client1 database"))
- }
- env2.DB, err = cliDatabase.Open(dbPath2)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reopening client2 database"))
- }
-
- // Verify client2 has identical data and USN=8 (stale) - same as client1
- // Note: at this point there's no server to compare against, we just check counts
- var client2MaxUSN, client2NoteCount, client2BookCount int
- cliDatabase.MustScan(t, "getting client2 maxUSN",
- env2.DB.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN),
- &client2MaxUSN)
- cliDatabase.MustScan(t, "counting client2 notes",
- env2.DB.QueryRow("SELECT count(*) FROM notes WHERE deleted = 0"),
- &client2NoteCount)
- cliDatabase.MustScan(t, "counting client2 books",
- env2.DB.QueryRow("SELECT count(*) FROM books WHERE deleted = 0"),
- &client2BookCount)
-
- assert.Equal(t, client2MaxUSN, 8, "client2 should have same maxUSN=8 as client1")
- assert.Equal(t, client2NoteCount, 4, "client2 should have 4 notes")
- assert.Equal(t, client2BookCount, 4, "client2 should have 4 books")
-
- // Step 3: Switch client1 to new empty server
- switchToEmptyServer(t, &env1)
-
- // Point client2 to the same new server
- env2.Server = env1.Server
- env2.ServerDB = env1.ServerDB
-
- // Update client2's API endpoint config to point to env1's server
- apiEndpoint := fmt.Sprintf("%s/api", env1.Server.URL)
- updateConfigAPIEndpoint(t, env2.TmpDir, apiEndpoint)
-
- // Create same user on new server
- user = setupUserAndLogin(t, env1)
-
- // Setup session for client2 (same user, same server)
- login(t, env2.DB, env2.ServerDB, user)
-
- // Step 4: Client1 syncs ONLY FIRST 2 BOOKS to empty server (simulates partial upload)
- // This creates the stale USN scenario: client2 has maxUSN=8, but server will only have maxUSN=4
- clitest.MustWaitDnoteCmd(t, env1.CmdOpts, clitest.UserConfirmEmptyServerSync,
- cliBinaryName, "sync")
-
- // Delete the last 2 books from client1 to prevent them being on server
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "remove", "go", "-y")
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "remove", "rust", "-y")
-
- // Sync deletions to server
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "sync")
-
- // Verify server has 2 active books/notes (go/rust deleted)
- var serverNoteCount, serverBookCount int64
- apitest.MustExec(t, env1.ServerDB.Model(&database.Note{}).Where("deleted = ?", false).Count(&serverNoteCount), "counting active server notes")
- apitest.MustExec(t, env1.ServerDB.Model(&database.Book{}).Where("deleted = ?", false).Count(&serverBookCount), "counting active server books")
- assert.Equal(t, int(serverNoteCount), 2, "server should have 2 active notes (go/rust deleted)")
- assert.Equal(t, int(serverBookCount), 2, "server should have 2 active books (go/rust deleted)")
-
- // Step 5: Client2 syncs
- // CRITICAL: Client2 has lastMaxUSN=8 (from copied DB), but server's max_usn is now ~8 but only has 2 books
- // Client2 will ask for changes after USN=8, get nothing, then try to upload its 4 books
- // This should trigger the orphaned notes scenario or require full sync
- clitest.RunDnoteCmd(t, env2.CmdOpts, cliBinaryName, "sync")
-
- // Step 6: Verify client2 has all data and NO orphaned notes
- var orphanedCount int
- cliDatabase.MustScan(t, "checking for orphaned notes",
- env2.DB.QueryRow(`
- SELECT COUNT(*) FROM notes
- WHERE deleted = 0
- AND book_uuid NOT IN (SELECT uuid FROM books WHERE deleted = 0)
- `), &orphanedCount)
-
- assert.Equal(t, orphanedCount, 0, "client2 should have no orphaned notes")
-
- // Verify client2 converged with server state
- // Note: checkState counts ALL records (including deleted ones)
- // During full sync, cleanLocalBooks/cleanLocalNotes DELETE local records not on server
- // So client2 ends up with only the 2 active books/notes
- // Server has 4 total (2 active + 2 deleted)
- var client2LastMaxUSN, client2LastSyncAt int
- var serverUserMaxUSN int
- cliDatabase.MustScan(t, "getting client2 lastMaxUSN",
- env2.DB.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN),
- &client2LastMaxUSN)
- var lastSyncAtStr string
- cliDatabase.MustScan(t, "getting client2 lastSyncAt",
- env2.DB.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastSyncAt),
- &lastSyncAtStr)
- lastSyncAtInt, _ := strconv.ParseInt(lastSyncAtStr, 10, 64)
- client2LastSyncAt = int(lastSyncAtInt)
-
- apitest.MustExec(t, env2.ServerDB.Table("users").Select("max_usn").Where("id = ?", user.ID).Scan(&serverUserMaxUSN), "getting server user max_usn")
-
- checkState(t, env2.DB, user, env2.ServerDB, systemState{
- clientNoteCount: 2, // Only active notes (deleted ones removed by cleanLocalNotes)
- clientBookCount: 2, // Only active books (deleted ones removed by cleanLocalBooks)
- clientLastMaxUSN: client2LastMaxUSN,
- clientLastSyncAt: int64(client2LastSyncAt),
- serverNoteCount: 4, // 2 active + 2 deleted
- serverBookCount: 4, // 2 active + 2 deleted
- serverUserMaxUSN: serverUserMaxUSN,
- })
-
- // Verify both clients have the expected books (css, js only - go/rust deleted)
- var client1BookCSS, client1BookJS, client2BookCSS, client2BookJS cliDatabase.Book
- cliDatabase.MustScan(t, "finding client1 book 'css'",
- env1.DB.QueryRow("SELECT uuid, label FROM books WHERE label = ? AND deleted = 0", "css"),
- &client1BookCSS.UUID, &client1BookCSS.Label)
- cliDatabase.MustScan(t, "finding client1 book 'js'",
- env1.DB.QueryRow("SELECT uuid, label FROM books WHERE label = ? AND deleted = 0", "js"),
- &client1BookJS.UUID, &client1BookJS.Label)
- cliDatabase.MustScan(t, "finding client2 book 'css'",
- env2.DB.QueryRow("SELECT uuid, label FROM books WHERE label = ? AND deleted = 0", "css"),
- &client2BookCSS.UUID, &client2BookCSS.Label)
- cliDatabase.MustScan(t, "finding client2 book 'js'",
- env2.DB.QueryRow("SELECT uuid, label FROM books WHERE label = ? AND deleted = 0", "js"),
- &client2BookJS.UUID, &client2BookJS.Label)
-
- assert.Equal(t, client1BookCSS.Label, "css", "client1 should have css book")
- assert.Equal(t, client1BookJS.Label, "js", "client1 should have js book")
- assert.Equal(t, client2BookCSS.Label, "css", "client2 should have css book")
- assert.Equal(t, client2BookJS.Label, "js", "client2 should have js book")
-
- // Verify go and rust books are deleted/absent on both clients
- var client2BookGo, client2BookRust cliDatabase.Book
- errGo := env2.DB.QueryRow("SELECT uuid, label FROM books WHERE label = ? AND deleted = 0", "go").Scan(&client2BookGo.UUID, &client2BookGo.Label)
- assert.Equal(t, errGo, sql.ErrNoRows, "client2 should not have non-deleted 'go' book")
- errRust := env2.DB.QueryRow("SELECT uuid, label FROM books WHERE label = ? AND deleted = 0", "rust").Scan(&client2BookRust.UUID, &client2BookRust.Label)
- assert.Equal(t, errRust, sql.ErrNoRows, "client2 should not have non-deleted 'rust' book")
- })
-
- t.Run("client with local data syncs after another client uploads to empty server - should not orphan notes", func(t *testing.T) {
- // This test reproduces the scenario where:
- // 1. Client1 has local data and syncs to original server
- // 2. Client2 has DIFFERENT local data and syncs to SAME original server
- // 3. Both clients switch to NEW empty server
- // 4. Client1 uploads to the new empty server (sets FullSyncBefore)
- // 5. Client2 syncs - should trigger full sync AND upload its local data
- // WITHOUT orphaning notes due to cleanLocalBooks deleting them first
-
- // Step 1: Create client1 with local data on original server
- env1 := setupTestEnv(t)
- user := setupUserAndLogin(t, env1)
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "add", "client1-book", "-c", "client1-note")
- clitest.RunDnoteCmd(t, env1.CmdOpts, cliBinaryName, "sync")
-
- // Step 2: Create client2 with DIFFERENT local data on SAME original server
- env2 := setupTestEnv(t)
- // Point env2 to env1's server (the original server)
- env2.Server = env1.Server
- env2.ServerDB = env1.ServerDB
- apiEndpoint := fmt.Sprintf("%s/api", env1.Server.URL)
- updateConfigAPIEndpoint(t, env2.TmpDir, apiEndpoint)
-
- // Login client2 to the same server
- login(t, env2.DB, env2.ServerDB, user)
- clitest.RunDnoteCmd(t, env2.CmdOpts, cliBinaryName, "add", "client2-book", "-c", "client2-note")
- clitest.RunDnoteCmd(t, env2.CmdOpts, cliBinaryName, "sync")
-
- // Step 3: Both clients switch to NEW empty server
- switchToEmptyServer(t, &env1)
- env2.Server = env1.Server
- env2.ServerDB = env1.ServerDB
- apiEndpoint = fmt.Sprintf("%s/api", env1.Server.URL)
- updateConfigAPIEndpoint(t, env2.TmpDir, apiEndpoint)
-
- // Create same user on new server
- user = setupUserAndLogin(t, env1)
- login(t, env2.DB, env2.ServerDB, user)
-
- // Step 4: Client1 uploads to empty server
- clitest.MustWaitDnoteCmd(t, env1.CmdOpts, clitest.UserConfirmEmptyServerSync, cliBinaryName, "sync")
-
- // Verify server has client1's data and FullSyncBefore is set
- var serverUser database.User
- apitest.MustExec(t, env1.ServerDB.Where("id = ?", user.ID).First(&serverUser), "getting server user state")
- assert.Equal(t, serverUser.MaxUSN > 0, true, "server should have data after client1 upload")
- assert.Equal(t, serverUser.FullSyncBefore > 0, true, "server should have FullSyncBefore set")
-
- // Step 5: Client2 syncs - should trigger full sync due to FullSyncBefore
- // CRITICAL: Client2 has local data (client2-book, client2-note) that should be uploaded
- // Without the fix, cleanLocalBooks will delete client2-book before upload, orphaning client2-note
- clitest.RunDnoteCmd(t, env2.CmdOpts, cliBinaryName, "sync")
-
- // Step 6: Verify NO orphaned notes on client2
- var orphanedCount int
- cliDatabase.MustScan(t, "checking for orphaned notes on client2",
- env2.DB.QueryRow(`
- SELECT COUNT(*) FROM notes
- WHERE deleted = 0
- AND book_uuid NOT IN (SELECT uuid FROM books WHERE deleted = 0)
- `), &orphanedCount)
-
- assert.Equal(t, orphanedCount, 0, "client2 should have no orphaned notes after sync")
-
- // Step 7: Verify client2's data was uploaded to server
- var client2BookOnServer database.Book
- err := env2.ServerDB.Where("label = ? AND deleted = ?", "client2-book", false).First(&client2BookOnServer).Error
- assert.Equal(t, err, nil, "client2-book should exist on server")
-
- var client2NoteOnServer database.Note
- err = env2.ServerDB.Where("body = ? AND deleted = ?", "client2-note", false).First(&client2NoteOnServer).Error
- assert.Equal(t, err, nil, "client2-note should exist on server")
-
- // Step 8: Verify server has data from BOTH clients
- // Note: Both clients had synced to original server, so they each have 2 books + 2 notes locally.
- // When switching to new empty server, client1 uploads 2 books + 2 notes (USN 1-4).
- // Client2 then does full sync, downloads client1's uploads, marks its local data as dirty,
- // and uploads its version of the same 2 books + 2 notes with potentially different UUIDs.
- // The exact count depends on UUID conflict resolution, but we verify both original books exist.
- var serverBookCount, serverNoteCount int64
- apitest.MustExec(t, env2.ServerDB.Model(&database.Book{}).Where("deleted = ?", false).Count(&serverBookCount), "counting active server books")
- apitest.MustExec(t, env2.ServerDB.Model(&database.Note{}).Where("deleted = ?", false).Count(&serverNoteCount), "counting active server notes")
-
- // The main assertion: both original client books should exist
- var client1BookExists, client2BookExists bool
- err = env2.ServerDB.Model(&database.Book{}).Where("label = ? AND deleted = ?", "client1-book", false).First(&database.Book{}).Error
- client1BookExists = (err == nil)
- err = env2.ServerDB.Model(&database.Book{}).Where("label = ? AND deleted = ?", "client2-book", false).First(&database.Book{}).Error
- client2BookExists = (err == nil)
-
- assert.Equal(t, client1BookExists, true, "server should have client1-book")
- assert.Equal(t, client2BookExists, true, "server should have client2-book")
- assert.Equal(t, serverBookCount >= 2, true, "server should have at least 2 books")
- assert.Equal(t, serverNoteCount >= 2, true, "server should have at least 2 notes")
- })
-}
diff --git a/pkg/e2e/sync/main_test.go b/pkg/e2e/sync/main_test.go
deleted file mode 100644
index 188e3a99..00000000
--- a/pkg/e2e/sync/main_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package sync
-
-import (
- "bytes"
- "fmt"
- "log"
- "os"
- "os/exec"
- "testing"
- "time"
-
- "github.com/pkg/errors"
-)
-
-var cliBinaryName string
-var serverTime = time.Date(2017, time.March, 14, 21, 15, 0, 0, time.UTC)
-
-var testDir = "./tmp/"
-
-func init() {
- cliBinaryName = fmt.Sprintf("%s/test-cli", testDir)
-}
-
-func TestMain(m *testing.M) {
- // Build CLI binary without hardcoded API endpoint
- // Each test will create its own server and config file
- cmd := exec.Command("go", "build", "--tags", "fts5", "-o", cliBinaryName, "github.com/dnote/dnote/pkg/cli")
-
- var stderr bytes.Buffer
- cmd.Stderr = &stderr
-
- if err := cmd.Run(); err != nil {
- log.Print(errors.Wrap(err, "building a CLI binary").Error())
- log.Print(stderr.String())
- os.Exit(1)
- }
-
- os.Exit(m.Run())
-}
diff --git a/pkg/e2e/sync/testutils.go b/pkg/e2e/sync/testutils.go
deleted file mode 100644
index a5dfdf87..00000000
--- a/pkg/e2e/sync/testutils.go
+++ /dev/null
@@ -1,295 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package sync
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "net/http"
- "net/http/httptest"
- "os"
- "path/filepath"
- "strings"
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/cli/consts"
- cliDatabase "github.com/dnote/dnote/pkg/cli/database"
- clitest "github.com/dnote/dnote/pkg/cli/testutils"
- "github.com/dnote/dnote/pkg/clock"
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/controllers"
- "github.com/dnote/dnote/pkg/server/database"
- apitest "github.com/dnote/dnote/pkg/server/testutils"
- "github.com/pkg/errors"
- "gorm.io/gorm"
-)
-
-// testEnv holds the test environment for a single test
-type testEnv struct {
- DB *cliDatabase.DB
- CmdOpts clitest.RunDnoteCmdOptions
- Server *httptest.Server
- ServerDB *gorm.DB
- TmpDir string
-}
-
-// setupTestEnv creates an isolated test environment with its own database and temp directory
-func setupTestEnv(t *testing.T) testEnv {
- tmpDir := t.TempDir()
-
- // Create .dnote directory
- dnoteDir := filepath.Join(tmpDir, consts.DnoteDirName)
- if err := os.MkdirAll(dnoteDir, 0755); err != nil {
- t.Fatal(errors.Wrap(err, "creating dnote directory"))
- }
-
- // Create database at the expected path
- dbPath := filepath.Join(dnoteDir, consts.DnoteDBFileName)
- db := cliDatabase.InitTestFileDBRaw(t, dbPath)
-
- // Create server
- server, serverDB := setupNewServer(t)
-
- // Create config file with this server's endpoint
- apiEndpoint := fmt.Sprintf("%s/api", server.URL)
- updateConfigAPIEndpoint(t, tmpDir, apiEndpoint)
-
- // Create command options with XDG paths pointing to temp dir
- cmdOpts := clitest.RunDnoteCmdOptions{
- Env: []string{
- fmt.Sprintf("XDG_CONFIG_HOME=%s", tmpDir),
- fmt.Sprintf("XDG_DATA_HOME=%s", tmpDir),
- fmt.Sprintf("XDG_CACHE_HOME=%s", tmpDir),
- },
- }
-
- return testEnv{
- DB: db,
- CmdOpts: cmdOpts,
- Server: server,
- ServerDB: serverDB,
- TmpDir: tmpDir,
- }
-}
-
-// setupTestServer creates a test server with its own database
-func setupTestServer(t *testing.T, serverTime time.Time) (*httptest.Server, *gorm.DB, error) {
- db := apitest.InitMemoryDB(t)
-
- mockClock := clock.NewMock()
- mockClock.SetNow(serverTime)
-
- a := app.NewTest()
- a.Clock = mockClock
- a.EmailBackend = &apitest.MockEmailbackendImplementation{}
- a.DB = db
-
- server, err := controllers.NewServer(&a)
- if err != nil {
- return nil, nil, errors.Wrap(err, "initializing server")
- }
-
- return server, db, nil
-}
-
-// setupNewServer creates a new server and returns the server and database.
-// This is useful when a test needs to switch to a new empty server.
-func setupNewServer(t *testing.T) (*httptest.Server, *gorm.DB) {
- server, serverDB, err := setupTestServer(t, serverTime)
- if err != nil {
- t.Fatal(errors.Wrap(err, "setting up new test server"))
- }
- t.Cleanup(func() { server.Close() })
-
- return server, serverDB
-}
-
-// updateConfigAPIEndpoint updates the config file with the given API endpoint
-func updateConfigAPIEndpoint(t *testing.T, tmpDir string, apiEndpoint string) {
- dnoteDir := filepath.Join(tmpDir, consts.DnoteDirName)
- configPath := filepath.Join(dnoteDir, consts.ConfigFilename)
- configContent := fmt.Sprintf("apiEndpoint: %s\n", apiEndpoint)
- if err := os.WriteFile(configPath, []byte(configContent), 0644); err != nil {
- t.Fatal(errors.Wrap(err, "writing config file"))
- }
-}
-
-// switchToEmptyServer closes the current server and creates a new empty server,
-// updating the config file to point to it.
-func switchToEmptyServer(t *testing.T, env *testEnv) {
- // Close old server
- env.Server.Close()
-
- // Create new empty server
- env.Server, env.ServerDB = setupNewServer(t)
-
- // Update config file to point to new server
- apiEndpoint := fmt.Sprintf("%s/api", env.Server.URL)
- updateConfigAPIEndpoint(t, env.TmpDir, apiEndpoint)
-}
-
-// setupUser creates a test user in the server database
-func setupUser(t *testing.T, env testEnv) database.User {
- user := apitest.SetupUserData(env.ServerDB, "alice@example.com", "pass1234")
-
- return user
-}
-
-// setupUserAndLogin creates a test user and logs them in on the CLI
-func setupUserAndLogin(t *testing.T, env testEnv) database.User {
- user := setupUser(t, env)
- login(t, env.DB, env.ServerDB, user)
-
- return user
-}
-
-// login logs in the user in CLI
-func login(t *testing.T, db *cliDatabase.DB, serverDB *gorm.DB, user database.User) {
- session := apitest.SetupSession(serverDB, user)
-
- cliDatabase.MustExec(t, "inserting session_key", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKey, session.Key)
- cliDatabase.MustExec(t, "inserting session_key_expiry", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKeyExpiry, session.ExpiresAt.Unix())
-}
-
-// apiCreateBook creates a book via the API and returns its UUID
-func apiCreateBook(t *testing.T, env testEnv, user database.User, name, message string) string {
- res := doHTTPReq(t, env, "POST", "/v3/books", fmt.Sprintf(`{"name": "%s"}`, name), message, user)
-
- var resp controllers.CreateBookResp
- if err := json.NewDecoder(res.Body).Decode(&resp); err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload for adding book"))
- return ""
- }
-
- return resp.Book.UUID
-}
-
-// apiPatchBook updates a book via the API
-func apiPatchBook(t *testing.T, env testEnv, user database.User, uuid, payload, message string) {
- doHTTPReq(t, env, "PATCH", fmt.Sprintf("/v3/books/%s", uuid), payload, message, user)
-}
-
-// apiDeleteBook deletes a book via the API
-func apiDeleteBook(t *testing.T, env testEnv, user database.User, uuid, message string) {
- doHTTPReq(t, env, "DELETE", fmt.Sprintf("/v3/books/%s", uuid), "", message, user)
-}
-
-// apiCreateNote creates a note via the API and returns its UUID
-func apiCreateNote(t *testing.T, env testEnv, user database.User, bookUUID, body, message string) string {
- res := doHTTPReq(t, env, "POST", "/v3/notes", fmt.Sprintf(`{"book_uuid": "%s", "content": "%s"}`, bookUUID, body), message, user)
-
- var resp controllers.CreateNoteResp
- if err := json.NewDecoder(res.Body).Decode(&resp); err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload for adding note"))
- return ""
- }
-
- return resp.Result.UUID
-}
-
-// apiPatchNote updates a note via the API
-func apiPatchNote(t *testing.T, env testEnv, user database.User, noteUUID, payload, message string) {
- doHTTPReq(t, env, "PATCH", fmt.Sprintf("/v3/notes/%s", noteUUID), payload, message, user)
-}
-
-// apiDeleteNote deletes a note via the API
-func apiDeleteNote(t *testing.T, env testEnv, user database.User, noteUUID, message string) {
- doHTTPReq(t, env, "DELETE", fmt.Sprintf("/v3/notes/%s", noteUUID), "", message, user)
-}
-
-// doHTTPReq performs an authenticated HTTP request and checks for errors
-func doHTTPReq(t *testing.T, env testEnv, method, path, payload, message string, user database.User) *http.Response {
- apiEndpoint := fmt.Sprintf("%s/api", env.Server.URL)
- endpoint := fmt.Sprintf("%s%s", apiEndpoint, path)
-
- req, err := http.NewRequest(method, endpoint, strings.NewReader(payload))
- if err != nil {
- panic(errors.Wrap(err, "constructing http request"))
- }
-
- res := apitest.HTTPAuthDo(t, env.ServerDB, req, user)
- if res.StatusCode >= 400 {
- bs, err := io.ReadAll(res.Body)
- if err != nil {
- panic(errors.Wrap(err, "parsing response body for error"))
- }
-
- t.Errorf("%s. HTTP status %d. Message: %s", message, res.StatusCode, string(bs))
- }
-
- return res
-}
-
-// setupFunc is a function that sets up test data and returns IDs for assertions
-type setupFunc func(t *testing.T, env testEnv, user database.User) map[string]string
-
-// assertFunc is a function that asserts the expected state after sync
-type assertFunc func(t *testing.T, env testEnv, user database.User, ids map[string]string)
-
-// testSyncCmd is a test helper that sets up a test environment, runs setup, syncs, and asserts
-func testSyncCmd(t *testing.T, fullSync bool, setup setupFunc, assert assertFunc) {
- env := setupTestEnv(t)
-
- user := setupUserAndLogin(t, env)
- ids := setup(t, env, user)
-
- if fullSync {
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync", "-f")
- } else {
- clitest.RunDnoteCmd(t, env.CmdOpts, cliBinaryName, "sync")
- }
-
- assert(t, env, user, ids)
-}
-
-// systemState represents the expected state of the sync system
-type systemState struct {
- clientNoteCount int
- clientBookCount int
- clientLastMaxUSN int
- clientLastSyncAt int64
- serverNoteCount int64
- serverBookCount int64
- serverUserMaxUSN int
-}
-
-// checkState compares the state of the client and the server with the given system state
-func checkState(t *testing.T, clientDB *cliDatabase.DB, user database.User, serverDB *gorm.DB, expected systemState) {
- var clientBookCount, clientNoteCount int
- cliDatabase.MustScan(t, "counting client notes", clientDB.QueryRow("SELECT count(*) FROM notes"), &clientNoteCount)
- cliDatabase.MustScan(t, "counting client books", clientDB.QueryRow("SELECT count(*) FROM books"), &clientBookCount)
- assert.Equal(t, clientNoteCount, expected.clientNoteCount, "client note count mismatch")
- assert.Equal(t, clientBookCount, expected.clientBookCount, "client book count mismatch")
-
- var clientLastMaxUSN int
- var clientLastSyncAt int64
- cliDatabase.MustScan(t, "finding system last_max_usn", clientDB.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastMaxUSN), &clientLastMaxUSN)
- cliDatabase.MustScan(t, "finding system last_sync_at", clientDB.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastSyncAt), &clientLastSyncAt)
- assert.Equal(t, clientLastMaxUSN, expected.clientLastMaxUSN, "client last_max_usn mismatch")
- assert.Equal(t, clientLastSyncAt, expected.clientLastSyncAt, "client last_sync_at mismatch")
-
- var serverBookCount, serverNoteCount int64
- apitest.MustExec(t, serverDB.Model(&database.Note{}).Count(&serverNoteCount), "counting server notes")
- apitest.MustExec(t, serverDB.Model(&database.Book{}).Count(&serverBookCount), "counting api notes")
- assert.Equal(t, serverNoteCount, expected.serverNoteCount, "server note count mismatch")
- assert.Equal(t, serverBookCount, expected.serverBookCount, "server book count mismatch")
- var serverUser database.User
- apitest.MustExec(t, serverDB.Where("id = ?", user.ID).First(&serverUser), "finding user")
- assert.Equal(t, serverUser.MaxUSN, expected.serverUserMaxUSN, "user max_usn mismatch")
-}
diff --git a/pkg/prompt/prompt.go b/pkg/prompt/prompt.go
deleted file mode 100644
index 262685e9..00000000
--- a/pkg/prompt/prompt.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Package prompt provides utilities for interactive yes/no prompts
-package prompt
-
-import (
- "bufio"
- "fmt"
- "io"
- "strings"
-)
-
-// FormatQuestion formats a yes/no question with the appropriate choice indicator
-func FormatQuestion(question string, optimistic bool) string {
- choices := "(y/N)"
- if optimistic {
- choices = "(Y/n)"
- }
- return fmt.Sprintf("%s %s", question, choices)
-}
-
-// ReadYesNo reads and parses a yes/no response from the given reader.
-// Returns true if confirmed, respecting optimistic mode.
-// In optimistic mode, empty input is treated as confirmation.
-func ReadYesNo(r io.Reader, optimistic bool) (bool, error) {
- reader := bufio.NewReader(r)
- input, err := reader.ReadString('\n')
- if err != nil {
- return false, err
- }
-
- input = strings.ToLower(strings.TrimSpace(input))
- confirmed := input == "y"
-
- if optimistic {
- confirmed = confirmed || input == ""
- }
-
- return confirmed, nil
-}
diff --git a/pkg/prompt/prompt_test.go b/pkg/prompt/prompt_test.go
deleted file mode 100644
index 6d5eb597..00000000
--- a/pkg/prompt/prompt_test.go
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package prompt
-
-import (
- "strings"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
-)
-
-func TestFormatQuestion(t *testing.T) {
- testCases := []struct {
- question string
- optimistic bool
- expected string
- }{
- {
- question: "Are you sure?",
- optimistic: false,
- expected: "Are you sure? (y/N)",
- },
- {
- question: "Continue?",
- optimistic: true,
- expected: "Continue? (Y/n)",
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.question, func(t *testing.T) {
- result := FormatQuestion(tc.question, tc.optimistic)
- assert.Equal(t, result, tc.expected, "formatted question mismatch")
- })
- }
-}
-
-func TestReadYesNo(t *testing.T) {
- testCases := []struct {
- name string
- input string
- optimistic bool
- expected bool
- }{
- {
- name: "pessimistic with y",
- input: "y\n",
- optimistic: false,
- expected: true,
- },
- {
- name: "pessimistic with Y (uppercase)",
- input: "Y\n",
- optimistic: false,
- expected: true,
- },
- {
- name: "pessimistic with n",
- input: "n\n",
- optimistic: false,
- expected: false,
- },
- {
- name: "pessimistic with empty",
- input: "\n",
- optimistic: false,
- expected: false,
- },
- {
- name: "pessimistic with whitespace",
- input: " \n",
- optimistic: false,
- expected: false,
- },
- {
- name: "optimistic with y",
- input: "y\n",
- optimistic: true,
- expected: true,
- },
- {
- name: "optimistic with n",
- input: "n\n",
- optimistic: true,
- expected: false,
- },
- {
- name: "optimistic with empty",
- input: "\n",
- optimistic: true,
- expected: true,
- },
- {
- name: "optimistic with whitespace",
- input: " \n",
- optimistic: true,
- expected: true,
- },
- {
- name: "invalid input defaults to no",
- input: "maybe\n",
- optimistic: false,
- expected: false,
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- // Create a reader with test input
- reader := strings.NewReader(tc.input)
-
- // Test ReadYesNo
- result, err := ReadYesNo(reader, tc.optimistic)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- assert.Equal(t, result, tc.expected, "ReadYesNo result mismatch")
- })
- }
-}
-
-func TestReadYesNo_Error(t *testing.T) {
- // Test error case with EOF (empty reader)
- reader := strings.NewReader("")
-
- _, err := ReadYesNo(reader, false)
- if err == nil {
- t.Fatal("expected error when reading from empty reader")
- }
-}
-
diff --git a/pkg/server/.env.dev b/pkg/server/.env.dev
new file mode 100644
index 00000000..762230be
--- /dev/null
+++ b/pkg/server/.env.dev
@@ -0,0 +1,17 @@
+GO_ENV=DEVELOPMENT
+
+DBHost=localhost
+DBPort=5432
+DBName=dnote
+DBUser=postgres
+DBPassword=
+DBSkipSSL=true
+
+SmtpUsername=mock-SmtpUsername
+SmtpPassword=mock-SmtpPassword
+SmtpHost=mock-SmtpHost
+SmtpPort=465
+
+WebURL=http://localhost:3000
+DisableRegistration=false
+OnPremise=true
diff --git a/pkg/server/.env.test b/pkg/server/.env.test
new file mode 100644
index 00000000..6a5b9ffe
--- /dev/null
+++ b/pkg/server/.env.test
@@ -0,0 +1,16 @@
+GO_ENV=TEST
+
+DBHost=localhost
+DBPort=5432
+DBName=dnote_test
+DBUser=postgres
+DBPassword=
+DBSkipSSL=true
+
+SmtpUsername=mock-SmtpUsername
+SmtpPassword=mock-SmtpPassword
+SmtpHost=mock-SmtpHost
+SmtpPort=465
+
+WebURL=http://localhost:3000
+DisableRegistration=false
diff --git a/pkg/server/.gitignore b/pkg/server/.gitignore
index 9835f3e3..fa49c96a 100644
--- a/pkg/server/.gitignore
+++ b/pkg/server/.gitignore
@@ -6,4 +6,3 @@ test-dnote
/dist
/build
server
-/static
diff --git a/pkg/server/api/auth.go b/pkg/server/api/auth.go
new file mode 100644
index 00000000..914e1233
--- /dev/null
+++ b/pkg/server/api/auth.go
@@ -0,0 +1,187 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "net/http"
+ "time"
+
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/dnote/dnote/pkg/server/helpers"
+ "github.com/dnote/dnote/pkg/server/log"
+ "github.com/dnote/dnote/pkg/server/mailer"
+ "github.com/dnote/dnote/pkg/server/session"
+ "github.com/dnote/dnote/pkg/server/token"
+ "github.com/pkg/errors"
+ "golang.org/x/crypto/bcrypt"
+)
+
+// GetMeResponse is the response for getMe endpoint
+type GetMeResponse struct {
+ User session.Session `json:"user"`
+}
+
+func (a *API) getMe(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var account database.Account
+ if err := a.App.DB.Where("user_id = ?", user.ID).First(&account).Error; err != nil {
+ handlers.DoError(w, "finding account", err, http.StatusInternalServerError)
+ return
+ }
+
+ tx := a.App.DB.Begin()
+ if err := a.App.TouchLastLoginAt(user, tx); err != nil {
+ tx.Rollback()
+ // In case of an error, gracefully continue to avoid disturbing the service
+ log.ErrorWrap(err, "error touching last_login_at")
+ }
+ tx.Commit()
+
+ response := GetMeResponse{
+ User: session.New(user, account),
+ }
+ handlers.RespondJSON(w, http.StatusOK, response)
+}
+
+type createResetTokenPayload struct {
+ Email string `json:"email"`
+}
+
+func (a *API) createResetToken(w http.ResponseWriter, r *http.Request) {
+ var params createResetTokenPayload
+ if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil {
+ http.Error(w, "invalid payload", http.StatusBadRequest)
+ return
+ }
+
+ var account database.Account
+ conn := a.App.DB.Where("email = ?", params.Email).First(&account)
+ if conn.RecordNotFound() {
+ return
+ }
+ if err := conn.Error; err != nil {
+ handlers.DoError(w, errors.Wrap(err, "finding account").Error(), nil, http.StatusInternalServerError)
+ return
+ }
+
+ resetToken, err := token.Create(a.App.DB, account.UserID, database.TokenTypeResetPassword)
+ if err != nil {
+ handlers.DoError(w, errors.Wrap(err, "generating token").Error(), nil, http.StatusInternalServerError)
+ return
+ }
+
+ if err := a.App.SendPasswordResetEmail(account.Email.String, resetToken.Value); err != nil {
+ if errors.Cause(err) == mailer.ErrSMTPNotConfigured {
+ handlers.RespondInvalidSMTPConfig(w)
+ } else {
+ handlers.DoError(w, errors.Wrap(err, "sending password reset email").Error(), nil, http.StatusInternalServerError)
+ }
+
+ return
+ }
+}
+
+type resetPasswordPayload struct {
+ Password string `json:"password"`
+ Token string `json:"token"`
+}
+
+func (a *API) resetPassword(w http.ResponseWriter, r *http.Request) {
+ var params resetPasswordPayload
+ if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil {
+ http.Error(w, "invalid payload", http.StatusBadRequest)
+ return
+ }
+
+ var token database.Token
+ conn := a.App.DB.Where("value = ? AND type =? AND used_at IS NULL", params.Token, database.TokenTypeResetPassword).First(&token)
+ if conn.RecordNotFound() {
+ http.Error(w, "invalid token", http.StatusBadRequest)
+ return
+ }
+ if err := conn.Error; err != nil {
+ handlers.DoError(w, errors.Wrap(err, "finding token").Error(), nil, http.StatusInternalServerError)
+ return
+ }
+
+ if token.UsedAt != nil {
+ http.Error(w, "invalid token", http.StatusBadRequest)
+ return
+ }
+
+ // Expire after 10 minutes
+ if time.Since(token.CreatedAt).Minutes() > 10 {
+ http.Error(w, "This link has been expired. Please request a new password reset link.", http.StatusGone)
+ return
+ }
+
+ tx := a.App.DB.Begin()
+
+ hashedPassword, err := bcrypt.GenerateFromPassword([]byte(params.Password), bcrypt.DefaultCost)
+ if err != nil {
+ tx.Rollback()
+ handlers.DoError(w, errors.Wrap(err, "hashing password").Error(), nil, http.StatusInternalServerError)
+ return
+ }
+
+ var account database.Account
+ if err := a.App.DB.Where("user_id = ?", token.UserID).First(&account).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, errors.Wrap(err, "finding user").Error(), nil, http.StatusInternalServerError)
+ return
+ }
+
+ if err := tx.Model(&account).Update("password", string(hashedPassword)).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, errors.Wrap(err, "updating password").Error(), nil, http.StatusInternalServerError)
+ return
+ }
+ if err := tx.Model(&token).Update("used_at", time.Now()).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, errors.Wrap(err, "updating password reset token").Error(), nil, http.StatusInternalServerError)
+ return
+ }
+
+ if err := a.App.DeleteUserSessions(tx, account.UserID); err != nil {
+ tx.Rollback()
+ handlers.DoError(w, errors.Wrap(err, "deleting user sessions").Error(), nil, http.StatusInternalServerError)
+ return
+ }
+
+ tx.Commit()
+
+ var user database.User
+ if err := a.App.DB.Where("id = ?", account.UserID).First(&user).Error; err != nil {
+ handlers.DoError(w, errors.Wrap(err, "finding user").Error(), nil, http.StatusInternalServerError)
+ return
+ }
+
+ a.respondWithSession(a.App.DB, w, user.ID, http.StatusOK)
+
+ if err := a.App.SendPasswordResetAlertEmail(account.Email.String); err != nil {
+ log.ErrorWrap(err, "sending password reset email")
+ }
+}
diff --git a/pkg/server/api/auth_test.go b/pkg/server/api/auth_test.go
new file mode 100644
index 00000000..ec5666db
--- /dev/null
+++ b/pkg/server/api/auth_test.go
@@ -0,0 +1,408 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "testing"
+ "time"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/session"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+ "golang.org/x/crypto/bcrypt"
+)
+
+func TestGetMe(t *testing.T) {
+ testutils.InitTestDB()
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u1 := testutils.SetupUserData()
+ a1 := testutils.SetupAccountData(u1, "alice@example.com", "somepassword")
+
+ u2 := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&u2).Update("cloud", false), "preparing u2 cloud")
+ a2 := testutils.SetupAccountData(u2, "bob@example.com", "somepassword")
+
+ testCases := []struct {
+ user database.User
+ account database.Account
+ expectedPro bool
+ }{
+ {
+ user: u1,
+ account: a1,
+ expectedPro: true,
+ },
+ {
+ user: u2,
+ account: a2,
+ expectedPro: false,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("user pro %t", tc.expectedPro), func(t *testing.T) {
+ // Execute
+ req := testutils.MakeReq(server.URL, "GET", "/me", "")
+ res := testutils.HTTPAuthDo(t, req, tc.user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var payload GetMeResponse
+ if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ expectedPayload := GetMeResponse{
+ User: session.Session{
+ UUID: tc.user.UUID,
+ Pro: tc.expectedPro,
+ Email: tc.account.Email.String,
+ EmailVerified: tc.account.EmailVerified,
+ },
+ }
+ assert.DeepEqual(t, payload, expectedPayload, "payload mismatch")
+
+ var user database.User
+ testutils.MustExec(t, testutils.DB.Where("id = ?", tc.user.ID).First(&user), "finding user")
+ assert.NotEqual(t, user.LastLoginAt, nil, "LastLoginAt mismatch")
+ })
+ }
+}
+
+func TestCreateResetToken(t *testing.T) {
+ t.Run("success", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupAccountData(u, "alice@example.com", "somepassword")
+
+ dat := `{"email": "alice@example.com"}`
+ req := testutils.MakeReq(server.URL, "POST", "/reset-token", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "Status code mismtach")
+
+ var tokenCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&tokenCount), "counting tokens")
+
+ var resetToken database.Token
+ testutils.MustExec(t, testutils.DB.Where("user_id = ? AND type = ?", u.ID, database.TokenTypeResetPassword).First(&resetToken), "finding reset token")
+
+ assert.Equal(t, tokenCount, 1, "reset_token count mismatch")
+ assert.NotEqual(t, resetToken.Value, nil, "reset_token value mismatch")
+ assert.Equal(t, resetToken.UsedAt, (*time.Time)(nil), "reset_token UsedAt mismatch")
+ })
+
+ t.Run("nonexistent email", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupAccountData(u, "alice@example.com", "somepassword")
+
+ dat := `{"email": "bob@example.com"}`
+ req := testutils.MakeReq(server.URL, "POST", "/reset-token", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "Status code mismtach")
+
+ var tokenCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&tokenCount), "counting tokens")
+ assert.Equal(t, tokenCount, 0, "reset_token count mismatch")
+ })
+}
+
+func TestResetPassword(t *testing.T) {
+ t.Run("success", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, "alice@example.com", "oldpassword")
+ tok := database.Token{
+ UserID: u.ID,
+ Value: "MivFxYiSMMA4An9dP24DNQ==",
+ Type: database.TokenTypeResetPassword,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+ otherTok := database.Token{
+ UserID: u.ID,
+ Value: "somerandomvalue",
+ Type: database.TokenTypeEmailVerification,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&otherTok), "preparing another token")
+
+ dat := `{"token": "MivFxYiSMMA4An9dP24DNQ==", "password": "newpassword"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/reset-password", dat)
+
+ s1 := database.Session{
+ Key: "some-session-key-1",
+ UserID: u.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 10 * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&s1), "preparing user session 1")
+
+ s2 := &database.Session{
+ Key: "some-session-key-2",
+ UserID: u.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 10 * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&s2), "preparing user session 2")
+
+ anotherUser := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Save(&database.Session{
+ Key: "some-session-key-3",
+ UserID: anotherUser.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 10 * 24),
+ }), "preparing anotherUser session 1")
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "Status code mismatch")
+
+ var resetToken, verificationToken database.Token
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("value = ?", "MivFxYiSMMA4An9dP24DNQ==").First(&resetToken), "finding reset token")
+ testutils.MustExec(t, testutils.DB.Where("value = ?", "somerandomvalue").First(&verificationToken), "finding reset token")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", a.ID).First(&account), "finding account")
+
+ assert.NotEqual(t, resetToken.UsedAt, nil, "reset_token UsedAt mismatch")
+ passwordErr := bcrypt.CompareHashAndPassword([]byte(account.Password.String), []byte("newpassword"))
+ assert.Equal(t, passwordErr, nil, "Password mismatch")
+ assert.Equal(t, verificationToken.UsedAt, (*time.Time)(nil), "verificationToken UsedAt mismatch")
+
+ var s1Count, s2Count int
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Where("id = ?", s1.ID).Count(&s1Count), "counting s1")
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Where("id = ?", s2.ID).Count(&s2Count), "counting s2")
+
+ assert.Equal(t, s1Count, 0, "s1 should have been deleted")
+ assert.Equal(t, s2Count, 0, "s2 should have been deleted")
+
+ var userSessionCount, anotherUserSessionCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Where("user_id = ?", u.ID).Count(&userSessionCount), "counting user session")
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Where("user_id = ?", anotherUser.ID).Count(&anotherUserSessionCount), "counting anotherUser session")
+
+ assert.Equal(t, userSessionCount, 1, "should have created a new user session")
+ assert.Equal(t, anotherUserSessionCount, 1, "anotherUser session count mismatch")
+ })
+
+ t.Run("nonexistent token", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, "alice@example.com", "somepassword")
+ tok := database.Token{
+ UserID: u.ID,
+ Value: "MivFxYiSMMA4An9dP24DNQ==",
+ Type: database.TokenTypeResetPassword,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+
+ dat := `{"token": "-ApMnyvpg59uOU5b-Kf5uQ==", "password": "oldpassword"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/reset-password", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status code mismatch")
+
+ var resetToken database.Token
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("value = ?", "MivFxYiSMMA4An9dP24DNQ==").First(&resetToken), "finding reset token")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", a.ID).First(&account), "finding account")
+
+ assert.Equal(t, a.Password, account.Password, "password should not have been updated")
+ assert.Equal(t, a.Password, account.Password, "password should not have been updated")
+ assert.Equal(t, resetToken.UsedAt, (*time.Time)(nil), "used_at should be nil")
+ })
+
+ t.Run("expired token", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, "alice@example.com", "somepassword")
+ tok := database.Token{
+ UserID: u.ID,
+ Value: "MivFxYiSMMA4An9dP24DNQ==",
+ Type: database.TokenTypeResetPassword,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+ testutils.MustExec(t, testutils.DB.Model(&tok).Update("created_at", time.Now().Add(time.Minute*-11)), "Failed to prepare reset_token created_at")
+
+ dat := `{"token": "MivFxYiSMMA4An9dP24DNQ==", "password": "oldpassword"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/reset-password", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusGone, "Status code mismatch")
+
+ var resetToken database.Token
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("value = ?", "MivFxYiSMMA4An9dP24DNQ==").First(&resetToken), "failed to find reset_token")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", a.ID).First(&account), "failed to find account")
+ assert.Equal(t, a.Password, account.Password, "password should not have been updated")
+ assert.Equal(t, resetToken.UsedAt, (*time.Time)(nil), "used_at should be nil")
+ })
+
+ t.Run("used token", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, "alice@example.com", "somepassword")
+
+ usedAt := time.Now().Add(time.Hour * -11).UTC()
+ tok := database.Token{
+ UserID: u.ID,
+ Value: "MivFxYiSMMA4An9dP24DNQ==",
+ Type: database.TokenTypeResetPassword,
+ UsedAt: &usedAt,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+ testutils.MustExec(t, testutils.DB.Model(&tok).Update("created_at", time.Now().Add(time.Minute*-11)), "Failed to prepare reset_token created_at")
+
+ dat := `{"token": "MivFxYiSMMA4An9dP24DNQ==", "password": "oldpassword"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/reset-password", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status code mismatch")
+
+ var resetToken database.Token
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("value = ?", "MivFxYiSMMA4An9dP24DNQ==").First(&resetToken), "failed to find reset_token")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", a.ID).First(&account), "failed to find account")
+ assert.Equal(t, a.Password, account.Password, "password should not have been updated")
+
+ if resetToken.UsedAt.Year() != usedAt.Year() ||
+ resetToken.UsedAt.Month() != usedAt.Month() ||
+ resetToken.UsedAt.Day() != usedAt.Day() ||
+ resetToken.UsedAt.Hour() != usedAt.Hour() ||
+ resetToken.UsedAt.Minute() != usedAt.Minute() ||
+ resetToken.UsedAt.Second() != usedAt.Second() {
+ t.Errorf("used_at should be %+v but got: %+v", usedAt, resetToken.UsedAt)
+ }
+ })
+
+ t.Run("using wrong type token: email_verification", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, "alice@example.com", "somepassword")
+ tok := database.Token{
+ UserID: u.ID,
+ Value: "MivFxYiSMMA4An9dP24DNQ==",
+ Type: database.TokenTypeEmailVerification,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "Failed to prepare reset_token")
+ testutils.MustExec(t, testutils.DB.Model(&tok).Update("created_at", time.Now().Add(time.Minute*-11)), "Failed to prepare reset_token created_at")
+
+ dat := `{"token": "MivFxYiSMMA4An9dP24DNQ==", "password": "oldpassword"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/reset-password", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status code mismatch")
+
+ var resetToken database.Token
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("value = ?", "MivFxYiSMMA4An9dP24DNQ==").First(&resetToken), "failed to find reset_token")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", a.ID).First(&account), "failed to find account")
+
+ assert.Equal(t, a.Password, account.Password, "password should not have been updated")
+ assert.Equal(t, resetToken.UsedAt, (*time.Time)(nil), "used_at should be nil")
+ })
+}
diff --git a/pkg/server/api/health.go b/pkg/server/api/health.go
new file mode 100644
index 00000000..739e8859
--- /dev/null
+++ b/pkg/server/api/health.go
@@ -0,0 +1,28 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "net/http"
+)
+
+func (a *API) checkHealth(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ w.Write([]byte("ok"))
+}
diff --git a/pkg/server/api/health_test.go b/pkg/server/api/health_test.go
new file mode 100644
index 00000000..193a2cd9
--- /dev/null
+++ b/pkg/server/api/health_test.go
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "net/http"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/jinzhu/gorm"
+)
+
+func TestCheckHealth(t *testing.T) {
+ // Setup
+ server := MustNewServer(t, &app.App{
+ DB: &gorm.DB{},
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ // Execute
+ req := testutils.MakeReq(server.URL, "GET", "/health", "")
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "Status code mismtach")
+}
diff --git a/pkg/server/api/helpers.go b/pkg/server/api/helpers.go
new file mode 100644
index 00000000..8137939f
--- /dev/null
+++ b/pkg/server/api/helpers.go
@@ -0,0 +1,85 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "net/http"
+ "strings"
+
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+)
+
+func paginate(conn *gorm.DB, page int) *gorm.DB {
+ limit := 30
+
+ // Paginate
+ if page > 0 {
+ offset := limit * (page - 1)
+ conn = conn.Offset(offset)
+ }
+
+ conn = conn.Limit(limit)
+
+ return conn
+}
+
+func getBookIDs(books []database.Book) []int {
+ ret := []int{}
+
+ for _, book := range books {
+ ret = append(ret, book.ID)
+ }
+
+ return ret
+}
+
+func validatePassword(password string) error {
+ if len(password) < 8 {
+ return errors.New("Password should be longer than 8 characters")
+ }
+
+ return nil
+}
+
+func getClientType(r *http.Request) string {
+ origin := r.Header.Get("Origin")
+
+ if strings.HasPrefix(origin, "moz-extension://") {
+ return "firefox-extension"
+ }
+
+ if strings.HasPrefix(origin, "chrome-extension://") {
+ return "chrome-extension"
+ }
+
+ userAgent := r.Header.Get("User-Agent")
+ if strings.HasPrefix(userAgent, "Go-http-client") {
+ return "cli"
+ }
+
+ return "web"
+}
+
+// notSupported is the handler for the route that is no longer supported
+func (a *API) notSupported(w http.ResponseWriter, r *http.Request) {
+ http.Error(w, "API version is not supported. Please upgrade your client.", http.StatusGone)
+ return
+}
diff --git a/pkg/server/api/main_test.go b/pkg/server/api/main_test.go
new file mode 100644
index 00000000..ee70a07d
--- /dev/null
+++ b/pkg/server/api/main_test.go
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "os"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/server/testutils"
+)
+
+func TestMain(m *testing.M) {
+ testutils.InitTestDB()
+
+ code := m.Run()
+ testutils.ClearData(testutils.DB)
+
+ os.Exit(code)
+}
diff --git a/pkg/server/api/notes.go b/pkg/server/api/notes.go
new file mode 100644
index 00000000..8a745e41
--- /dev/null
+++ b/pkg/server/api/notes.go
@@ -0,0 +1,324 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "fmt"
+ "net/http"
+ "net/url"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/dnote/dnote/pkg/server/helpers"
+ "github.com/dnote/dnote/pkg/server/operations"
+ "github.com/dnote/dnote/pkg/server/presenters"
+ "github.com/gorilla/mux"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+)
+
+type ftsParams struct {
+ HighlightAll bool
+}
+
+func getHeadlineOptions(params *ftsParams) string {
+ headlineOptions := []string{
+ "StartSel=",
+ "StopSel= ",
+ "ShortWord=0",
+ }
+
+ if params != nil && params.HighlightAll {
+ headlineOptions = append(headlineOptions, "HighlightAll=true")
+ } else {
+ headlineOptions = append(headlineOptions, "MaxFragments=3, MaxWords=50, MinWords=10")
+ }
+
+ return strings.Join(headlineOptions, ",")
+}
+
+func selectFTSFields(conn *gorm.DB, search string, params *ftsParams) *gorm.DB {
+ headlineOpts := getHeadlineOptions(params)
+
+ return conn.Select(`
+notes.id,
+notes.uuid,
+notes.created_at,
+notes.updated_at,
+notes.book_uuid,
+notes.user_id,
+notes.added_on,
+notes.edited_on,
+notes.usn,
+notes.deleted,
+notes.encrypted,
+ts_headline('english_nostop', notes.body, plainto_tsquery('english_nostop', ?), ?) AS body
+ `, search, headlineOpts)
+}
+
+func respondWithNote(w http.ResponseWriter, note database.Note) {
+ presentedNote := presenters.PresentNote(note)
+
+ handlers.RespondJSON(w, http.StatusOK, presentedNote)
+}
+
+func parseSearchQuery(q url.Values) string {
+ searchStr := q.Get("q")
+
+ return escapeSearchQuery(searchStr)
+}
+
+func getNoteBaseQuery(db *gorm.DB, noteUUID string, search string) *gorm.DB {
+ var conn *gorm.DB
+ if search != "" {
+ conn = selectFTSFields(db, search, &ftsParams{HighlightAll: true})
+ } else {
+ conn = db
+ }
+
+ conn = conn.Where("notes.uuid = ? AND deleted = ?", noteUUID, false)
+
+ return conn
+}
+
+func (a *API) getNote(w http.ResponseWriter, r *http.Request) {
+ user, _, err := handlers.AuthWithSession(a.App.DB, r, nil)
+ if err != nil {
+ handlers.DoError(w, "authenticating", err, http.StatusInternalServerError)
+ return
+ }
+
+ vars := mux.Vars(r)
+ noteUUID := vars["noteUUID"]
+
+ note, ok, err := operations.GetNote(a.App.DB, noteUUID, user)
+ if !ok {
+ handlers.RespondNotFound(w)
+ return
+ }
+ if err != nil {
+ handlers.DoError(w, "finding note", err, http.StatusInternalServerError)
+ return
+ }
+
+ respondWithNote(w, note)
+}
+
+/**** getNotesHandler */
+
+// GetNotesResponse is a reponse by getNotesHandler
+type GetNotesResponse struct {
+ Notes []presenters.Note `json:"notes"`
+ Total int `json:"total"`
+}
+
+type dateRange struct {
+ lower int64
+ upper int64
+}
+
+func (a *API) getNotes(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+ query := r.URL.Query()
+
+ respondGetNotes(a.App.DB, user.ID, query, w)
+}
+
+func respondGetNotes(db *gorm.DB, userID int, query url.Values, w http.ResponseWriter) {
+ q, err := parseGetNotesQuery(query)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusBadRequest)
+ return
+ }
+
+ conn := getNotesBaseQuery(db, userID, q)
+
+ var total int
+ if err := conn.Model(database.Note{}).Count(&total).Error; err != nil {
+ handlers.DoError(w, "counting total", err, http.StatusInternalServerError)
+ return
+ }
+
+ notes := []database.Note{}
+ if total != 0 {
+ conn = orderGetNotes(conn)
+ conn = database.PreloadNote(conn)
+ conn = paginate(conn, q.Page)
+
+ if err := conn.Find(¬es).Error; err != nil {
+ handlers.DoError(w, "finding notes", err, http.StatusInternalServerError)
+ return
+ }
+ }
+
+ response := GetNotesResponse{
+ Notes: presenters.PresentNotes(notes),
+ Total: total,
+ }
+ handlers.RespondJSON(w, http.StatusOK, response)
+}
+
+type getNotesQuery struct {
+ Year int
+ Month int
+ Page int
+ Books []string
+ Search string
+ Encrypted bool
+}
+
+func parseGetNotesQuery(q url.Values) (getNotesQuery, error) {
+ yearStr := q.Get("year")
+ monthStr := q.Get("month")
+ books := q["book"]
+ pageStr := q.Get("page")
+ encryptedStr := q.Get("encrypted")
+
+ fmt.Println("books", books)
+
+ var page int
+ if len(pageStr) > 0 {
+ p, err := strconv.Atoi(pageStr)
+ if err != nil {
+ return getNotesQuery{}, errors.Errorf("invalid page %s", pageStr)
+ }
+ if p < 1 {
+ return getNotesQuery{}, errors.Errorf("invalid page %s", pageStr)
+ }
+
+ page = p
+ } else {
+ page = 1
+ }
+
+ var year int
+ if len(yearStr) > 0 {
+ y, err := strconv.Atoi(yearStr)
+ if err != nil {
+ return getNotesQuery{}, errors.Errorf("invalid year %s", yearStr)
+ }
+
+ year = y
+ }
+
+ var month int
+ if len(monthStr) > 0 {
+ m, err := strconv.Atoi(monthStr)
+ if err != nil {
+ return getNotesQuery{}, errors.Errorf("invalid month %s", monthStr)
+ }
+ if m < 1 || m > 12 {
+ return getNotesQuery{}, errors.Errorf("invalid month %s", monthStr)
+ }
+
+ month = m
+ }
+
+ var encrypted bool
+ if strings.ToLower(encryptedStr) == "true" {
+ encrypted = true
+ } else {
+ encrypted = false
+ }
+
+ ret := getNotesQuery{
+ Year: year,
+ Month: month,
+ Page: page,
+ Search: parseSearchQuery(q),
+ Books: books,
+ Encrypted: encrypted,
+ }
+
+ return ret, nil
+}
+
+func getDateBounds(year, month int) (int64, int64) {
+ var yearUpperbound, monthUpperbound int
+
+ if month == 12 {
+ monthUpperbound = 1
+ yearUpperbound = year + 1
+ } else {
+ monthUpperbound = month + 1
+ yearUpperbound = year
+ }
+
+ lower := time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.UTC).UnixNano()
+ upper := time.Date(yearUpperbound, time.Month(monthUpperbound), 1, 0, 0, 0, 0, time.UTC).UnixNano()
+
+ return lower, upper
+}
+
+func getNotesBaseQuery(db *gorm.DB, userID int, q getNotesQuery) *gorm.DB {
+ conn := db.Where(
+ "notes.user_id = ? AND notes.deleted = ? AND notes.encrypted = ?",
+ userID, false, q.Encrypted,
+ )
+
+ if q.Search != "" {
+ conn = selectFTSFields(conn, q.Search, nil)
+ conn = conn.Where("tsv @@ plainto_tsquery('english_nostop', ?)", q.Search)
+ }
+
+ if len(q.Books) > 0 {
+ conn = conn.Joins("INNER JOIN books ON books.uuid = notes.book_uuid").
+ Where("books.label in (?)", q.Books)
+ }
+
+ if q.Year != 0 || q.Month != 0 {
+ dateLowerbound, dateUpperbound := getDateBounds(q.Year, q.Month)
+ conn = conn.Where("notes.added_on >= ? AND notes.added_on < ?", dateLowerbound, dateUpperbound)
+ }
+
+ return conn
+}
+
+func orderGetNotes(conn *gorm.DB) *gorm.DB {
+ return conn.Order("notes.updated_at DESC, notes.id DESC")
+}
+
+// escapeSearchQuery escapes the query for full text search
+func escapeSearchQuery(searchQuery string) string {
+ return strings.Join(strings.Fields(searchQuery), "&")
+}
+
+func (a *API) legacyGetNotes(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var notes []database.Note
+ if err := a.App.DB.Where("user_id = ? AND encrypted = true", user.ID).Find(¬es).Error; err != nil {
+ handlers.DoError(w, "finding notes", err, http.StatusInternalServerError)
+ return
+ }
+
+ presented := presenters.PresentNotes(notes)
+ handlers.RespondJSON(w, http.StatusOK, presented)
+}
diff --git a/pkg/server/api/notes_test.go b/pkg/server/api/notes_test.go
new file mode 100644
index 00000000..d0b0617b
--- /dev/null
+++ b/pkg/server/api/notes_test.go
@@ -0,0 +1,357 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "net/http"
+ "testing"
+ "time"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/presenters"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+)
+
+func getExpectedNotePayload(n database.Note, b database.Book, u database.User) presenters.Note {
+ return presenters.Note{
+ UUID: n.UUID,
+ CreatedAt: n.CreatedAt,
+ UpdatedAt: n.UpdatedAt,
+ Body: n.Body,
+ AddedOn: n.AddedOn,
+ Public: n.Public,
+ USN: n.USN,
+ Book: presenters.NoteBook{
+ UUID: b.UUID,
+ Label: b.Label,
+ },
+ User: presenters.NoteUser{
+ UUID: u.UUID,
+ },
+ }
+}
+
+func TestGetNotes(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ anotherUser := testutils.SetupUserData()
+
+ b1 := database.Book{
+ UserID: user.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+ b2 := database.Book{
+ UserID: user.ID,
+ Label: "css",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b2), "preparing b2")
+ b3 := database.Book{
+ UserID: anotherUser.ID,
+ Label: "css",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b3), "preparing b3")
+
+ n1 := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: "n1 content",
+ USN: 11,
+ Deleted: false,
+ AddedOn: time.Date(2018, time.August, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n1), "preparing n1")
+ n2 := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: "n2 content",
+ USN: 14,
+ Deleted: false,
+ AddedOn: time.Date(2018, time.August, 11, 22, 0, 0, 0, time.UTC).UnixNano(),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n2), "preparing n2")
+ n3 := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: "n3 content",
+ USN: 17,
+ Deleted: false,
+ AddedOn: time.Date(2017, time.January, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n3), "preparing n3")
+ n4 := database.Note{
+ UserID: user.ID,
+ BookUUID: b2.UUID,
+ Body: "n4 content",
+ USN: 18,
+ Deleted: false,
+ AddedOn: time.Date(2018, time.September, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n4), "preparing n4")
+ n5 := database.Note{
+ UserID: anotherUser.ID,
+ BookUUID: b3.UUID,
+ Body: "n5 content",
+ USN: 19,
+ Deleted: false,
+ AddedOn: time.Date(2018, time.August, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n5), "preparing n5")
+ n6 := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: "",
+ USN: 11,
+ Deleted: true,
+ AddedOn: time.Date(2018, time.August, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n6), "preparing n6")
+
+ // Execute
+ req := testutils.MakeReq(server.URL, "GET", "/notes?year=2018&month=8", "")
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var payload GetNotesResponse
+ if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ var n2Record, n1Record database.Note
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", n2.UUID).First(&n2Record), "finding n2Record")
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", n1.UUID).First(&n1Record), "finding n1Record")
+
+ expected := GetNotesResponse{
+ Notes: []presenters.Note{
+ getExpectedNotePayload(n2Record, b1, user),
+ getExpectedNotePayload(n1Record, b1, user),
+ },
+ Total: 2,
+ }
+
+ assert.DeepEqual(t, payload, expected, "payload mismatch")
+}
+
+func TestGetNote(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ anotherUser := testutils.SetupUserData()
+
+ b1 := database.Book{
+ UserID: user.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+
+ privateNote := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: "privateNote content",
+ Public: false,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&privateNote), "preparing privateNote")
+ publicNote := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: "publicNote content",
+ Public: true,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&publicNote), "preparing publicNote")
+ deletedNote := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Deleted: true,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&deletedNote), "preparing publicNote")
+
+ t.Run("owner accessing private note", func(t *testing.T) {
+ // Execute
+ url := fmt.Sprintf("/notes/%s", privateNote.UUID)
+ req := testutils.MakeReq(server.URL, "GET", url, "")
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var payload presenters.Note
+ if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ var n1Record database.Note
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", privateNote.UUID).First(&n1Record), "finding n1Record")
+
+ expected := getExpectedNotePayload(n1Record, b1, user)
+ assert.DeepEqual(t, payload, expected, "payload mismatch")
+ })
+
+ t.Run("owner accessing public note", func(t *testing.T) {
+ // Execute
+ url := fmt.Sprintf("/notes/%s", publicNote.UUID)
+ req := testutils.MakeReq(server.URL, "GET", url, "")
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var payload presenters.Note
+ if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ var n2Record database.Note
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", publicNote.UUID).First(&n2Record), "finding n2Record")
+
+ expected := getExpectedNotePayload(n2Record, b1, user)
+ assert.DeepEqual(t, payload, expected, "payload mismatch")
+ })
+
+ t.Run("non-owner accessing public note", func(t *testing.T) {
+ // Execute
+ url := fmt.Sprintf("/notes/%s", publicNote.UUID)
+ req := testutils.MakeReq(server.URL, "GET", url, "")
+ res := testutils.HTTPAuthDo(t, req, anotherUser)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var payload presenters.Note
+ if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ var n2Record database.Note
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", publicNote.UUID).First(&n2Record), "finding n2Record")
+
+ expected := getExpectedNotePayload(n2Record, b1, user)
+ assert.DeepEqual(t, payload, expected, "payload mismatch")
+ })
+
+ t.Run("non-owner accessing private note", func(t *testing.T) {
+ // Execute
+ url := fmt.Sprintf("/notes/%s", privateNote.UUID)
+ req := testutils.MakeReq(server.URL, "GET", url, "")
+ res := testutils.HTTPAuthDo(t, req, anotherUser)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusNotFound, "")
+
+ body, err := ioutil.ReadAll(res.Body)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "reading body"))
+ }
+
+ assert.DeepEqual(t, string(body), "not found\n", "payload mismatch")
+ })
+
+ t.Run("guest accessing public note", func(t *testing.T) {
+ // Execute
+ url := fmt.Sprintf("/notes/%s", publicNote.UUID)
+ req := testutils.MakeReq(server.URL, "GET", url, "")
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var payload presenters.Note
+ if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ var n2Record database.Note
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", publicNote.UUID).First(&n2Record), "finding n2Record")
+
+ expected := getExpectedNotePayload(n2Record, b1, user)
+ assert.DeepEqual(t, payload, expected, "payload mismatch")
+ })
+
+ t.Run("guest accessing private note", func(t *testing.T) {
+ // Execute
+ url := fmt.Sprintf("/notes/%s", privateNote.UUID)
+ req := testutils.MakeReq(server.URL, "GET", url, "")
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusNotFound, "")
+
+ body, err := ioutil.ReadAll(res.Body)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "reading body"))
+ }
+
+ assert.DeepEqual(t, string(body), "not found\n", "payload mismatch")
+ })
+
+ t.Run("nonexistent", func(t *testing.T) {
+ // Execute
+ url := fmt.Sprintf("/notes/%s", "someRandomString")
+ req := testutils.MakeReq(server.URL, "GET", url, "")
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusNotFound, "")
+
+ body, err := ioutil.ReadAll(res.Body)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "reading body"))
+ }
+
+ assert.DeepEqual(t, string(body), "not found\n", "payload mismatch")
+ })
+
+ t.Run("deleted", func(t *testing.T) {
+ // Execute
+ url := fmt.Sprintf("/notes/%s", deletedNote.UUID)
+ req := testutils.MakeReq(server.URL, "GET", url, "")
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusNotFound, "")
+
+ body, err := ioutil.ReadAll(res.Body)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "reading body"))
+ }
+
+ assert.DeepEqual(t, string(body), "not found\n", "payload mismatch")
+ })
+}
diff --git a/pkg/server/api/routes.go b/pkg/server/api/routes.go
new file mode 100644
index 00000000..a1d8385d
--- /dev/null
+++ b/pkg/server/api/routes.go
@@ -0,0 +1,116 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "net/http"
+ "os"
+
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/gorilla/mux"
+ "github.com/pkg/errors"
+)
+
+// API is a web API configuration
+type API struct {
+ App *app.App
+}
+
+// init sets up the application based on the configuration
+func (a *API) init() error {
+ if err := a.App.Validate(); err != nil {
+ return errors.Wrap(err, "validating the app parameters")
+ }
+
+ return nil
+}
+
+func applyMiddleware(h http.HandlerFunc, rateLimit bool) http.Handler {
+ ret := h
+ ret = handlers.Logging(ret)
+
+ if rateLimit && os.Getenv("GO_ENV") != "TEST" {
+ ret = handlers.Limit(ret)
+ }
+
+ return ret
+}
+
+// NewRouter creates and returns a new router
+func NewRouter(a *API) (*mux.Router, error) {
+ if err := a.init(); err != nil {
+ return nil, errors.Wrap(err, "initializing app")
+ }
+
+ proOnly := handlers.AuthParams{ProOnly: true}
+ app := a.App
+
+ var routes = []handlers.Route{
+ // internal
+ {Method: "GET", Pattern: "/health", HandlerFunc: a.checkHealth, RateLimit: false},
+ {Method: "GET", Pattern: "/me", HandlerFunc: handlers.Auth(app, a.getMe, nil), RateLimit: true},
+ {Method: "POST", Pattern: "/verification-token", HandlerFunc: handlers.Auth(app, a.createVerificationToken, nil), RateLimit: true},
+ {Method: "PATCH", Pattern: "/verify-email", HandlerFunc: a.verifyEmail, RateLimit: true},
+ {Method: "POST", Pattern: "/reset-token", HandlerFunc: a.createResetToken, RateLimit: true},
+ {Method: "PATCH", Pattern: "/reset-password", HandlerFunc: a.resetPassword, RateLimit: true},
+ {Method: "PATCH", Pattern: "/account/profile", HandlerFunc: handlers.Auth(app, a.updateProfile, nil), RateLimit: true},
+ {Method: "PATCH", Pattern: "/account/password", HandlerFunc: handlers.Auth(app, a.updatePassword, nil), RateLimit: true},
+ {Method: "GET", Pattern: "/account/email-preference", HandlerFunc: handlers.TokenAuth(app, a.getEmailPreference, database.TokenTypeEmailPreference, nil), RateLimit: true},
+ {Method: "PATCH", Pattern: "/account/email-preference", HandlerFunc: handlers.TokenAuth(app, a.updateEmailPreference, database.TokenTypeEmailPreference, nil), RateLimit: true},
+ {Method: "GET", Pattern: "/notes", HandlerFunc: handlers.Auth(app, a.getNotes, nil), RateLimit: false},
+ {Method: "GET", Pattern: "/notes/{noteUUID}", HandlerFunc: a.getNote, RateLimit: true},
+ {Method: "GET", Pattern: "/calendar", HandlerFunc: handlers.Auth(app, a.getCalendar, nil), RateLimit: true},
+
+ // v3
+ {Method: "GET", Pattern: "/v3/sync/fragment", HandlerFunc: handlers.Cors(handlers.Auth(app, a.GetSyncFragment, &proOnly)), RateLimit: false},
+ {Method: "GET", Pattern: "/v3/sync/state", HandlerFunc: handlers.Cors(handlers.Auth(app, a.GetSyncState, &proOnly)), RateLimit: false},
+ {Method: "OPTIONS", Pattern: "/v3/books", HandlerFunc: handlers.Cors(a.BooksOptions), RateLimit: true},
+ {Method: "GET", Pattern: "/v3/books", HandlerFunc: handlers.Cors(handlers.Auth(app, a.GetBooks, &proOnly)), RateLimit: true},
+ {Method: "GET", Pattern: "/v3/books/{bookUUID}", HandlerFunc: handlers.Cors(handlers.Auth(app, a.GetBook, &proOnly)), RateLimit: true},
+ {Method: "POST", Pattern: "/v3/books", HandlerFunc: handlers.Cors(handlers.Auth(app, a.CreateBook, &proOnly)), RateLimit: false},
+ {Method: "PATCH", Pattern: "/v3/books/{bookUUID}", HandlerFunc: handlers.Cors(handlers.Auth(app, a.UpdateBook, &proOnly)), RateLimit: false},
+ {Method: "DELETE", Pattern: "/v3/books/{bookUUID}", HandlerFunc: handlers.Cors(handlers.Auth(app, a.DeleteBook, &proOnly)), RateLimit: false},
+ {Method: "OPTIONS", Pattern: "/v3/notes", HandlerFunc: handlers.Cors(a.NotesOptions), RateLimit: true},
+ {Method: "POST", Pattern: "/v3/notes", HandlerFunc: handlers.Cors(handlers.Auth(app, a.CreateNote, &proOnly)), RateLimit: false},
+ {Method: "PATCH", Pattern: "/v3/notes/{noteUUID}", HandlerFunc: handlers.Auth(app, a.UpdateNote, &proOnly), RateLimit: false},
+ {Method: "DELETE", Pattern: "/v3/notes/{noteUUID}", HandlerFunc: handlers.Auth(app, a.DeleteNote, &proOnly), RateLimit: false},
+ {Method: "POST", Pattern: "/v3/signin", HandlerFunc: handlers.Cors(a.signin), RateLimit: true},
+ {Method: "OPTIONS", Pattern: "/v3/signout", HandlerFunc: handlers.Cors(a.signoutOptions), RateLimit: true},
+ {Method: "POST", Pattern: "/v3/signout", HandlerFunc: handlers.Cors(a.signout), RateLimit: true},
+ {Method: "POST", Pattern: "/v3/register", HandlerFunc: a.register, RateLimit: true},
+ }
+
+ router := mux.NewRouter().StrictSlash(true)
+
+ router.PathPrefix("/v1").Handler(applyMiddleware(handlers.NotSupported, true))
+ router.PathPrefix("/v2").Handler(applyMiddleware(handlers.NotSupported, true))
+
+ for _, route := range routes {
+ handler := route.HandlerFunc
+
+ router.
+ Methods(route.Method).
+ Path(route.Pattern).
+ Handler(applyMiddleware(handler, route.RateLimit))
+ }
+
+ return router, nil
+}
diff --git a/pkg/server/api/routes_test.go b/pkg/server/api/routes_test.go
new file mode 100644
index 00000000..8a395f01
--- /dev/null
+++ b/pkg/server/api/routes_test.go
@@ -0,0 +1,161 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "fmt"
+ "net/http"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/dnote/dnote/pkg/server/mailer"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+)
+
+func TestNotSupportedVersions(t *testing.T) {
+ testCases := []struct {
+ path string
+ }{
+ // v1
+ {
+ path: "/v1",
+ },
+ {
+ path: "/v1/foo",
+ },
+ {
+ path: "/v1/bar/baz",
+ },
+ // v2
+ {
+ path: "/v2",
+ },
+ {
+ path: "/v2/foo",
+ },
+ {
+ path: "/v2/bar/baz",
+ },
+ }
+
+ // setup
+ server := MustNewServer(t, &app.App{
+ DB: &gorm.DB{},
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ for _, tc := range testCases {
+ t.Run(tc.path, func(t *testing.T) {
+ // execute
+ req := testutils.MakeReq(server.URL, "GET", tc.path, "")
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, http.StatusGone, "status code mismatch")
+ })
+ }
+}
+
+func TestNewRouter_AppValidate(t *testing.T) {
+ c := config.Load()
+
+ configWithoutWebURL := config.Load()
+ configWithoutWebURL.WebURL = ""
+
+ testCases := []struct {
+ app app.App
+ expectedErr error
+ }{
+ {
+ app: app.App{
+ DB: &gorm.DB{},
+ Clock: clock.NewMock(),
+ EmailTemplates: mailer.Templates{},
+ EmailBackend: &testutils.MockEmailbackendImplementation{},
+ Config: c,
+ },
+ expectedErr: nil,
+ },
+ {
+ app: app.App{
+ DB: nil,
+ Clock: clock.NewMock(),
+ EmailTemplates: mailer.Templates{},
+ EmailBackend: &testutils.MockEmailbackendImplementation{},
+ Config: c,
+ },
+ expectedErr: app.ErrEmptyDB,
+ },
+ {
+ app: app.App{
+ DB: &gorm.DB{},
+ Clock: nil,
+ EmailTemplates: mailer.Templates{},
+ EmailBackend: &testutils.MockEmailbackendImplementation{},
+ Config: c,
+ },
+ expectedErr: app.ErrEmptyClock,
+ },
+ {
+ app: app.App{
+ DB: &gorm.DB{},
+ Clock: clock.NewMock(),
+ EmailTemplates: nil,
+ EmailBackend: &testutils.MockEmailbackendImplementation{},
+ Config: c,
+ },
+ expectedErr: app.ErrEmptyEmailTemplates,
+ },
+ {
+ app: app.App{
+ DB: &gorm.DB{},
+ Clock: clock.NewMock(),
+ EmailTemplates: mailer.Templates{},
+ EmailBackend: nil,
+ Config: c,
+ },
+ expectedErr: app.ErrEmptyEmailBackend,
+ },
+ {
+ app: app.App{
+ DB: &gorm.DB{},
+ Clock: clock.NewMock(),
+ EmailTemplates: mailer.Templates{},
+ EmailBackend: &testutils.MockEmailbackendImplementation{},
+ Config: configWithoutWebURL,
+ },
+ expectedErr: app.ErrEmptyWebURL,
+ },
+ }
+
+ for idx, tc := range testCases {
+ t.Run(fmt.Sprintf("test case %d", idx), func(t *testing.T) {
+ api := API{App: &tc.app}
+ _, err := NewRouter(&api)
+
+ assert.Equal(t, errors.Cause(err), tc.expectedErr, "error mismatch")
+ })
+ }
+}
diff --git a/pkg/server/api/testutils.go b/pkg/server/api/testutils.go
new file mode 100644
index 00000000..b8896475
--- /dev/null
+++ b/pkg/server/api/testutils.go
@@ -0,0 +1,48 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "net/http/httptest"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/pkg/errors"
+)
+
+// MustNewServer is a test utility function to initialize a new server
+// with the given app paratmers
+func MustNewServer(t *testing.T, appParams *app.App) *httptest.Server {
+ api := NewTestAPI(appParams)
+ r, err := NewRouter(&api)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "initializing server"))
+ }
+
+ server := httptest.NewServer(r)
+
+ return server
+}
+
+// NewTestAPI returns a new API for test
+func NewTestAPI(appParams *app.App) API {
+ a := app.NewTest(appParams)
+
+ return API{App: &a}
+}
diff --git a/pkg/server/api/user.go b/pkg/server/api/user.go
new file mode 100644
index 00000000..04e41149
--- /dev/null
+++ b/pkg/server/api/user.go
@@ -0,0 +1,394 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "net/http"
+ "time"
+
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/dnote/dnote/pkg/server/helpers"
+ "github.com/dnote/dnote/pkg/server/log"
+ "github.com/dnote/dnote/pkg/server/mailer"
+ "github.com/dnote/dnote/pkg/server/presenters"
+ "github.com/dnote/dnote/pkg/server/session"
+ "github.com/dnote/dnote/pkg/server/token"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+ "golang.org/x/crypto/bcrypt"
+)
+
+type updateProfilePayload struct {
+ Email string `json:"email"`
+ Password string `json:"password"`
+}
+
+// updateProfile updates user
+func (a *API) updateProfile(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var account database.Account
+ if err := a.App.DB.Where("user_id = ?", user.ID).First(&account).Error; err != nil {
+ handlers.DoError(w, "getting account", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var params updateProfilePayload
+ err := json.NewDecoder(r.Body).Decode(¶ms)
+ if err != nil {
+ http.Error(w, errors.Wrap(err, "invalid params").Error(), http.StatusBadRequest)
+ return
+ }
+
+ password := []byte(params.Password)
+ if err := bcrypt.CompareHashAndPassword([]byte(account.Password.String), password); err != nil {
+ log.WithFields(log.Fields{
+ "user_id": user.ID,
+ }).Warn("invalid email update attempt")
+ http.Error(w, "Wrong password", http.StatusUnauthorized)
+ return
+ }
+
+ // Validate
+ if len(params.Email) > 60 {
+ http.Error(w, "Email is too long", http.StatusBadRequest)
+ return
+ }
+
+ tx := a.App.DB.Begin()
+ if err := tx.Save(&user).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, "saving user", err, http.StatusInternalServerError)
+ return
+ }
+
+ // check if email was changed
+ if params.Email != account.Email.String {
+ account.EmailVerified = false
+ }
+ account.Email.String = params.Email
+
+ if err := tx.Save(&account).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, "saving account", err, http.StatusInternalServerError)
+ return
+ }
+
+ tx.Commit()
+
+ a.respondWithSession(a.App.DB, w, user.ID, http.StatusOK)
+}
+
+type updateEmailPayload struct {
+ NewEmail string `json:"new_email"`
+ NewCipherKeyEnc string `json:"new_cipher_key_enc"`
+ OldAuthKey string `json:"old_auth_key"`
+ NewAuthKey string `json:"new_auth_key"`
+}
+
+func respondWithCalendar(db *gorm.DB, w http.ResponseWriter, userID int) {
+ rows, err := db.Table("notes").Select("COUNT(id), date(to_timestamp(added_on/1000000000)) AS added_date").
+ Where("user_id = ?", userID).
+ Group("added_date").
+ Order("added_date DESC").Rows()
+
+ if err != nil {
+ handlers.DoError(w, "Failed to count lessons", err, http.StatusInternalServerError)
+ return
+ }
+
+ payload := map[string]int{}
+
+ for rows.Next() {
+ var count int
+ var d time.Time
+
+ if err := rows.Scan(&count, &d); err != nil {
+ handlers.DoError(w, "counting notes", err, http.StatusInternalServerError)
+ }
+ payload[d.Format("2006-1-2")] = count
+ }
+
+ handlers.RespondJSON(w, http.StatusOK, payload)
+}
+
+func (a *API) getCalendar(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ respondWithCalendar(a.App.DB, w, user.ID)
+}
+
+func (a *API) createVerificationToken(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var account database.Account
+ err := a.App.DB.Where("user_id = ?", user.ID).First(&account).Error
+ if err != nil {
+ handlers.DoError(w, "finding account", err, http.StatusInternalServerError)
+ return
+ }
+
+ if account.EmailVerified {
+ http.Error(w, "Email already verified", http.StatusGone)
+ return
+ }
+ if account.Email.String == "" {
+ http.Error(w, "Email not set", http.StatusUnprocessableEntity)
+ return
+ }
+
+ tok, err := token.Create(a.App.DB, account.UserID, database.TokenTypeEmailVerification)
+ if err != nil {
+ handlers.DoError(w, "saving token", err, http.StatusInternalServerError)
+ return
+ }
+
+ if err := a.App.SendVerificationEmail(account.Email.String, tok.Value); err != nil {
+ if errors.Cause(err) == mailer.ErrSMTPNotConfigured {
+ handlers.RespondInvalidSMTPConfig(w)
+ } else {
+ handlers.DoError(w, errors.Wrap(err, "sending verification email").Error(), nil, http.StatusInternalServerError)
+ }
+
+ return
+ }
+
+ w.WriteHeader(http.StatusCreated)
+}
+
+type verifyEmailPayload struct {
+ Token string `json:"token"`
+}
+
+func (a *API) verifyEmail(w http.ResponseWriter, r *http.Request) {
+ var params verifyEmailPayload
+ if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil {
+ handlers.DoError(w, "decoding payload", err, http.StatusInternalServerError)
+ return
+ }
+
+ var token database.Token
+ if err := a.App.DB.
+ Where("value = ? AND type = ?", params.Token, database.TokenTypeEmailVerification).
+ First(&token).Error; err != nil {
+ http.Error(w, "invalid token", http.StatusBadRequest)
+ return
+ }
+
+ if token.UsedAt != nil {
+ http.Error(w, "invalid token", http.StatusBadRequest)
+ return
+ }
+
+ // Expire after ttl
+ if time.Since(token.CreatedAt).Minutes() > 30 {
+ http.Error(w, "This link has been expired. Please request a new link.", http.StatusGone)
+ return
+ }
+
+ var account database.Account
+ if err := a.App.DB.Where("user_id = ?", token.UserID).First(&account).Error; err != nil {
+ handlers.DoError(w, "finding account", err, http.StatusInternalServerError)
+ return
+ }
+ if account.EmailVerified {
+ http.Error(w, "Already verified", http.StatusConflict)
+ return
+ }
+
+ tx := a.App.DB.Begin()
+ account.EmailVerified = true
+ if err := tx.Save(&account).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, "updating email_verified", err, http.StatusInternalServerError)
+ return
+ }
+ if err := tx.Model(&token).Update("used_at", time.Now()).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, "updating reset token", err, http.StatusInternalServerError)
+ return
+ }
+ tx.Commit()
+
+ var user database.User
+ if err := a.App.DB.Where("id = ?", token.UserID).First(&user).Error; err != nil {
+ handlers.DoError(w, "finding user", err, http.StatusInternalServerError)
+ return
+ }
+
+ s := session.New(user, account)
+ handlers.RespondJSON(w, http.StatusOK, s)
+}
+
+type emailPreferernceParams struct {
+ InactiveReminder *bool `json:"inactive_reminder"`
+ ProductUpdate *bool `json:"product_update"`
+}
+
+func (p emailPreferernceParams) getInactiveReminder() bool {
+ if p.InactiveReminder == nil {
+ return false
+ }
+
+ return *p.InactiveReminder
+}
+
+func (p emailPreferernceParams) getProductUpdate() bool {
+ if p.ProductUpdate == nil {
+ return false
+ }
+
+ return *p.ProductUpdate
+}
+
+func (a *API) updateEmailPreference(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var params emailPreferernceParams
+ if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil {
+ handlers.DoError(w, "decoding payload", err, http.StatusInternalServerError)
+ return
+ }
+
+ var pref database.EmailPreference
+ if err := a.App.DB.Where(database.EmailPreference{UserID: user.ID}).FirstOrCreate(&pref).Error; err != nil {
+ handlers.DoError(w, "finding pref", err, http.StatusInternalServerError)
+ return
+ }
+
+ tx := a.App.DB.Begin()
+
+ if params.InactiveReminder != nil {
+ pref.InactiveReminder = params.getInactiveReminder()
+ }
+ if params.ProductUpdate != nil {
+ pref.ProductUpdate = params.getProductUpdate()
+ }
+
+ if err := tx.Save(&pref).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, "saving pref", err, http.StatusInternalServerError)
+ return
+ }
+
+ token, ok := r.Context().Value(helpers.KeyToken).(database.Token)
+ if ok {
+ // Mark token as used if the user was authenticated by token
+ if err := tx.Model(&token).Update("used_at", time.Now()).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, "updating reset token", err, http.StatusInternalServerError)
+ return
+ }
+ }
+
+ tx.Commit()
+
+ handlers.RespondJSON(w, http.StatusOK, pref)
+}
+
+func (a *API) getEmailPreference(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var pref database.EmailPreference
+ if err := a.App.DB.Where(database.EmailPreference{UserID: user.ID}).First(&pref).Error; err != nil {
+ handlers.DoError(w, "finding pref", err, http.StatusInternalServerError)
+ return
+ }
+
+ presented := presenters.PresentEmailPreference(pref)
+ handlers.RespondJSON(w, http.StatusOK, presented)
+}
+
+type updatePasswordPayload struct {
+ OldPassword string `json:"old_password"`
+ NewPassword string `json:"new_password"`
+}
+
+func (a *API) updatePassword(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var params updatePasswordPayload
+ if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil {
+ http.Error(w, err.Error(), http.StatusBadRequest)
+ return
+ }
+ if params.OldPassword == "" || params.NewPassword == "" {
+ http.Error(w, "invalid params", http.StatusBadRequest)
+ return
+ }
+
+ var account database.Account
+ if err := a.App.DB.Where("user_id = ?", user.ID).First(&account).Error; err != nil {
+ handlers.DoError(w, "getting account", nil, http.StatusInternalServerError)
+ return
+ }
+
+ password := []byte(params.OldPassword)
+ if err := bcrypt.CompareHashAndPassword([]byte(account.Password.String), password); err != nil {
+ log.WithFields(log.Fields{
+ "user_id": user.ID,
+ }).Warn("invalid password update attempt")
+ http.Error(w, "Wrong password", http.StatusUnauthorized)
+ return
+ }
+
+ if err := validatePassword(params.NewPassword); err != nil {
+ http.Error(w, err.Error(), http.StatusBadRequest)
+ return
+ }
+
+ hashedNewPassword, err := bcrypt.GenerateFromPassword([]byte(params.NewPassword), bcrypt.DefaultCost)
+ if err != nil {
+ http.Error(w, errors.Wrap(err, "hashing password").Error(), http.StatusInternalServerError)
+ return
+ }
+
+ if err := a.App.DB.Model(&account).Update("password", string(hashedNewPassword)).Error; err != nil {
+ http.Error(w, errors.Wrap(err, "updating password").Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.WriteHeader(http.StatusOK)
+}
diff --git a/pkg/server/api/user_test.go b/pkg/server/api/user_test.go
new file mode 100644
index 00000000..19376300
--- /dev/null
+++ b/pkg/server/api/user_test.go
@@ -0,0 +1,691 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "testing"
+ "time"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/presenters"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+ "golang.org/x/crypto/bcrypt"
+)
+
+func TestUpdatePassword(t *testing.T) {
+ t.Run("success", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.SetupAccountData(user, "alice@example.com", "oldpassword")
+
+ // Execute
+ dat := `{"old_password": "oldpassword", "new_password": "newpassword"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/account/password", dat)
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "Status code mismsatch")
+
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", user.ID).First(&account), "finding account")
+
+ passwordErr := bcrypt.CompareHashAndPassword([]byte(account.Password.String), []byte("newpassword"))
+ assert.Equal(t, passwordErr, nil, "Password mismatch")
+ })
+
+ t.Run("old password mismatch", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, "alice@example.com", "oldpassword")
+
+ // Execute
+ dat := `{"old_password": "randompassword", "new_password": "newpassword"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/account/password", dat)
+ res := testutils.HTTPAuthDo(t, req, u)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "Status code mismsatch")
+
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&account), "finding account")
+ assert.Equal(t, a.Password.String, account.Password.String, "password should not have been updated")
+ })
+
+ t.Run("password too short", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, "alice@example.com", "oldpassword")
+
+ // Execute
+ dat := `{"old_password": "oldpassword", "new_password": "a"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/account/password", dat)
+ res := testutils.HTTPAuthDo(t, req, u)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status code mismsatch")
+
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&account), "finding account")
+ assert.Equal(t, a.Password.String, account.Password.String, "password should not have been updated")
+ })
+}
+
+func TestCreateVerificationToken(t *testing.T) {
+ t.Run("success", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ emailBackend := testutils.MockEmailbackendImplementation{}
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ EmailBackend: &emailBackend,
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.SetupAccountData(user, "alice@example.com", "pass1234")
+
+ // Execute
+ req := testutils.MakeReq(server.URL, "POST", "/verification-token", "")
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusCreated, "status code mismatch")
+
+ var account database.Account
+ var token database.Token
+ var tokenCount int
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", user.ID).First(&account), "finding account")
+ testutils.MustExec(t, testutils.DB.Where("user_id = ? AND type = ?", user.ID, database.TokenTypeEmailVerification).First(&token), "finding token")
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&tokenCount), "counting token")
+
+ assert.Equal(t, account.EmailVerified, false, "email_verified should not have been updated")
+ assert.NotEqual(t, token.Value, "", "token Value mismatch")
+ assert.Equal(t, tokenCount, 1, "token count mismatch")
+ assert.Equal(t, token.UsedAt, (*time.Time)(nil), "token UsedAt mismatch")
+ assert.Equal(t, len(emailBackend.Emails), 1, "email queue count mismatch")
+ })
+
+ t.Run("already verified", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ a := testutils.SetupAccountData(user, "alice@example.com", "pass1234")
+ a.EmailVerified = true
+ testutils.MustExec(t, testutils.DB.Save(&a), "preparing account")
+
+ // Execute
+ req := testutils.MakeReq(server.URL, "POST", "/verification-token", "")
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusGone, "Status code mismatch")
+
+ var account database.Account
+ var tokenCount int
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", user.ID).First(&account), "finding account")
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&tokenCount), "counting token")
+
+ assert.Equal(t, account.EmailVerified, true, "email_verified should not have been updated")
+ assert.Equal(t, tokenCount, 0, "token count mismatch")
+ })
+}
+
+func TestVerifyEmail(t *testing.T) {
+ t.Run("success", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.SetupAccountData(user, "alice@example.com", "pass1234")
+ tok := database.Token{
+ UserID: user.ID,
+ Type: database.TokenTypeEmailVerification,
+ Value: "someTokenValue",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+
+ dat := `{"token": "someTokenValue"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/verify-email", dat)
+
+ // Execute
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "Status code mismatch")
+
+ var account database.Account
+ var token database.Token
+ var tokenCount int
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", user.ID).First(&account), "finding account")
+ testutils.MustExec(t, testutils.DB.Where("user_id = ? AND type = ?", user.ID, database.TokenTypeEmailVerification).First(&token), "finding token")
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&tokenCount), "counting token")
+
+ assert.Equal(t, account.EmailVerified, true, "email_verified mismatch")
+ assert.NotEqual(t, token.Value, "", "token value should not have been updated")
+ assert.Equal(t, tokenCount, 1, "token count mismatch")
+ assert.NotEqual(t, token.UsedAt, (*time.Time)(nil), "token should have been used")
+ })
+
+ t.Run("used token", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.SetupAccountData(user, "alice@example.com", "pass1234")
+
+ usedAt := time.Now().Add(time.Hour * -11).UTC()
+ tok := database.Token{
+ UserID: user.ID,
+ Type: database.TokenTypeEmailVerification,
+ Value: "someTokenValue",
+ UsedAt: &usedAt,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+
+ dat := `{"token": "someTokenValue"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/verify-email", dat)
+
+ // Execute
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusBadRequest, "")
+
+ var account database.Account
+ var token database.Token
+ var tokenCount int
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", user.ID).First(&account), "finding account")
+ testutils.MustExec(t, testutils.DB.Where("user_id = ? AND type = ?", user.ID, database.TokenTypeEmailVerification).First(&token), "finding token")
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&tokenCount), "counting token")
+
+ assert.Equal(t, account.EmailVerified, false, "email_verified mismatch")
+ assert.NotEqual(t, token.UsedAt, nil, "token used_at mismatch")
+ assert.Equal(t, tokenCount, 1, "token count mismatch")
+ assert.NotEqual(t, token.UsedAt, (*time.Time)(nil), "token should have been used")
+ })
+
+ t.Run("expired token", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.SetupAccountData(user, "alice@example.com", "pass1234")
+
+ tok := database.Token{
+ UserID: user.ID,
+ Type: database.TokenTypeEmailVerification,
+ Value: "someTokenValue",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+ testutils.MustExec(t, testutils.DB.Model(&tok).Update("created_at", time.Now().Add(time.Minute*-31)), "Failed to prepare token created_at")
+
+ dat := `{"token": "someTokenValue"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/verify-email", dat)
+
+ // Execute
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusGone, "")
+
+ var account database.Account
+ var token database.Token
+ var tokenCount int
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", user.ID).First(&account), "finding account")
+ testutils.MustExec(t, testutils.DB.Where("user_id = ? AND type = ?", user.ID, database.TokenTypeEmailVerification).First(&token), "finding token")
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&tokenCount), "counting token")
+
+ assert.Equal(t, account.EmailVerified, false, "email_verified mismatch")
+ assert.Equal(t, tokenCount, 1, "token count mismatch")
+ assert.Equal(t, token.UsedAt, (*time.Time)(nil), "token should have not been used")
+ })
+
+ t.Run("already verified", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ a := testutils.SetupAccountData(user, "alice@example.com", "oldpass1234")
+ a.EmailVerified = true
+ testutils.MustExec(t, testutils.DB.Save(&a), "preparing account")
+
+ tok := database.Token{
+ UserID: user.ID,
+ Type: database.TokenTypeEmailVerification,
+ Value: "someTokenValue",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+
+ dat := `{"token": "someTokenValue"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/verify-email", dat)
+
+ // Execute
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusConflict, "")
+
+ var account database.Account
+ var token database.Token
+ var tokenCount int
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", user.ID).First(&account), "finding account")
+ testutils.MustExec(t, testutils.DB.Where("user_id = ? AND type = ?", user.ID, database.TokenTypeEmailVerification).First(&token), "finding token")
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&tokenCount), "counting token")
+
+ assert.Equal(t, account.EmailVerified, true, "email_verified mismatch")
+ assert.Equal(t, tokenCount, 1, "token count mismatch")
+ assert.Equal(t, token.UsedAt, (*time.Time)(nil), "token should have not been used")
+ })
+}
+
+func TestUpdateEmail(t *testing.T) {
+ t.Run("success", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, "alice@example.com", "pass1234")
+ a.EmailVerified = true
+ testutils.MustExec(t, testutils.DB.Save(&a), "updating email_verified")
+
+ // Execute
+ dat := `{"email": "alice-new@example.com", "password": "pass1234"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/account/profile", dat)
+ res := testutils.HTTPAuthDo(t, req, u)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var user database.User
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("id = ?", u.ID).First(&user), "finding user")
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&account), "finding account")
+
+ assert.Equal(t, account.Email.String, "alice-new@example.com", "email mismatch")
+ assert.Equal(t, account.EmailVerified, false, "EmailVerified mismatch")
+ })
+
+ t.Run("password mismatch", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, "alice@example.com", "pass1234")
+ a.EmailVerified = true
+ testutils.MustExec(t, testutils.DB.Save(&a), "updating email_verified")
+
+ // Execute
+ dat := `{"email": "alice-new@example.com", "password": "wrongpassword"}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/account/profile", dat)
+ res := testutils.HTTPAuthDo(t, req, u)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "Status code mismsatch")
+
+ var user database.User
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("id = ?", u.ID).First(&user), "finding user")
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&account), "finding account")
+
+ assert.Equal(t, account.Email.String, "alice@example.com", "email mismatch")
+ assert.Equal(t, account.EmailVerified, true, "EmailVerified mismatch")
+ })
+}
+
+func TestUpdateEmailPreference(t *testing.T) {
+ t.Run("with login", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupEmailPreferenceData(u, false)
+
+ // Execute
+ dat := `{"inactive_reminder": true}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/account/email-preference", dat)
+ res := testutils.HTTPAuthDo(t, req, u)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var preference database.EmailPreference
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&preference), "finding account")
+ assert.Equal(t, preference.InactiveReminder, true, "preference mismatch")
+ })
+
+ t.Run("with an unused token", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupEmailPreferenceData(u, false)
+ tok := database.Token{
+ UserID: u.ID,
+ Type: database.TokenTypeEmailPreference,
+ Value: "someTokenValue",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+
+ // Execute
+ dat := `{"inactive_reminder": true}`
+ url := fmt.Sprintf("/account/email-preference?token=%s", "someTokenValue")
+ req := testutils.MakeReq(server.URL, "PATCH", url, dat)
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var preference database.EmailPreference
+ var preferenceCount int
+ var token database.Token
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&preference), "finding preference")
+ testutils.MustExec(t, testutils.DB.Model(database.EmailPreference{}).Count(&preferenceCount), "counting preference")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", tok.ID).First(&token), "failed to find token")
+
+ assert.Equal(t, preferenceCount, 1, "preference count mismatch")
+ assert.Equal(t, preference.InactiveReminder, true, "email mismatch")
+ assert.NotEqual(t, token.UsedAt, (*time.Time)(nil), "token should have been used")
+ })
+
+ t.Run("with nonexistent token", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupEmailPreferenceData(u, true)
+ tok := database.Token{
+ UserID: u.ID,
+ Type: database.TokenTypeEmailPreference,
+ Value: "someTokenValue",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+
+ dat := `{"inactive_reminder": false}`
+ url := fmt.Sprintf("/account/email-preference?token=%s", "someNonexistentToken")
+ req := testutils.MakeReq(server.URL, "PATCH", url, dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
+
+ var preference database.EmailPreference
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&preference), "finding preference")
+ assert.Equal(t, preference.InactiveReminder, true, "email mismatch")
+ })
+
+ t.Run("with expired token", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupEmailPreferenceData(u, true)
+
+ usedAt := time.Now().Add(-11 * time.Minute)
+ tok := database.Token{
+ UserID: u.ID,
+ Type: database.TokenTypeEmailPreference,
+ Value: "someTokenValue",
+ UsedAt: &usedAt,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+
+ // Execute
+ dat := `{"inactive_reminder": false}`
+ url := fmt.Sprintf("/account/email-preference?token=%s", "someTokenValue")
+ req := testutils.MakeReq(server.URL, "PATCH", url, dat)
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
+
+ var preference database.EmailPreference
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&preference), "finding preference")
+ assert.Equal(t, preference.InactiveReminder, true, "email mismatch")
+ })
+
+ t.Run("with a used but unexpired token", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupEmailPreferenceData(u, true)
+ usedAt := time.Now().Add(-9 * time.Minute)
+ tok := database.Token{
+ UserID: u.ID,
+ Type: database.TokenTypeEmailPreference,
+ Value: "someTokenValue",
+ UsedAt: &usedAt,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+
+ dat := `{"inactive_reminder": false}`
+ url := fmt.Sprintf("/account/email-preference?token=%s", "someTokenValue")
+ req := testutils.MakeReq(server.URL, "PATCH", url, dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var preference database.EmailPreference
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&preference), "finding preference")
+ assert.Equal(t, preference.InactiveReminder, false, "InactiveReminder mismatch")
+ })
+
+ t.Run("no user and no token", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupEmailPreferenceData(u, true)
+
+ // Execute
+ dat := `{"inactive_reminder": false}`
+ req := testutils.MakeReq(server.URL, "PATCH", "/account/email-preference", dat)
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
+
+ var preference database.EmailPreference
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&preference), "finding preference")
+ assert.Equal(t, preference.InactiveReminder, true, "email mismatch")
+ })
+
+ t.Run("create a record if not exists", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ tok := database.Token{
+ UserID: u.ID,
+ Type: database.TokenTypeEmailPreference,
+ Value: "someTokenValue",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+
+ // Execute
+ dat := `{"inactive_reminder": false}`
+ url := fmt.Sprintf("/account/email-preference?token=%s", "someTokenValue")
+ req := testutils.MakeReq(server.URL, "PATCH", url, dat)
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var preferenceCount int
+ testutils.MustExec(t, testutils.DB.Model(database.EmailPreference{}).Count(&preferenceCount), "counting preference")
+ assert.Equal(t, preferenceCount, 1, "preference count mismatch")
+
+ var preference database.EmailPreference
+ testutils.MustExec(t, testutils.DB.Where("user_id = ?", u.ID).First(&preference), "finding preference")
+ assert.Equal(t, preference.InactiveReminder, false, "email mismatch")
+ })
+}
+
+func TestGetEmailPreference(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ pref := testutils.SetupEmailPreferenceData(u, true)
+
+ // Execute
+ req := testutils.MakeReq(server.URL, "GET", "/account/email-preference", "")
+ res := testutils.HTTPAuthDo(t, req, u)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var got presenters.EmailPreference
+ if err := json.NewDecoder(res.Body).Decode(&got); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ expected := presenters.EmailPreference{
+ InactiveReminder: pref.InactiveReminder,
+ ProductUpdate: pref.ProductUpdate,
+ CreatedAt: presenters.FormatTS(pref.CreatedAt),
+ UpdatedAt: presenters.FormatTS(pref.UpdatedAt),
+ }
+ assert.DeepEqual(t, got, expected, "payload mismatch")
+}
diff --git a/pkg/server/api/v3_auth.go b/pkg/server/api/v3_auth.go
new file mode 100644
index 00000000..1c9ab145
--- /dev/null
+++ b/pkg/server/api/v3_auth.go
@@ -0,0 +1,226 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "net/http"
+ "time"
+
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/dnote/dnote/pkg/server/log"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+ "golang.org/x/crypto/bcrypt"
+)
+
+// ErrLoginFailure is an error for failed login
+var ErrLoginFailure = errors.New("Wrong email and password combination")
+
+// SessionResponse is a response containing a session information
+type SessionResponse struct {
+ Key string `json:"key"`
+ ExpiresAt int64 `json:"expires_at"`
+}
+
+func setSessionCookie(w http.ResponseWriter, key string, expires time.Time) {
+ cookie := http.Cookie{
+ Name: "id",
+ Value: key,
+ Expires: expires,
+ Path: "/",
+ HttpOnly: true,
+ }
+ http.SetCookie(w, &cookie)
+}
+
+func touchLastLoginAt(db *gorm.DB, user database.User) error {
+ t := time.Now()
+ if err := db.Model(&user).Update(database.User{LastLoginAt: &t}).Error; err != nil {
+ return errors.Wrap(err, "updating last_login_at")
+ }
+
+ return nil
+}
+
+type signinPayload struct {
+ Email string `json:"email"`
+ Password string `json:"password"`
+}
+
+func (a *API) signin(w http.ResponseWriter, r *http.Request) {
+ var params signinPayload
+ err := json.NewDecoder(r.Body).Decode(¶ms)
+ if err != nil {
+ handlers.DoError(w, "decoding payload", err, http.StatusInternalServerError)
+ return
+ }
+ if params.Email == "" || params.Password == "" {
+ http.Error(w, ErrLoginFailure.Error(), http.StatusUnauthorized)
+ return
+ }
+
+ var account database.Account
+ conn := a.App.DB.Where("email = ?", params.Email).First(&account)
+ if conn.RecordNotFound() {
+ http.Error(w, ErrLoginFailure.Error(), http.StatusUnauthorized)
+ return
+ } else if conn.Error != nil {
+ handlers.DoError(w, "getting user", err, http.StatusInternalServerError)
+ return
+ }
+
+ password := []byte(params.Password)
+ err = bcrypt.CompareHashAndPassword([]byte(account.Password.String), password)
+ if err != nil {
+ http.Error(w, ErrLoginFailure.Error(), http.StatusUnauthorized)
+ return
+ }
+
+ var user database.User
+ err = a.App.DB.Where("id = ?", account.UserID).First(&user).Error
+ if err != nil {
+ handlers.DoError(w, "finding user", err, http.StatusInternalServerError)
+ return
+ }
+
+ err = a.App.TouchLastLoginAt(user, a.App.DB)
+ if err != nil {
+ http.Error(w, errors.Wrap(err, "touching login timestamp").Error(), http.StatusInternalServerError)
+ return
+ }
+
+ a.respondWithSession(a.App.DB, w, account.UserID, http.StatusOK)
+}
+
+func (a *API) signoutOptions(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Access-Control-Allow-Methods", "POST")
+ w.Header().Set("Access-Control-Allow-Headers", "Authorization, Version")
+}
+
+func (a *API) signout(w http.ResponseWriter, r *http.Request) {
+ key, err := handlers.GetCredential(r)
+ if err != nil {
+ handlers.DoError(w, "getting credential", nil, http.StatusInternalServerError)
+ return
+ }
+
+ if key == "" {
+ w.WriteHeader(http.StatusNoContent)
+ return
+ }
+
+ err = a.App.DeleteSession(key)
+ if err != nil {
+ handlers.DoError(w, "deleting session", nil, http.StatusInternalServerError)
+ return
+ }
+
+ handlers.UnsetSessionCookie(w)
+ w.WriteHeader(http.StatusNoContent)
+}
+
+type registerPayload struct {
+ Email string `json:"email"`
+ Password string `json:"password"`
+}
+
+func validateRegisterPayload(p registerPayload) error {
+ if p.Email == "" {
+ return errors.New("email is required")
+ }
+ if len(p.Password) < 8 {
+ return errors.New("Password should be longer than 8 characters")
+ }
+
+ return nil
+}
+
+func parseRegisterPaylaod(r *http.Request) (registerPayload, error) {
+ var ret registerPayload
+ if err := json.NewDecoder(r.Body).Decode(&ret); err != nil {
+ return ret, errors.Wrap(err, "decoding json")
+ }
+
+ return ret, nil
+}
+
+func (a *API) register(w http.ResponseWriter, r *http.Request) {
+ if a.App.Config.DisableRegistration {
+ handlers.RespondForbidden(w)
+ return
+ }
+
+ params, err := parseRegisterPaylaod(r)
+ if err != nil {
+ http.Error(w, "invalid payload", http.StatusBadRequest)
+ return
+ }
+ if err := validateRegisterPayload(params); err != nil {
+ http.Error(w, err.Error(), http.StatusBadRequest)
+ return
+ }
+
+ var count int
+ if err := a.App.DB.Model(database.Account{}).Where("email = ?", params.Email).Count(&count).Error; err != nil {
+ handlers.DoError(w, "checking duplicate user", err, http.StatusInternalServerError)
+ return
+ }
+ if count > 0 {
+ http.Error(w, "Duplicate email", http.StatusBadRequest)
+ return
+ }
+
+ user, err := a.App.CreateUser(params.Email, params.Password)
+ if err != nil {
+ handlers.DoError(w, "creating user", err, http.StatusInternalServerError)
+ return
+ }
+
+ a.respondWithSession(a.App.DB, w, user.ID, http.StatusCreated)
+
+ if err := a.App.SendWelcomeEmail(params.Email); err != nil {
+ log.ErrorWrap(err, "sending welcome email")
+ }
+}
+
+// respondWithSession makes a HTTP response with the session from the user with the given userID.
+// It sets the HTTP-Only cookie for browser clients and also sends a JSON response for non-browser clients.
+func (a *API) respondWithSession(db *gorm.DB, w http.ResponseWriter, userID int, statusCode int) {
+ session, err := a.App.CreateSession(userID)
+ if err != nil {
+ handlers.DoError(w, "creating session", nil, http.StatusBadRequest)
+ return
+ }
+
+ setSessionCookie(w, session.Key, session.ExpiresAt)
+
+ response := SessionResponse{
+ Key: session.Key,
+ ExpiresAt: session.ExpiresAt.Unix(),
+ }
+
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(statusCode)
+ if err := json.NewEncoder(w).Encode(response); err != nil {
+ handlers.DoError(w, "encoding response", err, http.StatusInternalServerError)
+ return
+ }
+}
diff --git a/pkg/server/api/v3_auth_test.go b/pkg/server/api/v3_auth_test.go
new file mode 100644
index 00000000..f08eea2b
--- /dev/null
+++ b/pkg/server/api/v3_auth_test.go
@@ -0,0 +1,482 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "testing"
+ "time"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+ "golang.org/x/crypto/bcrypt"
+)
+
+func assertSessionResp(t *testing.T, res *http.Response) {
+ // after register, should sign in user
+ var got SessionResponse
+ if err := json.NewDecoder(res.Body).Decode(&got); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ var sessionCount int
+ var session database.Session
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Count(&sessionCount), "counting session")
+ testutils.MustExec(t, testutils.DB.First(&session), "getting session")
+
+ assert.Equal(t, sessionCount, 1, "sessionCount mismatch")
+ assert.Equal(t, got.Key, session.Key, "session Key mismatch")
+ assert.Equal(t, got.ExpiresAt, session.ExpiresAt.Unix(), "session ExpiresAt mismatch")
+
+ c := testutils.GetCookieByName(res.Cookies(), "id")
+ assert.Equal(t, c.Value, session.Key, "session key mismatch")
+ assert.Equal(t, c.Path, "/", "session path mismatch")
+ assert.Equal(t, c.HttpOnly, true, "session HTTPOnly mismatch")
+ assert.Equal(t, c.Expires.Unix(), session.ExpiresAt.Unix(), "session Expires mismatch")
+}
+
+func TestRegister(t *testing.T) {
+ testCases := []struct {
+ email string
+ password string
+ onPremise bool
+ expectedPro bool
+ }{
+ {
+ email: "alice@example.com",
+ password: "pass1234",
+ onPremise: false,
+ expectedPro: false,
+ },
+ {
+ email: "bob@example.com",
+ password: "Y9EwmjH@Jq6y5a64MSACUoM4w7SAhzvY",
+ onPremise: false,
+ expectedPro: false,
+ },
+ {
+ email: "chuck@example.com",
+ password: "e*H@kJi^vXbWEcD9T5^Am!Y@7#Po2@PC",
+ onPremise: false,
+ expectedPro: false,
+ },
+ // on premise
+ {
+ email: "dan@example.com",
+ password: "e*H@kJi^vXbWEcD9T5^Am!Y@7#Po2@PC",
+ onPremise: true,
+ expectedPro: true,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("register %s %s", tc.email, tc.password), func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ c := config.Load()
+ c.SetOnPremise(tc.onPremise)
+
+ // Setup
+ emailBackend := testutils.MockEmailbackendImplementation{}
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ EmailBackend: &emailBackend,
+ Config: c,
+ })
+ defer server.Close()
+
+ dat := fmt.Sprintf(`{"email": "%s", "password": "%s"}`, tc.email, tc.password)
+ req := testutils.MakeReq(server.URL, "POST", "/v3/register", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusCreated, "")
+
+ var account database.Account
+ testutils.MustExec(t, testutils.DB.Where("email = ?", tc.email).First(&account), "finding account")
+ assert.Equal(t, account.Email.String, tc.email, "Email mismatch")
+ assert.NotEqual(t, account.UserID, 0, "UserID mismatch")
+ passwordErr := bcrypt.CompareHashAndPassword([]byte(account.Password.String), []byte(tc.password))
+ assert.Equal(t, passwordErr, nil, "Password mismatch")
+
+ var user database.User
+ testutils.MustExec(t, testutils.DB.Where("id = ?", account.UserID).First(&user), "finding user")
+ assert.Equal(t, user.Cloud, tc.expectedPro, "Cloud mismatch")
+ assert.Equal(t, user.MaxUSN, 0, "MaxUSN mismatch")
+
+ // welcome email
+ assert.Equalf(t, len(emailBackend.Emails), 1, "email queue count mismatch")
+ assert.DeepEqual(t, emailBackend.Emails[0].To, []string{tc.email}, "email to mismatch")
+
+ // after register, should sign in user
+ assertSessionResp(t, res)
+ })
+ }
+}
+
+func TestRegisterMissingParams(t *testing.T) {
+ t.Run("missing email", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ dat := fmt.Sprintf(`{"password": %s}`, "SLMZFM5RmSjA5vfXnG5lPOnrpZSbtmV76cnAcrlr2yU")
+ req := testutils.MakeReq(server.URL, "POST", "/v3/register", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status mismatch")
+
+ var accountCount, userCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Account{}).Count(&accountCount), "counting account")
+ testutils.MustExec(t, testutils.DB.Model(&database.User{}).Count(&userCount), "counting user")
+
+ assert.Equal(t, accountCount, 0, "accountCount mismatch")
+ assert.Equal(t, userCount, 0, "userCount mismatch")
+ })
+
+ t.Run("missing password", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ dat := fmt.Sprintf(`{"email": "%s"}`, "alice@example.com")
+ req := testutils.MakeReq(server.URL, "POST", "/v3/register", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status mismatch")
+
+ var accountCount, userCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Account{}).Count(&accountCount), "counting account")
+ testutils.MustExec(t, testutils.DB.Model(&database.User{}).Count(&userCount), "counting user")
+
+ assert.Equal(t, accountCount, 0, "accountCount mismatch")
+ assert.Equal(t, userCount, 0, "userCount mismatch")
+ })
+}
+
+func TestRegisterDuplicateEmail(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupAccountData(u, "alice@example.com", "somepassword")
+
+ dat := `{"email": "alice@example.com", "password": "foobarbaz"}`
+ req := testutils.MakeReq(server.URL, "POST", "/v3/register", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusBadRequest, "status code mismatch")
+
+ var accountCount, userCount, verificationTokenCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Account{}).Count(&accountCount), "counting account")
+ testutils.MustExec(t, testutils.DB.Model(&database.User{}).Count(&userCount), "counting user")
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&verificationTokenCount), "counting verification token")
+
+ var user database.User
+ testutils.MustExec(t, testutils.DB.Where("id = ?", u.ID).First(&user), "finding user")
+
+ assert.Equal(t, accountCount, 1, "account count mismatch")
+ assert.Equal(t, userCount, 1, "user count mismatch")
+ assert.Equal(t, verificationTokenCount, 0, "verification_token should not have been created")
+ assert.Equal(t, user.LastLoginAt, (*time.Time)(nil), "LastLoginAt mismatch")
+}
+
+func TestRegisterDisabled(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ c := config.Load()
+ c.DisableRegistration = true
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+ Clock: clock.NewMock(),
+ Config: c,
+ })
+ defer server.Close()
+
+ dat := `{"email": "alice@example.com", "password": "foobarbaz"}`
+ req := testutils.MakeReq(server.URL, "POST", "/v3/register", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusForbidden, "status code mismatch")
+
+ var accountCount, userCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Account{}).Count(&accountCount), "counting account")
+ testutils.MustExec(t, testutils.DB.Model(&database.User{}).Count(&userCount), "counting user")
+
+ assert.Equal(t, accountCount, 0, "account count mismatch")
+ assert.Equal(t, userCount, 0, "user count mismatch")
+}
+
+func TestSignIn(t *testing.T) {
+ t.Run("success", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupAccountData(u, "alice@example.com", "pass1234")
+
+ dat := `{"email": "alice@example.com", "password": "pass1234"}`
+ req := testutils.MakeReq(server.URL, "POST", "/v3/signin", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var user database.User
+ testutils.MustExec(t, testutils.DB.Model(&database.User{}).First(&user), "finding user")
+ assert.NotEqual(t, user.LastLoginAt, nil, "LastLoginAt mismatch")
+
+ // after register, should sign in user
+ assertSessionResp(t, res)
+ })
+
+ t.Run("wrong password", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupAccountData(u, "alice@example.com", "pass1234")
+
+ dat := `{"email": "alice@example.com", "password": "wrongpassword1234"}`
+ req := testutils.MakeReq(server.URL, "POST", "/v3/signin", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
+
+ var user database.User
+ testutils.MustExec(t, testutils.DB.Model(&database.User{}).First(&user), "finding user")
+ assert.Equal(t, user.LastLoginAt, (*time.Time)(nil), "LastLoginAt mismatch")
+
+ var sessionCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Count(&sessionCount), "counting session")
+ assert.Equal(t, sessionCount, 0, "sessionCount mismatch")
+ })
+
+ t.Run("wrong email", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ u := testutils.SetupUserData()
+ testutils.SetupAccountData(u, "alice@example.com", "pass1234")
+
+ dat := `{"email": "bob@example.com", "password": "pass1234"}`
+ req := testutils.MakeReq(server.URL, "POST", "/v3/signin", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
+
+ var user database.User
+ testutils.MustExec(t, testutils.DB.Model(&database.User{}).First(&user), "finding user")
+ assert.DeepEqual(t, user.LastLoginAt, (*time.Time)(nil), "LastLoginAt mismatch")
+
+ var sessionCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Count(&sessionCount), "counting session")
+ assert.Equal(t, sessionCount, 0, "sessionCount mismatch")
+ })
+
+ t.Run("nonexistent email", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ dat := `{"email": "nonexistent@example.com", "password": "pass1234"}`
+ req := testutils.MakeReq(server.URL, "POST", "/v3/signin", dat)
+
+ // Execute
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
+
+ var sessionCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Count(&sessionCount), "counting session")
+ assert.Equal(t, sessionCount, 0, "sessionCount mismatch")
+ })
+}
+
+func TestSignout(t *testing.T) {
+ t.Run("authenticated", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ aliceUser := testutils.SetupUserData()
+ testutils.SetupAccountData(aliceUser, "alice@example.com", "pass1234")
+ anotherUser := testutils.SetupUserData()
+
+ session1 := database.Session{
+ Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
+ UserID: aliceUser.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session1), "preparing session1")
+ session2 := database.Session{
+ Key: "MDCpbvCRg7W2sH6S870wqLqZDZTObYeVd0PzOekfo/A=",
+ UserID: anotherUser.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session2), "preparing session2")
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ // Execute
+ req := testutils.MakeReq(server.URL, "POST", "/v3/signout", "")
+ req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU="))
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusNoContent, "Status mismatch")
+
+ var sessionCount int
+ var s2 database.Session
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Count(&sessionCount), "counting session")
+ testutils.MustExec(t, testutils.DB.Where("key = ?", "MDCpbvCRg7W2sH6S870wqLqZDZTObYeVd0PzOekfo/A=").First(&s2), "getting s2")
+
+ assert.Equal(t, sessionCount, 1, "sessionCount mismatch")
+
+ c := testutils.GetCookieByName(res.Cookies(), "id")
+ assert.Equal(t, c.Value, "", "session key mismatch")
+ assert.Equal(t, c.Path, "/", "session path mismatch")
+ assert.Equal(t, c.HttpOnly, true, "session HTTPOnly mismatch")
+ if c.Expires.After(time.Now()) {
+ t.Error("session cookie is not expired")
+ }
+ })
+
+ t.Run("unauthenticated", func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ aliceUser := testutils.SetupUserData()
+ testutils.SetupAccountData(aliceUser, "alice@example.com", "pass1234")
+ anotherUser := testutils.SetupUserData()
+
+ session1 := database.Session{
+ Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
+ UserID: aliceUser.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session1), "preparing session1")
+ session2 := database.Session{
+ Key: "MDCpbvCRg7W2sH6S870wqLqZDZTObYeVd0PzOekfo/A=",
+ UserID: anotherUser.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session2), "preparing session2")
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ // Execute
+ req := testutils.MakeReq(server.URL, "POST", "/v3/signout", "")
+ res := testutils.HTTPDo(t, req)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusNoContent, "Status mismatch")
+
+ var sessionCount int
+ var postSession1, postSession2 database.Session
+ testutils.MustExec(t, testutils.DB.Model(&database.Session{}).Count(&sessionCount), "counting session")
+ testutils.MustExec(t, testutils.DB.Where("key = ?", "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=").First(&postSession1), "getting postSession1")
+ testutils.MustExec(t, testutils.DB.Where("key = ?", "MDCpbvCRg7W2sH6S870wqLqZDZTObYeVd0PzOekfo/A=").First(&postSession2), "getting postSession2")
+
+ // two existing sessions should remain
+ assert.Equal(t, sessionCount, 2, "sessionCount mismatch")
+
+ c := testutils.GetCookieByName(res.Cookies(), "id")
+ assert.Equal(t, c, (*http.Cookie)(nil), "id cookie should have not been set")
+ })
+}
diff --git a/pkg/server/api/v3_books.go b/pkg/server/api/v3_books.go
new file mode 100644
index 00000000..962d38af
--- /dev/null
+++ b/pkg/server/api/v3_books.go
@@ -0,0 +1,267 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/url"
+
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/dnote/dnote/pkg/server/helpers"
+ "github.com/dnote/dnote/pkg/server/presenters"
+ "github.com/gorilla/mux"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+)
+
+type createBookPayload struct {
+ Name string `json:"name"`
+}
+
+// CreateBookResp is the response from create book api
+type CreateBookResp struct {
+ Book presenters.Book `json:"book"`
+}
+
+func validateCreateBookPayload(p createBookPayload) error {
+ if p.Name == "" {
+ return errors.New("name is required")
+ }
+
+ return nil
+}
+
+// CreateBook creates a new book
+func (a *API) CreateBook(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ return
+ }
+
+ var params createBookPayload
+ err := json.NewDecoder(r.Body).Decode(¶ms)
+ if err != nil {
+ handlers.DoError(w, "decoding payload", err, http.StatusInternalServerError)
+ return
+ }
+
+ err = validateCreateBookPayload(params)
+ if err != nil {
+ handlers.DoError(w, "validating payload", err, http.StatusBadRequest)
+ return
+ }
+
+ var bookCount int
+ err = a.App.DB.Model(database.Book{}).
+ Where("user_id = ? AND label = ?", user.ID, params.Name).
+ Count(&bookCount).Error
+ if err != nil {
+ handlers.DoError(w, "checking duplicate", err, http.StatusInternalServerError)
+ return
+ }
+ if bookCount > 0 {
+ http.Error(w, "duplicate book exists", http.StatusConflict)
+ return
+ }
+
+ book, err := a.App.CreateBook(user, params.Name)
+ if err != nil {
+ handlers.DoError(w, "inserting book", err, http.StatusInternalServerError)
+ }
+ resp := CreateBookResp{
+ Book: presenters.PresentBook(book),
+ }
+ handlers.RespondJSON(w, http.StatusCreated, resp)
+}
+
+// BooksOptions is a handler for OPTIONS endpoint for notes
+func (a *API) BooksOptions(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Access-Control-Allow-Methods", "GET, POST")
+ w.Header().Set("Access-Control-Allow-Headers", "Authorization, Version")
+}
+
+func respondWithBooks(db *gorm.DB, userID int, query url.Values, w http.ResponseWriter) {
+ var books []database.Book
+ conn := db.Where("user_id = ? AND NOT deleted", userID).Order("label ASC")
+ name := query.Get("name")
+ encryptedStr := query.Get("encrypted")
+
+ if name != "" {
+ part := fmt.Sprintf("%%%s%%", name)
+ conn = conn.Where("LOWER(label) LIKE ?", part)
+ }
+ if encryptedStr != "" {
+ var encrypted bool
+ if encryptedStr == "true" {
+ encrypted = true
+ } else {
+ encrypted = false
+ }
+
+ conn = conn.Where("encrypted = ?", encrypted)
+ }
+
+ if err := conn.Find(&books).Error; err != nil {
+ handlers.DoError(w, "finding books", err, http.StatusInternalServerError)
+ return
+ }
+
+ presentedBooks := presenters.PresentBooks(books)
+ handlers.RespondJSON(w, http.StatusOK, presentedBooks)
+}
+
+// GetBooks returns books for the user
+func (a *API) GetBooks(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ return
+ }
+
+ query := r.URL.Query()
+
+ respondWithBooks(a.App.DB, user.ID, query, w)
+}
+
+// GetBook returns a book for the user
+func (a *API) GetBook(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ return
+ }
+
+ vars := mux.Vars(r)
+ bookUUID := vars["bookUUID"]
+
+ var book database.Book
+ conn := a.App.DB.Where("uuid = ? AND user_id = ?", bookUUID, user.ID).First(&book)
+
+ if conn.RecordNotFound() {
+ w.WriteHeader(http.StatusNotFound)
+ return
+ }
+ if err := conn.Error; err != nil {
+ handlers.DoError(w, "finding book", err, http.StatusInternalServerError)
+ return
+ }
+
+ p := presenters.PresentBook(book)
+ handlers.RespondJSON(w, http.StatusOK, p)
+}
+
+type updateBookPayload struct {
+ Name *string `json:"name"`
+}
+
+// UpdateBookResp is the response from create book api
+type UpdateBookResp struct {
+ Book presenters.Book `json:"book"`
+}
+
+// UpdateBook updates a book
+func (a *API) UpdateBook(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ return
+ }
+
+ vars := mux.Vars(r)
+ uuid := vars["bookUUID"]
+
+ tx := a.App.DB.Begin()
+
+ var book database.Book
+ if err := tx.Where("user_id = ? AND uuid = ?", user.ID, uuid).First(&book).Error; err != nil {
+ handlers.DoError(w, "finding book", err, http.StatusInternalServerError)
+ return
+ }
+
+ var params updateBookPayload
+ err := json.NewDecoder(r.Body).Decode(¶ms)
+ if err != nil {
+ handlers.DoError(w, "decoding payload", err, http.StatusInternalServerError)
+ return
+ }
+
+ book, err = a.App.UpdateBook(tx, user, book, params.Name)
+ if err != nil {
+ tx.Rollback()
+ handlers.DoError(w, "updating a book", err, http.StatusInternalServerError)
+ }
+
+ tx.Commit()
+
+ resp := UpdateBookResp{
+ Book: presenters.PresentBook(book),
+ }
+ handlers.RespondJSON(w, http.StatusOK, resp)
+}
+
+// DeleteBookResp is the response from create book api
+type DeleteBookResp struct {
+ Status int `json:"status"`
+ Book presenters.Book `json:"book"`
+}
+
+// DeleteBook removes a book
+func (a *API) DeleteBook(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ return
+ }
+
+ vars := mux.Vars(r)
+ uuid := vars["bookUUID"]
+
+ tx := a.App.DB.Begin()
+
+ var book database.Book
+ if err := tx.Where("user_id = ? AND uuid = ?", user.ID, uuid).First(&book).Error; err != nil {
+ handlers.DoError(w, "finding book", err, http.StatusInternalServerError)
+ return
+ }
+
+ var notes []database.Note
+ if err := tx.Where("book_uuid = ? AND NOT deleted", uuid).Order("usn ASC").Find(¬es).Error; err != nil {
+ handlers.DoError(w, "finding notes", err, http.StatusInternalServerError)
+ return
+ }
+
+ for _, note := range notes {
+ if _, err := a.App.DeleteNote(tx, user, note); err != nil {
+ handlers.DoError(w, "deleting a note", err, http.StatusInternalServerError)
+ return
+ }
+ }
+ b, err := a.App.DeleteBook(tx, user, book)
+ if err != nil {
+ handlers.DoError(w, "deleting book", err, http.StatusInternalServerError)
+ return
+ }
+
+ tx.Commit()
+
+ resp := DeleteBookResp{
+ Status: http.StatusOK,
+ Book: presenters.PresentBook(b),
+ }
+ handlers.RespondJSON(w, http.StatusOK, resp)
+}
diff --git a/pkg/server/api/v3_books_test.go b/pkg/server/api/v3_books_test.go
new file mode 100644
index 00000000..0dbeaae3
--- /dev/null
+++ b/pkg/server/api/v3_books_test.go
@@ -0,0 +1,548 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/presenters"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+)
+
+func TestGetBooks(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ anotherUser := testutils.SetupUserData()
+
+ b1 := database.Book{
+ UserID: user.ID,
+ Label: "js",
+ USN: 1123,
+ Deleted: false,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+ b2 := database.Book{
+ UserID: user.ID,
+ Label: "css",
+ USN: 1125,
+ Deleted: false,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b2), "preparing b2")
+ b3 := database.Book{
+ UserID: anotherUser.ID,
+ Label: "css",
+ USN: 1128,
+ Deleted: false,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b3), "preparing b3")
+ b4 := database.Book{
+ UserID: user.ID,
+ Label: "",
+ USN: 1129,
+ Deleted: true,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b4), "preparing b4")
+
+ // Execute
+ req := testutils.MakeReq(server.URL, "GET", "/v3/books", "")
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var payload []presenters.Book
+ if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ var b1Record, b2Record database.Book
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b1.ID).First(&b1Record), "finding b1")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b2.ID).First(&b2Record), "finding b2")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b2.ID).First(&b2Record), "finding b2")
+
+ expected := []presenters.Book{
+ {
+ UUID: b2Record.UUID,
+ CreatedAt: b2Record.CreatedAt,
+ UpdatedAt: b2Record.UpdatedAt,
+ Label: b2Record.Label,
+ USN: b2Record.USN,
+ },
+ {
+ UUID: b1Record.UUID,
+ CreatedAt: b1Record.CreatedAt,
+ UpdatedAt: b1Record.UpdatedAt,
+ Label: b1Record.Label,
+ USN: b1Record.USN,
+ },
+ }
+
+ assert.DeepEqual(t, payload, expected, "payload mismatch")
+}
+
+func TestGetBooksByName(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ anotherUser := testutils.SetupUserData()
+ req := testutils.MakeReq(server.URL, "GET", "/v3/books?name=js", "")
+
+ b1 := database.Book{
+ UserID: user.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+ b2 := database.Book{
+ UserID: user.ID,
+ Label: "css",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b2), "preparing b2")
+ b3 := database.Book{
+ UserID: anotherUser.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b3), "preparing b3")
+
+ // Execute
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var payload []presenters.Book
+ if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding payload"))
+ }
+
+ var b1Record database.Book
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b1.ID).First(&b1Record), "finding b1")
+
+ expected := []presenters.Book{
+ {
+ UUID: b1Record.UUID,
+ CreatedAt: b1Record.CreatedAt,
+ UpdatedAt: b1Record.UpdatedAt,
+ Label: b1Record.Label,
+ USN: b1Record.USN,
+ },
+ }
+
+ assert.DeepEqual(t, payload, expected, "payload mismatch")
+}
+
+func TestDeleteBook(t *testing.T) {
+ testCases := []struct {
+ label string
+ deleted bool
+ expectedB2USN int
+ expectedMaxUSN int
+ expectedN2USN int
+ expectedN3USN int
+ }{
+ {
+ label: "n1 content",
+ deleted: false,
+ expectedMaxUSN: 61,
+ expectedB2USN: 61,
+ expectedN2USN: 59,
+ expectedN3USN: 60,
+ },
+ {
+ label: "",
+ deleted: true,
+ expectedMaxUSN: 59,
+ expectedB2USN: 59,
+ expectedN2USN: 5,
+ expectedN3USN: 6,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("originally deleted %t", tc.deleted), func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", 58), "preparing user max_usn")
+ anotherUser := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&anotherUser).Update("max_usn", 109), "preparing another user max_usn")
+
+ b1 := database.Book{
+ UserID: user.ID,
+ Label: "js",
+ USN: 1,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing a book data")
+ b2 := database.Book{
+ UserID: user.ID,
+ Label: tc.label,
+ USN: 2,
+ Deleted: tc.deleted,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b2), "preparing a book data")
+ b3 := database.Book{
+ UserID: anotherUser.ID,
+ Label: "linux",
+ USN: 3,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b3), "preparing a book data")
+
+ var n2Body string
+ if !tc.deleted {
+ n2Body = "n2 content"
+ }
+ var n3Body string
+ if !tc.deleted {
+ n3Body = "n3 content"
+ }
+
+ n1 := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: "n1 content",
+ USN: 4,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n1), "preparing a note data")
+ n2 := database.Note{
+ UserID: user.ID,
+ BookUUID: b2.UUID,
+ Body: n2Body,
+ USN: 5,
+ Deleted: tc.deleted,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n2), "preparing a note data")
+ n3 := database.Note{
+ UserID: user.ID,
+ BookUUID: b2.UUID,
+ Body: n3Body,
+ USN: 6,
+ Deleted: tc.deleted,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n3), "preparing a note data")
+ n4 := database.Note{
+ UserID: user.ID,
+ BookUUID: b2.UUID,
+ Body: "",
+ USN: 7,
+ Deleted: true,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n4), "preparing a note data")
+ n5 := database.Note{
+ UserID: anotherUser.ID,
+ BookUUID: b3.UUID,
+ Body: "n5 content",
+ USN: 8,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n5), "preparing a note data")
+
+ endpoint := fmt.Sprintf("/v3/books/%s", b2.UUID)
+ req := testutils.MakeReq(server.URL, "DELETE", endpoint, "")
+ req.Header.Set("Version", "0.1.1")
+ req.Header.Set("Origin", "chrome-extension://iaolnfnipkoinabdbbakcmkkdignedce")
+
+ // Execute
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var b1Record, b2Record, b3Record database.Book
+ var n1Record, n2Record, n3Record, n4Record, n5Record database.Note
+ var userRecord database.User
+ var bookCount, noteCount int
+
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), "counting books")
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), "counting notes")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b1.ID).First(&b1Record), "finding b1")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b2.ID).First(&b2Record), "finding b2")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b3.ID).First(&b3Record), "finding b3")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", n1.ID).First(&n1Record), "finding n1")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", n2.ID).First(&n2Record), "finding n2")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", n3.ID).First(&n3Record), "finding n3")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", n4.ID).First(&n4Record), "finding n4")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", n5.ID).First(&n5Record), "finding n5")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), "finding user record")
+
+ assert.Equal(t, bookCount, 3, "book count mismatch")
+ assert.Equal(t, noteCount, 5, "note count mismatch")
+
+ assert.Equal(t, userRecord.MaxUSN, tc.expectedMaxUSN, "user max_usn mismatch")
+
+ assert.Equal(t, b1Record.Deleted, false, "b1 deleted mismatch")
+ assert.Equal(t, b1Record.Label, b1.Label, "b1 content mismatch")
+ assert.Equal(t, b1Record.USN, b1.USN, "b1 usn mismatch")
+ assert.Equal(t, b2Record.Deleted, true, "b2 deleted mismatch")
+ assert.Equal(t, b2Record.Label, "", "b2 content mismatch")
+ assert.Equal(t, b2Record.USN, tc.expectedB2USN, "b2 usn mismatch")
+ assert.Equal(t, b3Record.Deleted, false, "b3 deleted mismatch")
+ assert.Equal(t, b3Record.Label, b3.Label, "b3 content mismatch")
+ assert.Equal(t, b3Record.USN, b3.USN, "b3 usn mismatch")
+
+ assert.Equal(t, n1Record.USN, n1.USN, "n1 usn mismatch")
+ assert.Equal(t, n1Record.Deleted, false, "n1 deleted mismatch")
+ assert.Equal(t, n1Record.Body, n1.Body, "n1 content mismatch")
+
+ assert.Equal(t, n2Record.USN, tc.expectedN2USN, "n2 usn mismatch")
+ assert.Equal(t, n2Record.Deleted, true, "n2 deleted mismatch")
+ assert.Equal(t, n2Record.Body, "", "n2 content mismatch")
+
+ assert.Equal(t, n3Record.USN, tc.expectedN3USN, "n3 usn mismatch")
+ assert.Equal(t, n3Record.Deleted, true, "n3 deleted mismatch")
+ assert.Equal(t, n3Record.Body, "", "n3 content mismatch")
+
+ // if already deleted, usn should remain the same and hence should not contribute to bumping the max_usn
+ assert.Equal(t, n4Record.USN, n4.USN, "n4 usn mismatch")
+ assert.Equal(t, n4Record.Deleted, true, "n4 deleted mismatch")
+ assert.Equal(t, n4Record.Body, "", "n4 content mismatch")
+
+ assert.Equal(t, n5Record.USN, n5.USN, "n5 usn mismatch")
+ assert.Equal(t, n5Record.Deleted, false, "n5 deleted mismatch")
+ assert.Equal(t, n5Record.Body, n5.Body, "n5 content mismatch")
+ })
+ }
+}
+
+func TestCreateBook(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", 101), "preparing user max_usn")
+
+ req := testutils.MakeReq(server.URL, "POST", "/v3/books", `{"name": "js"}`)
+ req.Header.Set("Version", "0.1.1")
+ req.Header.Set("Origin", "chrome-extension://iaolnfnipkoinabdbbakcmkkdignedce")
+
+ // Execute
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusCreated, "")
+
+ var bookRecord database.Book
+ var userRecord database.User
+ var bookCount, noteCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), "counting books")
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), "counting notes")
+ testutils.MustExec(t, testutils.DB.First(&bookRecord), "finding book")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), "finding user record")
+
+ maxUSN := 102
+
+ assert.Equalf(t, bookCount, 1, "book count mismatch")
+ assert.Equalf(t, noteCount, 0, "note count mismatch")
+
+ assert.NotEqual(t, bookRecord.UUID, "", "book uuid should have been generated")
+ assert.Equal(t, bookRecord.Label, "js", "book name mismatch")
+ assert.Equal(t, bookRecord.UserID, user.ID, "book user_id mismatch")
+ assert.Equal(t, bookRecord.USN, maxUSN, "book user_id mismatch")
+ assert.Equal(t, userRecord.MaxUSN, maxUSN, "user max_usn mismatch")
+
+ var got CreateBookResp
+ if err := json.NewDecoder(res.Body).Decode(&got); err != nil {
+ t.Fatal(errors.Wrap(err, "decoding got"))
+ }
+ expected := CreateBookResp{
+ Book: presenters.Book{
+ UUID: bookRecord.UUID,
+ USN: bookRecord.USN,
+ CreatedAt: bookRecord.CreatedAt,
+ UpdatedAt: bookRecord.UpdatedAt,
+ Label: "js",
+ },
+ }
+
+ assert.DeepEqual(t, got, expected, "payload mismatch")
+}
+
+func TestCreateBookDuplicate(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", 101), "preparing user max_usn")
+
+ b1 := database.Book{
+ UserID: user.ID,
+ Label: "js",
+ USN: 58,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing book data")
+
+ // Execute
+ req := testutils.MakeReq(server.URL, "POST", "/v3/books", `{"name": "js"}`)
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusConflict, "")
+
+ var bookRecord database.Book
+ var bookCount, noteCount int
+ var userRecord database.User
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), "counting books")
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), "counting notes")
+ testutils.MustExec(t, testutils.DB.First(&bookRecord), "finding book")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), "finding user record")
+
+ assert.Equalf(t, bookCount, 1, "book count mismatch")
+ assert.Equalf(t, noteCount, 0, "note count mismatch")
+
+ assert.Equal(t, bookRecord.Label, "js", "book name mismatch")
+ assert.Equal(t, bookRecord.UserID, user.ID, "book user_id mismatch")
+ assert.Equal(t, bookRecord.USN, b1.USN, "book usn mismatch")
+ assert.Equal(t, userRecord.MaxUSN, 101, "user max_usn mismatch")
+}
+
+func TestUpdateBook(t *testing.T) {
+ updatedLabel := "updated-label"
+
+ b1UUID := "ead8790f-aff9-4bdf-8eec-f734ccd29202"
+ b2UUID := "0ecaac96-8d72-4e04-8925-5a21b79a16da"
+
+ testCases := []struct {
+ payload string
+ bookUUID string
+ bookDeleted bool
+ bookLabel string
+ expectedBookLabel string
+ }{
+ {
+ payload: fmt.Sprintf(`{
+ "name": "%s"
+ }`, updatedLabel),
+ bookUUID: b1UUID,
+ bookDeleted: false,
+ bookLabel: "original-label",
+ expectedBookLabel: updatedLabel,
+ },
+ // if a deleted book is updated, it should be un-deleted
+ {
+ payload: fmt.Sprintf(`{
+ "name": "%s"
+ }`, updatedLabel),
+ bookUUID: b1UUID,
+ bookDeleted: true,
+ bookLabel: "",
+ expectedBookLabel: updatedLabel,
+ },
+ }
+
+ for idx, tc := range testCases {
+ func() {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", 101), "preparing user max_usn")
+
+ b1 := database.Book{
+ UUID: tc.bookUUID,
+ UserID: user.ID,
+ Label: tc.bookLabel,
+ Deleted: tc.bookDeleted,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+ b2 := database.Book{
+ UUID: b2UUID,
+ UserID: user.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b2), "preparing b2")
+
+ // Executdb,e
+ endpoint := fmt.Sprintf("/v3/books/%s", tc.bookUUID)
+ req := testutils.MakeReq(server.URL, "PATCH", endpoint, tc.payload)
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, fmt.Sprintf("status code mismatch for test case %d", idx))
+
+ var bookRecord database.Book
+ var userRecord database.User
+ var noteCount, bookCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), "counting books")
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), "counting notes")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b1.ID).First(&bookRecord), "finding book")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), "finding user record")
+
+ assert.Equalf(t, bookCount, 2, "book count mismatch")
+ assert.Equalf(t, noteCount, 0, "note count mismatch")
+
+ assert.Equalf(t, bookRecord.UUID, tc.bookUUID, "book uuid mismatch")
+ assert.Equalf(t, bookRecord.Label, tc.expectedBookLabel, "book label mismatch")
+ assert.Equalf(t, bookRecord.USN, 102, "book usn mismatch")
+ assert.Equalf(t, bookRecord.Deleted, false, "book Deleted mismatch")
+
+ assert.Equal(t, userRecord.MaxUSN, 102, fmt.Sprintf("user max_usn mismatch for test case %d", idx))
+ }()
+ }
+}
diff --git a/pkg/server/api/v3_notes.go b/pkg/server/api/v3_notes.go
new file mode 100644
index 00000000..b6e7c750
--- /dev/null
+++ b/pkg/server/api/v3_notes.go
@@ -0,0 +1,220 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/dnote/dnote/pkg/server/helpers"
+ "github.com/dnote/dnote/pkg/server/presenters"
+ "github.com/gorilla/mux"
+ "github.com/pkg/errors"
+)
+
+type updateNotePayload struct {
+ BookUUID *string `json:"book_uuid"`
+ Content *string `json:"content"`
+ Public *bool `json:"public"`
+}
+
+type updateNoteResp struct {
+ Status int `json:"status"`
+ Result presenters.Note `json:"result"`
+}
+
+func validateUpdateNotePayload(p updateNotePayload) bool {
+ return p.BookUUID != nil || p.Content != nil || p.Public != nil
+}
+
+// UpdateNote updates note
+func (a *API) UpdateNote(w http.ResponseWriter, r *http.Request) {
+ vars := mux.Vars(r)
+ noteUUID := vars["noteUUID"]
+
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var params updateNotePayload
+ err := json.NewDecoder(r.Body).Decode(¶ms)
+ if err != nil {
+ handlers.DoError(w, "decoding params", err, http.StatusInternalServerError)
+ return
+ }
+
+ if ok := validateUpdateNotePayload(params); !ok {
+ handlers.DoError(w, "Invalid payload", nil, http.StatusBadRequest)
+ return
+ }
+
+ var note database.Note
+ if err := a.App.DB.Where("uuid = ? AND user_id = ?", noteUUID, user.ID).First(¬e).Error; err != nil {
+ handlers.DoError(w, "finding note", err, http.StatusInternalServerError)
+ return
+ }
+
+ tx := a.App.DB.Begin()
+
+ note, err = a.App.UpdateNote(tx, user, note, &app.UpdateNoteParams{
+ BookUUID: params.BookUUID,
+ Content: params.Content,
+ Public: params.Public,
+ })
+ if err != nil {
+ tx.Rollback()
+ handlers.DoError(w, "updating note", err, http.StatusInternalServerError)
+ return
+ }
+
+ var book database.Book
+ if err := tx.Where("uuid = ? AND user_id = ?", note.BookUUID, user.ID).First(&book).Error; err != nil {
+ tx.Rollback()
+ handlers.DoError(w, fmt.Sprintf("finding book %s to preload", note.BookUUID), err, http.StatusInternalServerError)
+ return
+ }
+
+ tx.Commit()
+
+ // preload associations
+ note.User = user
+ note.Book = book
+
+ resp := updateNoteResp{
+ Status: http.StatusOK,
+ Result: presenters.PresentNote(note),
+ }
+ handlers.RespondJSON(w, http.StatusOK, resp)
+}
+
+type deleteNoteResp struct {
+ Status int `json:"status"`
+ Result presenters.Note `json:"result"`
+}
+
+// DeleteNote removes note
+func (a *API) DeleteNote(w http.ResponseWriter, r *http.Request) {
+ vars := mux.Vars(r)
+ noteUUID := vars["noteUUID"]
+
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var note database.Note
+ if err := a.App.DB.Where("uuid = ? AND user_id = ?", noteUUID, user.ID).Preload("Book").First(¬e).Error; err != nil {
+ handlers.DoError(w, "finding note", err, http.StatusInternalServerError)
+ return
+ }
+
+ tx := a.App.DB.Begin()
+
+ n, err := a.App.DeleteNote(tx, user, note)
+ if err != nil {
+ tx.Rollback()
+ handlers.DoError(w, "deleting note", err, http.StatusInternalServerError)
+ return
+ }
+
+ tx.Commit()
+
+ resp := deleteNoteResp{
+ Status: http.StatusNoContent,
+ Result: presenters.PresentNote(n),
+ }
+ handlers.RespondJSON(w, http.StatusOK, resp)
+}
+
+type createNotePayload struct {
+ BookUUID string `json:"book_uuid"`
+ Content string `json:"content"`
+ AddedOn *int64 `json:"added_on"`
+ EditedOn *int64 `json:"edited_on"`
+}
+
+func validateCreateNotePayload(p createNotePayload) error {
+ if p.BookUUID == "" {
+ return errors.New("bookUUID is required")
+ }
+
+ return nil
+}
+
+// CreateNoteResp is a response for creating a note
+type CreateNoteResp struct {
+ Result presenters.Note `json:"result"`
+}
+
+// CreateNote creates a note
+func (a *API) CreateNote(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+ return
+ }
+
+ var params createNotePayload
+ err := json.NewDecoder(r.Body).Decode(¶ms)
+ if err != nil {
+ handlers.DoError(w, "decoding payload", err, http.StatusInternalServerError)
+ return
+ }
+
+ err = validateCreateNotePayload(params)
+ if err != nil {
+ handlers.DoError(w, "validating payload", err, http.StatusBadRequest)
+ return
+ }
+
+ var book database.Book
+ if err := a.App.DB.Where("uuid = ? AND user_id = ?", params.BookUUID, user.ID).First(&book).Error; err != nil {
+ handlers.DoError(w, "finding book", err, http.StatusInternalServerError)
+ return
+ }
+
+ client := getClientType(r)
+ note, err := a.App.CreateNote(user, params.BookUUID, params.Content, params.AddedOn, params.EditedOn, false, client)
+ if err != nil {
+ handlers.DoError(w, "creating note", err, http.StatusInternalServerError)
+ return
+ }
+
+ // preload associations
+ note.User = user
+ note.Book = book
+
+ resp := CreateNoteResp{
+ Result: presenters.PresentNote(note),
+ }
+ handlers.RespondJSON(w, http.StatusCreated, resp)
+}
+
+// NotesOptions is a handler for OPTIONS endpoint for notes
+func (a *API) NotesOptions(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Access-Control-Allow-Methods", "POST")
+ w.Header().Set("Access-Control-Allow-Headers", "Authorization, Version")
+}
diff --git a/pkg/server/api/v3_notes_test.go b/pkg/server/api/v3_notes_test.go
new file mode 100644
index 00000000..3c57fe27
--- /dev/null
+++ b/pkg/server/api/v3_notes_test.go
@@ -0,0 +1,394 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package api
+
+import (
+ "fmt"
+ "net/http"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/testutils"
+)
+
+func TestCreateNote(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", 101), "preparing user max_usn")
+
+ b1 := database.Book{
+ UserID: user.ID,
+ Label: "js",
+ USN: 58,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+
+ // Execute
+ dat := fmt.Sprintf(`{"book_uuid": "%s", "content": "note content"}`, b1.UUID)
+ req := testutils.MakeReq(server.URL, "POST", "/v3/notes", dat)
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusCreated, "")
+
+ var noteRecord database.Note
+ var bookRecord database.Book
+ var userRecord database.User
+ var bookCount, noteCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), "counting books")
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), "counting notes")
+ testutils.MustExec(t, testutils.DB.First(¬eRecord), "finding note")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b1.ID).First(&bookRecord), "finding book")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), "finding user record")
+
+ assert.Equalf(t, bookCount, 1, "book count mismatch")
+ assert.Equalf(t, noteCount, 1, "note count mismatch")
+
+ assert.Equal(t, bookRecord.Label, b1.Label, "book name mismatch")
+ assert.Equal(t, bookRecord.UUID, b1.UUID, "book uuid mismatch")
+ assert.Equal(t, bookRecord.UserID, b1.UserID, "book user_id mismatch")
+ assert.Equal(t, bookRecord.USN, 58, "book usn mismatch")
+
+ assert.NotEqual(t, noteRecord.UUID, "", "note uuid should have been generated")
+ assert.Equal(t, noteRecord.BookUUID, b1.UUID, "note book_uuid mismatch")
+ assert.Equal(t, noteRecord.Body, "note content", "note content mismatch")
+ assert.Equal(t, noteRecord.USN, 102, "note usn mismatch")
+}
+
+func TestUpdateNote(t *testing.T) {
+ updatedBody := "some updated content"
+
+ b1UUID := "37868a8e-a844-4265-9a4f-0be598084733"
+ b2UUID := "8f3bd424-6aa5-4ed5-910d-e5b38ab09f8c"
+
+ testCases := []struct {
+ payload string
+ noteUUID string
+ noteBookUUID string
+ noteBody string
+ notePublic bool
+ noteDeleted bool
+ expectedNoteBody string
+ expectedNoteBookName string
+ expectedNoteBookUUID string
+ expectedNotePublic bool
+ }{
+ {
+ payload: fmt.Sprintf(`{
+ "content": "%s"
+ }`, updatedBody),
+ noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
+ noteBookUUID: b1UUID,
+ notePublic: false,
+ noteBody: "original content",
+ noteDeleted: false,
+ expectedNoteBookUUID: b1UUID,
+ expectedNoteBody: "some updated content",
+ expectedNoteBookName: "css",
+ expectedNotePublic: false,
+ },
+ {
+ payload: fmt.Sprintf(`{
+ "book_uuid": "%s"
+ }`, b1UUID),
+ noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
+ noteBookUUID: b1UUID,
+ notePublic: false,
+ noteBody: "original content",
+ noteDeleted: false,
+ expectedNoteBookUUID: b1UUID,
+ expectedNoteBody: "original content",
+ expectedNoteBookName: "css",
+ expectedNotePublic: false,
+ },
+ {
+ payload: fmt.Sprintf(`{
+ "book_uuid": "%s"
+ }`, b2UUID),
+ noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
+ noteBookUUID: b1UUID,
+ notePublic: false,
+ noteBody: "original content",
+ noteDeleted: false,
+ expectedNoteBookUUID: b2UUID,
+ expectedNoteBody: "original content",
+ expectedNoteBookName: "js",
+ expectedNotePublic: false,
+ },
+ {
+ payload: fmt.Sprintf(`{
+ "book_uuid": "%s",
+ "content": "%s"
+ }`, b2UUID, updatedBody),
+ noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
+ noteBookUUID: b1UUID,
+ notePublic: false,
+ noteBody: "original content",
+ noteDeleted: false,
+ expectedNoteBookUUID: b2UUID,
+ expectedNoteBody: "some updated content",
+ expectedNoteBookName: "js",
+ expectedNotePublic: false,
+ },
+ {
+ payload: fmt.Sprintf(`{
+ "book_uuid": "%s",
+ "content": "%s"
+ }`, b1UUID, updatedBody),
+ noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
+ noteBookUUID: b1UUID,
+ notePublic: false,
+ noteBody: "",
+ noteDeleted: true,
+ expectedNoteBookUUID: b1UUID,
+ expectedNoteBody: updatedBody,
+ expectedNoteBookName: "js",
+ expectedNotePublic: false,
+ },
+ {
+ payload: fmt.Sprintf(`{
+ "public": %t
+ }`, true),
+ noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
+ noteBookUUID: b1UUID,
+ notePublic: false,
+ noteBody: "original content",
+ noteDeleted: false,
+ expectedNoteBookUUID: b1UUID,
+ expectedNoteBody: "original content",
+ expectedNoteBookName: "css",
+ expectedNotePublic: true,
+ },
+ {
+ payload: fmt.Sprintf(`{
+ "public": %t
+ }`, false),
+ noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
+ noteBookUUID: b1UUID,
+ notePublic: true,
+ noteBody: "original content",
+ noteDeleted: false,
+ expectedNoteBookUUID: b1UUID,
+ expectedNoteBody: "original content",
+ expectedNoteBookName: "css",
+ expectedNotePublic: false,
+ },
+ {
+ payload: fmt.Sprintf(`{
+ "content": "%s",
+ "public": %t
+ }`, updatedBody, false),
+ noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
+ noteBookUUID: b1UUID,
+ notePublic: true,
+ noteBody: "original content",
+ noteDeleted: false,
+ expectedNoteBookUUID: b1UUID,
+ expectedNoteBody: updatedBody,
+ expectedNoteBookName: "css",
+ expectedNotePublic: false,
+ },
+ {
+ payload: fmt.Sprintf(`{
+ "book_uuid": "%s",
+ "content": "%s",
+ "public": %t
+ }`, b2UUID, updatedBody, true),
+ noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
+ noteBookUUID: b1UUID,
+ notePublic: false,
+ noteBody: "original content",
+ noteDeleted: false,
+ expectedNoteBookUUID: b2UUID,
+ expectedNoteBody: updatedBody,
+ expectedNoteBookName: "js",
+ expectedNotePublic: true,
+ },
+ }
+
+ for idx, tc := range testCases {
+ t.Run(fmt.Sprintf("test case %d", idx), func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", 101), "preparing user max_usn")
+
+ b1 := database.Book{
+ UUID: b1UUID,
+ UserID: user.ID,
+ Label: "css",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+ b2 := database.Book{
+ UUID: b2UUID,
+ UserID: user.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b2), "preparing b2")
+
+ note := database.Note{
+ UserID: user.ID,
+ UUID: tc.noteUUID,
+ BookUUID: tc.noteBookUUID,
+ Body: tc.noteBody,
+ Deleted: tc.noteDeleted,
+ Public: tc.notePublic,
+ }
+ testutils.MustExec(t, testutils.DB.Save(¬e), "preparing note")
+
+ // Execute
+ endpoint := fmt.Sprintf("/v3/notes/%s", note.UUID)
+ req := testutils.MakeReq(server.URL, "PATCH", endpoint, tc.payload)
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "status code mismatch for test case")
+
+ var bookRecord database.Book
+ var noteRecord database.Note
+ var userRecord database.User
+ var noteCount, bookCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), "counting books")
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), "counting notes")
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", note.UUID).First(¬eRecord), "finding note")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b1.ID).First(&bookRecord), "finding book")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), "finding user record")
+
+ assert.Equalf(t, bookCount, 2, "book count mismatch")
+ assert.Equalf(t, noteCount, 1, "note count mismatch")
+
+ assert.Equal(t, noteRecord.UUID, tc.noteUUID, "note uuid mismatch for test case")
+ assert.Equal(t, noteRecord.Body, tc.expectedNoteBody, "note content mismatch for test case")
+ assert.Equal(t, noteRecord.BookUUID, tc.expectedNoteBookUUID, "note book_uuid mismatch for test case")
+ assert.Equal(t, noteRecord.Public, tc.expectedNotePublic, "note public mismatch for test case")
+ assert.Equal(t, noteRecord.USN, 102, "note usn mismatch for test case")
+
+ assert.Equal(t, userRecord.MaxUSN, 102, "user max_usn mismatch for test case")
+ })
+ }
+}
+
+func TestDeleteNote(t *testing.T) {
+ b1UUID := "37868a8e-a844-4265-9a4f-0be598084733"
+
+ testCases := []struct {
+ content string
+ deleted bool
+ originalUSN int
+ expectedUSN int
+ expectedMaxUSN int
+ }{
+ {
+ content: "n1 content",
+ deleted: false,
+ originalUSN: 12,
+ expectedUSN: 982,
+ expectedMaxUSN: 982,
+ },
+ {
+ content: "",
+ deleted: true,
+ originalUSN: 12,
+ expectedUSN: 982,
+ expectedMaxUSN: 982,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("originally deleted %t", tc.deleted), func(t *testing.T) {
+
+ defer testutils.ClearData(testutils.DB)
+
+ // Setup
+ server := MustNewServer(t, &app.App{
+
+ Clock: clock.NewMock(),
+ })
+ defer server.Close()
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", 981), "preparing user max_usn")
+
+ b1 := database.Book{
+ UUID: b1UUID,
+ UserID: user.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+ note := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: tc.content,
+ Deleted: tc.deleted,
+ USN: tc.originalUSN,
+ }
+ testutils.MustExec(t, testutils.DB.Save(¬e), "preparing note")
+
+ // Execute
+ endpoint := fmt.Sprintf("/v3/notes/%s", note.UUID)
+ req := testutils.MakeReq(server.URL, "DELETE", endpoint, "")
+ res := testutils.HTTPAuthDo(t, req, user)
+
+ // Test
+ assert.StatusCodeEquals(t, res, http.StatusOK, "")
+
+ var bookRecord database.Book
+ var noteRecord database.Note
+ var userRecord database.User
+ var bookCount, noteCount int
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), "counting books")
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), "counting notes")
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", note.UUID).First(¬eRecord), "finding note")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", b1.ID).First(&bookRecord), "finding book")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), "finding user record")
+
+ assert.Equalf(t, bookCount, 1, "book count mismatch")
+ assert.Equalf(t, noteCount, 1, "note count mismatch")
+
+ assert.Equal(t, noteRecord.UUID, note.UUID, "note uuid mismatch for test case")
+ assert.Equal(t, noteRecord.Body, "", "note content mismatch for test case")
+ assert.Equal(t, noteRecord.Deleted, true, "note deleted mismatch for test case")
+ assert.Equal(t, noteRecord.BookUUID, note.BookUUID, "note book_uuid mismatch for test case")
+ assert.Equal(t, noteRecord.UserID, note.UserID, "note user_id mismatch for test case")
+ assert.Equal(t, noteRecord.USN, tc.expectedUSN, "note usn mismatch for test case")
+
+ assert.Equal(t, userRecord.MaxUSN, tc.expectedMaxUSN, "user max_usn mismatch for test case")
+ })
+ }
+}
diff --git a/pkg/server/controllers/sync.go b/pkg/server/api/v3_sync.go
similarity index 75%
rename from pkg/server/controllers/sync.go
rename to pkg/server/api/v3_sync.go
index 7cda4316..a04f41fa 100644
--- a/pkg/server/controllers/sync.go
+++ b/pkg/server/api/v3_sync.go
@@ -1,19 +1,22 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
-package controllers
+package api
import (
"fmt"
@@ -23,27 +26,13 @@ import (
"strconv"
"time"
- "github.com/dnote/dnote/pkg/server/context"
"github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/dnote/dnote/pkg/server/helpers"
"github.com/dnote/dnote/pkg/server/log"
- "github.com/dnote/dnote/pkg/server/middleware"
"github.com/pkg/errors"
-
- "github.com/dnote/dnote/pkg/server/app"
)
-// NewSync creates a new Sync controller
-func NewSync(app *app.App) *Sync {
- return &Sync{
- app: app,
- }
-}
-
-// Sync is a sync controller.
-type Sync struct {
- app *app.App
-}
-
// fullSyncBefore is the system-wide timestamp that represents the point in time
// before which clients must perform a full-sync rather than incremental sync.
const fullSyncBefore = 0
@@ -72,6 +61,7 @@ type SyncFragNote struct {
AddedOn int64 `json:"added_on"`
EditedOn int64 `json:"edited_on"`
Body string `json:"content"`
+ Public bool `json:"public"`
Deleted bool `json:"deleted"`
}
@@ -85,6 +75,7 @@ func NewFragNote(note database.Note) SyncFragNote {
AddedOn: note.AddedOn,
EditedOn: note.EditedOn,
Body: note.Body,
+ Public: note.Public,
Deleted: note.Deleted,
BookUUID: note.BookUUID,
}
@@ -130,13 +121,13 @@ func (e *queryParamError) Error() string {
return fmt.Sprintf("invalid query param %s=%s. %s", e.key, e.value, e.message)
}
-func (s *Sync) newFragment(userID, userMaxUSN, afterUSN, limit int) (SyncFragment, error) {
+func (a *API) newFragment(userID, userMaxUSN, afterUSN, limit int) (SyncFragment, error) {
var notes []database.Note
- if err := s.app.DB.Where("user_id = ? AND usn > ? AND usn <= ?", userID, afterUSN, userMaxUSN).Order("usn ASC").Limit(limit).Find(¬es).Error; err != nil {
+ if err := a.App.DB.Where("user_id = ? AND usn > ? AND usn <= ?", userID, afterUSN, userMaxUSN).Order("usn ASC").Limit(limit).Find(¬es).Error; err != nil {
return SyncFragment{}, nil
}
var books []database.Book
- if err := s.app.DB.Where("user_id = ? AND usn > ? AND usn <= ?", userID, afterUSN, userMaxUSN).Order("usn ASC").Limit(limit).Find(&books).Error; err != nil {
+ if err := a.App.DB.Where("user_id = ? AND usn > ? AND usn <= ?", userID, afterUSN, userMaxUSN).Order("usn ASC").Limit(limit).Find(&books).Error; err != nil {
return SyncFragment{}, nil
}
@@ -201,7 +192,7 @@ func (s *Sync) newFragment(userID, userMaxUSN, afterUSN, limit int) (SyncFragmen
ret := SyncFragment{
FragMaxUSN: fragMaxUSN,
UserMaxUSN: userMaxUSN,
- CurrentTime: s.app.Clock.Now().Unix(),
+ CurrentTime: a.App.Clock.Now().Unix(),
Notes: fragNotes,
Books: fragBooks,
ExpungedNotes: fragExpungedNotes,
@@ -257,29 +248,29 @@ type GetSyncFragmentResp struct {
}
// GetSyncFragment responds with a sync fragment
-func (s *Sync) GetSyncFragment(w http.ResponseWriter, r *http.Request) {
- user := context.User(r.Context())
- if user == nil {
- middleware.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+func (a *API) GetSyncFragment(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
return
}
afterUSN, limit, err := parseGetSyncFragmentQuery(r.URL.Query())
if err != nil {
- middleware.DoError(w, "parsing query params", err, http.StatusInternalServerError)
+ handlers.DoError(w, "parsing query params", err, http.StatusInternalServerError)
return
}
- fragment, err := s.newFragment(user.ID, user.MaxUSN, afterUSN, limit)
+ fragment, err := a.newFragment(user.ID, user.MaxUSN, afterUSN, limit)
if err != nil {
- middleware.DoError(w, "getting fragment", err, http.StatusInternalServerError)
+ handlers.DoError(w, "getting fragment", err, http.StatusInternalServerError)
return
}
response := GetSyncFragmentResp{
Fragment: fragment,
}
- respondJSON(w, http.StatusOK, response)
+ handlers.RespondJSON(w, http.StatusOK, response)
}
// GetSyncStateResp represents a response from GetSyncFragment handler
@@ -290,18 +281,18 @@ type GetSyncStateResp struct {
}
// GetSyncState responds with a sync fragment
-func (s *Sync) GetSyncState(w http.ResponseWriter, r *http.Request) {
- user := context.User(r.Context())
- if user == nil {
- middleware.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
+func (a *API) GetSyncState(w http.ResponseWriter, r *http.Request) {
+ user, ok := r.Context().Value(helpers.KeyUser).(database.User)
+ if !ok {
+ handlers.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError)
return
}
response := GetSyncStateResp{
- FullSyncBefore: int(user.FullSyncBefore),
+ FullSyncBefore: fullSyncBefore,
MaxUSN: user.MaxUSN,
// TODO: exposing server time means we probably shouldn't seed random generator with time?
- CurrentTime: s.app.Clock.Now().Unix(),
+ CurrentTime: a.App.Clock.Now().Unix(),
}
log.WithFields(log.Fields{
@@ -309,5 +300,5 @@ func (s *Sync) GetSyncState(w http.ResponseWriter, r *http.Request) {
"resp": response,
}).Info("getting sync state")
- respondJSON(w, http.StatusOK, response)
+ handlers.RespondJSON(w, http.StatusOK, response)
}
diff --git a/pkg/server/controllers/sync_test.go b/pkg/server/api/v3_sync_test.go
similarity index 66%
rename from pkg/server/controllers/sync_test.go
rename to pkg/server/api/v3_sync_test.go
index e97ecb50..2da52aac 100644
--- a/pkg/server/controllers/sync_test.go
+++ b/pkg/server/api/v3_sync_test.go
@@ -1,19 +1,22 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
-package controllers
+package api
import (
"fmt"
diff --git a/pkg/server/app/app.go b/pkg/server/app/app.go
index cfaaf319..8f1b50f8 100644
--- a/pkg/server/app/app.go
+++ b/pkg/server/app/app.go
@@ -1,24 +1,28 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
import (
"github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/config"
"github.com/dnote/dnote/pkg/server/mailer"
- "gorm.io/gorm"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
)
@@ -27,45 +31,40 @@ var (
ErrEmptyDB = errors.New("No database connection was provided")
// ErrEmptyClock is an error for missing clock in the app configuration
ErrEmptyClock = errors.New("No clock was provided")
- // ErrEmptyBaseURL is an error for missing BaseURL content in the app configuration
- ErrEmptyBaseURL = errors.New("No BaseURL was provided")
+ // ErrEmptyWebURL is an error for missing WebURL content in the app configuration
+ ErrEmptyWebURL = errors.New("No WebURL was provided")
+ // ErrEmptyEmailTemplates is an error for missing EmailTemplates content in the app configuration
+ ErrEmptyEmailTemplates = errors.New("No EmailTemplate store was provided")
// ErrEmptyEmailBackend is an error for missing EmailBackend content in the app configuration
ErrEmptyEmailBackend = errors.New("No EmailBackend was provided")
- // ErrEmptyHTTP500Page is an error for missing HTTP 500 page content
- ErrEmptyHTTP500Page = errors.New("No HTTP 500 error page was set")
)
// App is an application context
type App struct {
- DB *gorm.DB
- Clock clock.Clock
- EmailBackend mailer.Backend
- Files map[string][]byte
- HTTP500Page []byte
- BaseURL string
- DisableRegistration bool
- Port string
- DBPath string
- AssetBaseURL string
+ DB *gorm.DB
+ Clock clock.Clock
+ EmailTemplates mailer.Templates
+ EmailBackend mailer.Backend
+ Config config.Config
}
// Validate validates the app configuration
func (a *App) Validate() error {
- if a.BaseURL == "" {
- return ErrEmptyBaseURL
+ if a.Config.WebURL == "" {
+ return ErrEmptyWebURL
}
if a.Clock == nil {
return ErrEmptyClock
}
+ if a.EmailTemplates == nil {
+ return ErrEmptyEmailTemplates
+ }
if a.EmailBackend == nil {
return ErrEmptyEmailBackend
}
if a.DB == nil {
return ErrEmptyDB
}
- if a.HTTP500Page == nil {
- return ErrEmptyHTTP500Page
- }
return nil
}
diff --git a/pkg/server/app/books.go b/pkg/server/app/books.go
index f222b816..2fa0a9b1 100644
--- a/pkg/server/app/books.go
+++ b/pkg/server/app/books.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
@@ -18,7 +21,7 @@ package app
import (
"github.com/dnote/dnote/pkg/server/database"
"github.com/dnote/dnote/pkg/server/helpers"
- "gorm.io/gorm"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
)
@@ -34,16 +37,16 @@ func (a *App) CreateBook(user database.User, name string) (database.Book, error)
uuid, err := helpers.GenUUID()
if err != nil {
- tx.Rollback()
return database.Book{}, err
}
book := database.Book{
- UUID: uuid,
- UserID: user.ID,
- Label: name,
- AddedOn: a.Clock.Now().UnixNano(),
- USN: nextUSN,
+ UUID: uuid,
+ UserID: user.ID,
+ Label: name,
+ AddedOn: a.Clock.Now().UnixNano(),
+ USN: nextUSN,
+ Encrypted: false,
}
if err := tx.Create(&book).Error; err != nil {
tx.Rollback()
@@ -67,7 +70,7 @@ func (a *App) DeleteBook(tx *gorm.DB, user database.User, book database.Book) (d
}
if err := tx.Model(&book).
- Updates(map[string]interface{}{
+ Update(map[string]interface{}{
"usn": nextUSN,
"deleted": true,
"label": "",
@@ -96,6 +99,8 @@ func (a *App) UpdateBook(tx *gorm.DB, user database.User, book database.Book, la
book.USN = nextUSN
book.EditedOn = a.Clock.Now().UnixNano()
book.Deleted = false
+ // TODO: remove after all users have been migrated
+ book.Encrypted = false
if err := tx.Save(&book).Error; err != nil {
return book, errors.Wrap(err, "updating the book")
diff --git a/pkg/server/app/books_test.go b/pkg/server/app/books_test.go
index 8953c613..17c2ddcb 100644
--- a/pkg/server/app/books_test.go
+++ b/pkg/server/app/books_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
@@ -51,38 +54,38 @@ func TestCreateBook(t *testing.T) {
for idx, tc := range testCases {
func() {
- db := testutils.InitMemoryDB(t)
+ defer testutils.ClearData(testutils.DB)
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
- anotherUser := testutils.SetupUserData(db, "another@test.com", "password123")
- testutils.MustExec(t, db.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ anotherUser := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
- a := NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
+ a := NewTest(&App{
+ Clock: clock.NewMock(),
+ })
book, err := a.CreateBook(user, tc.label)
if err != nil {
t.Fatal(errors.Wrap(err, "creating book"))
}
- var bookCount int64
+ var bookCount int
var bookRecord database.Book
var userRecord database.User
- if err := db.Model(&database.Book{}).Count(&bookCount).Error; err != nil {
+ if err := testutils.DB.Model(&database.Book{}).Count(&bookCount).Error; err != nil {
t.Fatal(errors.Wrap(err, "counting books"))
}
- if err := db.First(&bookRecord).Error; err != nil {
+ if err := testutils.DB.First(&bookRecord).Error; err != nil {
t.Fatal(errors.Wrap(err, "finding book"))
}
- if err := db.Where("id = ?", user.ID).First(&userRecord).Error; err != nil {
+ if err := testutils.DB.Where("id = ?", user.ID).First(&userRecord).Error; err != nil {
t.Fatal(errors.Wrap(err, "finding user"))
}
- assert.Equal(t, bookCount, int64(1), "book count mismatch")
+ assert.Equal(t, bookCount, 1, "book count mismatch")
assert.Equal(t, bookRecord.UserID, user.ID, "book user_id mismatch")
assert.Equal(t, bookRecord.Label, tc.label, "book label mismatch")
assert.Equal(t, bookRecord.USN, tc.expectedUSN, "book label mismatch")
@@ -117,20 +120,19 @@ func TestDeleteBook(t *testing.T) {
for idx, tc := range testCases {
func() {
- db := testutils.InitMemoryDB(t)
+ defer testutils.ClearData(testutils.DB)
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
- anotherUser := testutils.SetupUserData(db, "another@test.com", "password123")
- testutils.MustExec(t, db.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ anotherUser := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
book := database.Book{UserID: user.ID, Label: "js", Deleted: false}
- testutils.MustExec(t, db.Save(&book), fmt.Sprintf("preparing book for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Save(&book), fmt.Sprintf("preparing book for test case %d", idx))
- tx := db.Begin()
- a := NewTest()
- a.DB = db
+ tx := testutils.DB.Begin()
+ a := NewTest(nil)
ret, err := a.DeleteBook(tx, user, book)
if err != nil {
tx.Rollback()
@@ -138,15 +140,15 @@ func TestDeleteBook(t *testing.T) {
}
tx.Commit()
- var bookCount int64
+ var bookCount int
var bookRecord database.Book
var userRecord database.User
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), fmt.Sprintf("counting books for test case %d", idx))
- testutils.MustExec(t, db.First(&bookRecord), fmt.Sprintf("finding book for test case %d", idx))
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), fmt.Sprintf("counting books for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.First(&bookRecord), fmt.Sprintf("finding book for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
- assert.Equal(t, bookCount, int64(1), "book count mismatch")
+ assert.Equal(t, bookCount, 1, "book count mismatch")
assert.Equal(t, bookRecord.UserID, user.ID, "book user_id mismatch")
assert.Equal(t, bookRecord.Label, "", "book label mismatch")
assert.Equal(t, bookRecord.Deleted, true, "book deleted flag mismatch")
@@ -196,23 +198,23 @@ func TestUpdateBook(t *testing.T) {
for idx, tc := range testCases {
func() {
- db := testutils.InitMemoryDB(t)
+ defer testutils.ClearData(testutils.DB)
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
- anotherUser := testutils.SetupUserData(db, "another@test.com", "password123")
- testutils.MustExec(t, db.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ anotherUser := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
b := database.Book{UserID: user.ID, Deleted: false, Label: tc.expectedLabel}
- testutils.MustExec(t, db.Save(&b), fmt.Sprintf("preparing book for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Save(&b), fmt.Sprintf("preparing book for test case %d", idx))
c := clock.NewMock()
- a := NewTest()
- a.DB = db
- a.Clock = c
+ a := NewTest(&App{
+ Clock: c,
+ })
- tx := db.Begin()
+ tx := testutils.DB.Begin()
book, err := a.UpdateBook(tx, user, b, tc.payloadLabel)
if err != nil {
tx.Rollback()
@@ -221,14 +223,14 @@ func TestUpdateBook(t *testing.T) {
tx.Commit()
- var bookCount int64
+ var bookCount int
var bookRecord database.Book
var userRecord database.User
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), fmt.Sprintf("counting books for test case %d", idx))
- testutils.MustExec(t, db.First(&bookRecord), fmt.Sprintf("finding book for test case %d", idx))
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), fmt.Sprintf("counting books for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.First(&bookRecord), fmt.Sprintf("finding book for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
- assert.Equal(t, bookCount, int64(1), "book count mismatch")
+ assert.Equal(t, bookCount, 1, "book count mismatch")
assert.Equal(t, bookRecord.UserID, user.ID, "book user_id mismatch")
assert.Equal(t, bookRecord.Label, tc.expectedLabel, "book label mismatch")
diff --git a/pkg/server/app/doc.go b/pkg/server/app/doc.go
index 2a3f3695..b1e3a101 100644
--- a/pkg/server/app/doc.go
+++ b/pkg/server/app/doc.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
/*
diff --git a/pkg/server/app/email.go b/pkg/server/app/email.go
index fc86cda9..41bd8287 100644
--- a/pkg/server/app/email.go
+++ b/pkg/server/app/email.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
@@ -20,15 +23,20 @@ import (
"net/url"
"strings"
+ "github.com/dnote/dnote/pkg/server/config"
"github.com/dnote/dnote/pkg/server/mailer"
"github.com/pkg/errors"
)
-var defaultSender = "admin@getdnote.com"
+var defaultSender = "sung@getdnote.com"
// GetSenderEmail returns the sender email
-func GetSenderEmail(baseURL, want string) (string, error) {
- addr, err := getNoreplySender(baseURL)
+func GetSenderEmail(c config.Config, want string) (string, error) {
+ if !c.OnPremise {
+ return want, nil
+ }
+
+ addr, err := getNoreplySender(c)
if err != nil {
return "", errors.Wrap(err, "getting sender email address")
}
@@ -52,30 +60,55 @@ func getDomainFromURL(rawURL string) (string, error) {
return domain, nil
}
-func getNoreplySender(baseURL string) (string, error) {
- domain, err := getDomainFromURL(baseURL)
+func getNoreplySender(c config.Config) (string, error) {
+ domain, err := getDomainFromURL(c.WebURL)
if err != nil {
- return "", errors.Wrap(err, "parsing base url")
+ return "", errors.Wrap(err, "parsing web url")
}
addr := fmt.Sprintf("noreply@%s", domain)
return addr, nil
}
-// SendWelcomeEmail sends welcome email
-func (a *App) SendWelcomeEmail(email string) error {
- from, err := GetSenderEmail(a.BaseURL, defaultSender)
+// SendVerificationEmail sends verification email
+func (a *App) SendVerificationEmail(email, tokenValue string) error {
+ body, err := a.EmailTemplates.Execute(mailer.EmailTypeEmailVerification, mailer.EmailKindText, mailer.EmailVerificationTmplData{
+ Token: tokenValue,
+ WebURL: a.Config.WebURL,
+ })
+ if err != nil {
+ return errors.Wrapf(err, "executing reset verification template for %s", email)
+ }
+
+ from, err := GetSenderEmail(a.Config, defaultSender)
if err != nil {
return errors.Wrap(err, "getting the sender email")
}
- data := mailer.WelcomeTmplData{
- AccountEmail: email,
- BaseURL: a.BaseURL,
+ if err := a.EmailBackend.Queue("Verify your Dnote email address", from, []string{email}, mailer.EmailKindText, body); err != nil {
+ return errors.Wrapf(err, "queueing email for %s", email)
}
- if err := a.EmailBackend.SendEmail(mailer.EmailTypeWelcome, from, []string{email}, data); err != nil {
- return errors.Wrapf(err, "sending welcome email for %s", email)
+ return nil
+}
+
+// SendWelcomeEmail sends welcome email
+func (a *App) SendWelcomeEmail(email string) error {
+ body, err := a.EmailTemplates.Execute(mailer.EmailTypeWelcome, mailer.EmailKindText, mailer.WelcomeTmplData{
+ AccountEmail: email,
+ WebURL: a.Config.WebURL,
+ })
+ if err != nil {
+ return errors.Wrapf(err, "executing reset verification template for %s", email)
+ }
+
+ from, err := GetSenderEmail(a.Config, defaultSender)
+ if err != nil {
+ return errors.Wrap(err, "getting the sender email")
+ }
+
+ if err := a.EmailBackend.Queue("Welcome to Dnote!", from, []string{email}, mailer.EmailKindText, body); err != nil {
+ return errors.Wrapf(err, "queueing email for %s", email)
}
return nil
@@ -83,27 +116,22 @@ func (a *App) SendWelcomeEmail(email string) error {
// SendPasswordResetEmail sends password reset email
func (a *App) SendPasswordResetEmail(email, tokenValue string) error {
- if email == "" {
- return ErrEmailRequired
+ body, err := a.EmailTemplates.Execute(mailer.EmailTypeResetPassword, mailer.EmailKindText, mailer.EmailResetPasswordTmplData{
+ AccountEmail: email,
+ Token: tokenValue,
+ WebURL: a.Config.WebURL,
+ })
+ if err != nil {
+ return errors.Wrapf(err, "executing reset password template for %s", email)
}
- from, err := GetSenderEmail(a.BaseURL, defaultSender)
+ from, err := GetSenderEmail(a.Config, defaultSender)
if err != nil {
return errors.Wrap(err, "getting the sender email")
}
- data := mailer.EmailResetPasswordTmplData{
- AccountEmail: email,
- Token: tokenValue,
- BaseURL: a.BaseURL,
- }
-
- if err := a.EmailBackend.SendEmail(mailer.EmailTypeResetPassword, from, []string{email}, data); err != nil {
- if errors.Cause(err) == mailer.ErrSMTPNotConfigured {
- return ErrInvalidSMTPConfig
- }
-
- return errors.Wrapf(err, "sending password reset email for %s", email)
+ if err := a.EmailBackend.Queue("Reset your password", from, []string{email}, mailer.EmailKindText, body); err != nil {
+ return errors.Wrapf(err, "queueing email for %s", email)
}
return nil
@@ -111,18 +139,43 @@ func (a *App) SendPasswordResetEmail(email, tokenValue string) error {
// SendPasswordResetAlertEmail sends email that notifies users of a password change
func (a *App) SendPasswordResetAlertEmail(email string) error {
- from, err := GetSenderEmail(a.BaseURL, defaultSender)
+ body, err := a.EmailTemplates.Execute(mailer.EmailTypeResetPasswordAlert, mailer.EmailKindText, mailer.EmailResetPasswordAlertTmplData{
+ AccountEmail: email,
+ WebURL: a.Config.WebURL,
+ })
+ if err != nil {
+ return errors.Wrapf(err, "executing reset password alert template for %s", email)
+ }
+
+ from, err := GetSenderEmail(a.Config, defaultSender)
if err != nil {
return errors.Wrap(err, "getting the sender email")
}
- data := mailer.EmailResetPasswordAlertTmplData{
- AccountEmail: email,
- BaseURL: a.BaseURL,
- }
-
- if err := a.EmailBackend.SendEmail(mailer.EmailTypeResetPasswordAlert, from, []string{email}, data); err != nil {
- return errors.Wrapf(err, "sending password reset alert email for %s", email)
+ if err := a.EmailBackend.Queue("Dnote password changed", from, []string{email}, mailer.EmailKindText, body); err != nil {
+ return errors.Wrapf(err, "queueing email for %s", email)
+ }
+
+ return nil
+}
+
+// SendSubscriptionConfirmationEmail sends email that confirms subscription purchase
+func (a *App) SendSubscriptionConfirmationEmail(email string) error {
+ body, err := a.EmailTemplates.Execute(mailer.EmailTypeSubscriptionConfirmation, mailer.EmailKindText, mailer.EmailTypeSubscriptionConfirmationTmplData{
+ AccountEmail: email,
+ WebURL: a.Config.WebURL,
+ })
+ if err != nil {
+ return errors.Wrapf(err, "executing subscription confirmation template for %s", email)
+ }
+
+ from, err := GetSenderEmail(a.Config, defaultSender)
+ if err != nil {
+ return errors.Wrap(err, "getting the sender email")
+ }
+
+ if err := a.EmailBackend.Queue("Welcome to Dnote Pro", from, []string{email}, mailer.EmailKindText, body); err != nil {
+ return errors.Wrapf(err, "queueing email for %s", email)
}
return nil
diff --git a/pkg/server/app/email_test.go b/pkg/server/app/email_test.go
index e0a73aef..856beeda 100644
--- a/pkg/server/app/email_test.go
+++ b/pkg/server/app/email_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
@@ -20,58 +23,177 @@ import (
"testing"
"github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/server/config"
"github.com/dnote/dnote/pkg/server/testutils"
)
-func TestSendWelcomeEmail(t *testing.T) {
- emailBackend := testutils.MockEmailbackendImplementation{}
- a := NewTest()
- a.EmailBackend = &emailBackend
- a.BaseURL = "http://example.com"
-
- if err := a.SendWelcomeEmail("alice@example.com"); err != nil {
- t.Fatal(err, "failed to perform")
- }
-
- assert.Equalf(t, len(emailBackend.Emails), 1, "email queue count mismatch")
- assert.Equal(t, emailBackend.Emails[0].From, "noreply@example.com", "email sender mismatch")
- assert.DeepEqual(t, emailBackend.Emails[0].To, []string{"alice@example.com"}, "email sender mismatch")
-
-}
-
-func TestSendPasswordResetEmail(t *testing.T) {
- emailBackend := testutils.MockEmailbackendImplementation{}
- a := NewTest()
- a.EmailBackend = &emailBackend
- a.BaseURL = "http://example.com"
-
- if err := a.SendPasswordResetEmail("alice@example.com", "mockTokenValue"); err != nil {
- t.Fatal(err, "failed to perform")
- }
-
- assert.Equalf(t, len(emailBackend.Emails), 1, "email queue count mismatch")
- assert.Equal(t, emailBackend.Emails[0].From, "noreply@example.com", "email sender mismatch")
- assert.DeepEqual(t, emailBackend.Emails[0].To, []string{"alice@example.com"}, "email sender mismatch")
-
-}
-
-func TestGetSenderEmail(t *testing.T) {
+func TestSendVerificationEmail(t *testing.T) {
testCases := []struct {
- baseURL string
+ onPremise bool
expectedSender string
}{
{
- baseURL: "https://www.example.com",
- expectedSender: "noreply@example.com",
+ onPremise: false,
+ expectedSender: "sung@getdnote.com",
},
{
- baseURL: "https://www.example2.com",
- expectedSender: "alice@example2.com",
+ onPremise: true,
+ expectedSender: "noreply@example.com",
},
}
for _, tc := range testCases {
- t.Run(fmt.Sprintf("base url %s", tc.baseURL), func(t *testing.T) {
+ t.Run(fmt.Sprintf("self hosted %t", tc.onPremise), func(t *testing.T) {
+ c := config.Load()
+ c.SetOnPremise(tc.onPremise)
+ c.WebURL = "http://example.com"
+
+ emailBackend := testutils.MockEmailbackendImplementation{}
+ a := NewTest(&App{
+ EmailBackend: &emailBackend,
+ Config: c,
+ })
+
+ if err := a.SendVerificationEmail("alice@example.com", "mockTokenValue"); err != nil {
+ t.Fatal(err, "failed to perform")
+ }
+
+ assert.Equalf(t, len(emailBackend.Emails), 1, "email queue count mismatch")
+ assert.Equal(t, emailBackend.Emails[0].From, tc.expectedSender, "email sender mismatch")
+ assert.DeepEqual(t, emailBackend.Emails[0].To, []string{"alice@example.com"}, "email sender mismatch")
+ })
+ }
+}
+
+func TestSendWelcomeEmail(t *testing.T) {
+ testCases := []struct {
+ onPremise bool
+ expectedSender string
+ }{
+ {
+ onPremise: false,
+ expectedSender: "sung@getdnote.com",
+ },
+ {
+ onPremise: true,
+ expectedSender: "noreply@example.com",
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("self hosted %t", tc.onPremise), func(t *testing.T) {
+ c := config.Load()
+ c.SetOnPremise(tc.onPremise)
+ c.WebURL = "http://example.com"
+
+ emailBackend := testutils.MockEmailbackendImplementation{}
+ a := NewTest(&App{
+ EmailBackend: &emailBackend,
+ Config: c,
+ })
+
+ if err := a.SendWelcomeEmail("alice@example.com"); err != nil {
+ t.Fatal(err, "failed to perform")
+ }
+
+ assert.Equalf(t, len(emailBackend.Emails), 1, "email queue count mismatch")
+ assert.Equal(t, emailBackend.Emails[0].From, tc.expectedSender, "email sender mismatch")
+ assert.DeepEqual(t, emailBackend.Emails[0].To, []string{"alice@example.com"}, "email sender mismatch")
+ })
+ }
+}
+
+func TestSendPasswordResetEmail(t *testing.T) {
+ testCases := []struct {
+ onPremise bool
+ expectedSender string
+ }{
+ {
+ onPremise: false,
+ expectedSender: "sung@getdnote.com",
+ },
+ {
+ onPremise: true,
+ expectedSender: "noreply@example.com",
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("self hosted %t", tc.onPremise), func(t *testing.T) {
+ c := config.Load()
+ c.SetOnPremise(tc.onPremise)
+ c.WebURL = "http://example.com"
+
+ emailBackend := testutils.MockEmailbackendImplementation{}
+ a := NewTest(&App{
+ EmailBackend: &emailBackend,
+ Config: c,
+ })
+
+ if err := a.SendPasswordResetEmail("alice@example.com", "mockTokenValue"); err != nil {
+ t.Fatal(err, "failed to perform")
+ }
+
+ assert.Equalf(t, len(emailBackend.Emails), 1, "email queue count mismatch")
+ assert.Equal(t, emailBackend.Emails[0].From, tc.expectedSender, "email sender mismatch")
+ assert.DeepEqual(t, emailBackend.Emails[0].To, []string{"alice@example.com"}, "email sender mismatch")
+ })
+ }
+}
+
+func TestSendSubscriptionConfirmationEmail(t *testing.T) {
+ c := config.Load()
+ c.SetOnPremise(false)
+ c.WebURL = "http://example.com"
+
+ emailBackend := testutils.MockEmailbackendImplementation{}
+ a := NewTest(&App{
+ EmailBackend: &emailBackend,
+ Config: c,
+ })
+
+ if err := a.SendSubscriptionConfirmationEmail("alice@example.com"); err != nil {
+ t.Fatal(err, "failed to perform")
+ }
+
+ assert.Equalf(t, len(emailBackend.Emails), 1, "email queue count mismatch")
+ assert.Equal(t, emailBackend.Emails[0].From, "sung@getdnote.com", "email sender mismatch")
+ assert.DeepEqual(t, emailBackend.Emails[0].To, []string{"alice@example.com"}, "email sender mismatch")
+}
+
+func TestGetSenderEmail(t *testing.T) {
+ testCases := []struct {
+ onPremise bool
+ webURL string
+ candidate string
+ expectedSender string
+ }{
+ {
+ onPremise: true,
+ webURL: "https://www.example.com",
+ candidate: "alice@getdnote.com",
+ expectedSender: "noreply@example.com",
+ },
+ {
+ onPremise: false,
+ webURL: "https://www.getdnote.com",
+ candidate: "alice@getdnote.com",
+ expectedSender: "alice@getdnote.com",
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("on premise %t candidate %s", tc.onPremise, tc.candidate), func(t *testing.T) {
+ c := config.Load()
+ c.SetOnPremise(tc.onPremise)
+ c.WebURL = tc.webURL
+
+ got, err := GetSenderEmail(c, tc.candidate)
+ if err != nil {
+ t.Fatal(err, "failed to perform")
+ }
+
+ assert.Equal(t, got, tc.expectedSender, "result mismatch")
})
}
}
diff --git a/pkg/server/app/errors.go b/pkg/server/app/errors.go
deleted file mode 100644
index 67635b23..00000000
--- a/pkg/server/app/errors.go
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package app
-
-type appError string
-
-func (e appError) Error() string {
- return string(e)
-}
-
-func (e appError) Public() string {
- return string(e)
-}
-
-var (
- // ErrNotFound an error that indicates that the given resource is not found
- ErrNotFound appError = "not found"
- // ErrLoginInvalid is an error for invalid login
- ErrLoginInvalid appError = "Wrong email and password combination"
-
- // ErrDuplicateEmail is an error for duplicate email
- ErrDuplicateEmail appError = "duplicate email"
- // ErrEmailRequired is an error for missing email
- ErrEmailRequired appError = "Please enter an email"
- // ErrPasswordRequired is an error for missing email
- ErrPasswordRequired appError = "Please enter a password"
- // ErrPasswordTooShort is an error for short password
- ErrPasswordTooShort appError = "password should be longer than 8 characters"
- // ErrPasswordConfirmationMismatch is an error for password ans password confirmation not matching
- ErrPasswordConfirmationMismatch appError = "password confirmation does not match password"
-
- // ErrLoginRequired is an error for not authenticated
- ErrLoginRequired appError = "login required"
-
- // ErrBookUUIDRequired is an error for note missing book uuid
- ErrBookUUIDRequired appError = "book uuid required"
- // ErrBookNameRequired is an error for note missing book name
- ErrBookNameRequired appError = "book name required"
- // ErrDuplicateBook is an error for duplicate book
- ErrDuplicateBook appError = "duplicate book exists"
-
- // ErrEmptyUpdate is an error for empty update params
- ErrEmptyUpdate appError = "update is empty"
-
- // ErrInvalidUUID is an error for invalid uuid
- ErrInvalidUUID appError = "invalid uuid"
-
- // ErrInvalidSMTPConfig is an error for invalid SMTP configuration
- ErrInvalidSMTPConfig appError = "SMTP is not configured"
-
- // ErrInvalidToken is an error for invalid token
- ErrInvalidToken appError = "invalid token"
- // ErrMissingToken is an error for missing token
- ErrMissingToken appError = "missing token"
- // ErrExpiredToken is an error for missing token
- ErrExpiredToken appError = "This token has expired."
-
- // ErrPasswordResetTokenExpired is an error for expired password reset token
- ErrPasswordResetTokenExpired appError = "this link has been expired. Please request a new password reset link."
- // ErrInvalidPasswordChangeInput is an error for changing password
- ErrInvalidPasswordChangeInput appError = "Both current and new passwords are required to change the password."
-
- ErrInvalidPassword appError = "Invalid current password."
- // ErrEmailTooLong is an error for email length exceeding the limit
- ErrEmailTooLong appError = "Email is too long."
-
- // ErrUserHasExistingResources is an error for attempting to remove a user with existing notes or books
- ErrUserHasExistingResources appError = "cannot remove user with existing notes or books"
-)
diff --git a/pkg/server/app/helpers.go b/pkg/server/app/helpers.go
index 437ca9ae..ea72d107 100644
--- a/pkg/server/app/helpers.go
+++ b/pkg/server/app/helpers.go
@@ -1,50 +1,37 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
import (
- "time"
-
"github.com/dnote/dnote/pkg/server/database"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
- "gorm.io/gorm"
)
// incrementUserUSN increment the given user's max_usn by 1
// and returns the new, incremented max_usn
func incrementUserUSN(tx *gorm.DB, userID int) (int, error) {
- // First, get the current max_usn to detect transition from empty server
- var user database.User
- if err := tx.Select("max_usn, full_sync_before").Where("id = ?", userID).First(&user).Error; err != nil {
- return 0, errors.Wrap(err, "getting current user state")
- }
-
- // If transitioning from empty server (MaxUSN=0) to non-empty (MaxUSN=1),
- // set full_sync_before to current timestamp to force all other clients to full sync
- if user.MaxUSN == 0 && user.FullSyncBefore == 0 {
- currentTime := time.Now().Unix()
- if err := tx.Table("users").Where("id = ?", userID).Update("full_sync_before", currentTime).Error; err != nil {
- return 0, errors.Wrap(err, "setting full_sync_before on empty server transition")
- }
- }
-
if err := tx.Table("users").Where("id = ?", userID).Update("max_usn", gorm.Expr("max_usn + 1")).Error; err != nil {
return 0, errors.Wrap(err, "incrementing user max_usn")
}
+ var user database.User
if err := tx.Select("max_usn").Where("id = ?", userID).First(&user).Error; err != nil {
return 0, errors.Wrap(err, "getting the updated user max_usn")
}
diff --git a/pkg/server/app/helpers_test.go b/pkg/server/app/helpers_test.go
index 93486ecd..b0b32d23 100644
--- a/pkg/server/app/helpers_test.go
+++ b/pkg/server/app/helpers_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
@@ -43,13 +46,13 @@ func TestIncremenetUserUSN(t *testing.T) {
// set up
for idx, tc := range testCases {
func() {
- db := testutils.InitMemoryDB(t)
+ defer testutils.ClearData(testutils.DB)
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", tc.maxUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", tc.maxUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
// execute
- tx := db.Begin()
+ tx := testutils.DB.Begin()
nextUSN, err := incrementUserUSN(tx, user.ID)
if err != nil {
t.Fatal(errors.Wrap(err, "incrementing the user usn"))
@@ -58,7 +61,7 @@ func TestIncremenetUserUSN(t *testing.T) {
// test
var userRecord database.User
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
assert.Equal(t, userRecord.MaxUSN, tc.expectedMaxUSN, fmt.Sprintf("user max_usn mismatch for case %d", idx))
assert.Equal(t, nextUSN, tc.expectedMaxUSN, fmt.Sprintf("next_usn mismatch for case %d", idx))
diff --git a/pkg/server/app/main_test.go b/pkg/server/app/main_test.go
new file mode 100644
index 00000000..b3e34574
--- /dev/null
+++ b/pkg/server/app/main_test.go
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package app
+
+import (
+ "os"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/server/testutils"
+)
+
+func TestMain(m *testing.M) {
+ testutils.InitTestDB()
+
+ code := m.Run()
+ testutils.ClearData(testutils.DB)
+
+ os.Exit(code)
+}
diff --git a/pkg/server/app/notes.go b/pkg/server/app/notes.go
index 4bdeaaf6..f3dbc86e 100644
--- a/pkg/server/app/notes.go
+++ b/pkg/server/app/notes.go
@@ -1,39 +1,39 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
import (
- "errors"
- "time"
-
"github.com/dnote/dnote/pkg/server/database"
"github.com/dnote/dnote/pkg/server/helpers"
- pkgErrors "github.com/pkg/errors"
- "gorm.io/gorm"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
)
// CreateNote creates a note with the next usn and updates the user's max_usn.
// It returns the created note.
-func (a *App) CreateNote(user database.User, bookUUID, content string, addedOn *int64, editedOn *int64, client string) (database.Note, error) {
+func (a *App) CreateNote(user database.User, bookUUID, content string, addedOn *int64, editedOn *int64, public bool, client string) (database.Note, error) {
tx := a.DB.Begin()
nextUSN, err := incrementUserUSN(tx, user.ID)
if err != nil {
tx.Rollback()
- return database.Note{}, pkgErrors.Wrap(err, "incrementing user max_usn")
+ return database.Note{}, errors.Wrap(err, "incrementing user max_usn")
}
var noteAddedOn int64
@@ -52,23 +52,24 @@ func (a *App) CreateNote(user database.User, bookUUID, content string, addedOn *
uuid, err := helpers.GenUUID()
if err != nil {
- tx.Rollback()
return database.Note{}, err
}
note := database.Note{
- UUID: uuid,
- BookUUID: bookUUID,
- UserID: user.ID,
- AddedOn: noteAddedOn,
- EditedOn: noteEditedOn,
- USN: nextUSN,
- Body: content,
- Client: client,
+ UUID: uuid,
+ BookUUID: bookUUID,
+ UserID: user.ID,
+ AddedOn: noteAddedOn,
+ EditedOn: noteEditedOn,
+ USN: nextUSN,
+ Body: content,
+ Public: public,
+ Encrypted: false,
+ Client: client,
}
if err := tx.Create(¬e).Error; err != nil {
tx.Rollback()
- return note, pkgErrors.Wrap(err, "inserting note")
+ return note, errors.Wrap(err, "inserting note")
}
tx.Commit()
@@ -80,6 +81,7 @@ func (a *App) CreateNote(user database.User, bookUUID, content string, addedOn *
type UpdateNoteParams struct {
BookUUID *string
Content *string
+ Public *bool
}
// GetBookUUID gets the bookUUID from the UpdateNoteParams
@@ -100,11 +102,20 @@ func (r UpdateNoteParams) GetContent() string {
return *r.Content
}
+// GetPublic gets the public field from the UpdateNoteParams
+func (r UpdateNoteParams) GetPublic() bool {
+ if r.Public == nil {
+ return false
+ }
+
+ return *r.Public
+}
+
// UpdateNote creates a note with the next usn and updates the user's max_usn
func (a *App) UpdateNote(tx *gorm.DB, user database.User, note database.Note, p *UpdateNoteParams) (database.Note, error) {
nextUSN, err := incrementUserUSN(tx, user.ID)
if err != nil {
- return note, pkgErrors.Wrap(err, "incrementing user max_usn")
+ return note, errors.Wrap(err, "incrementing user max_usn")
}
if p.BookUUID != nil {
@@ -113,13 +124,18 @@ func (a *App) UpdateNote(tx *gorm.DB, user database.User, note database.Note, p
if p.Content != nil {
note.Body = p.GetContent()
}
+ if p.Public != nil {
+ note.Public = p.GetPublic()
+ }
note.USN = nextUSN
note.EditedOn = a.Clock.Now().UnixNano()
note.Deleted = false
+ // TODO: remove after all users are migrated
+ note.Encrypted = false
if err := tx.Save(¬e).Error; err != nil {
- return note, pkgErrors.Wrap(err, "editing note")
+ return note, errors.Wrap(err, "editing note")
}
return note, nil
@@ -129,16 +145,16 @@ func (a *App) UpdateNote(tx *gorm.DB, user database.User, note database.Note, p
func (a *App) DeleteNote(tx *gorm.DB, user database.User, note database.Note) (database.Note, error) {
nextUSN, err := incrementUserUSN(tx, user.ID)
if err != nil {
- return note, pkgErrors.Wrap(err, "incrementing user max_usn")
+ return note, errors.Wrap(err, "incrementing user max_usn")
}
if err := tx.Model(¬e).
- Updates(map[string]interface{}{
+ Update(map[string]interface{}{
"usn": nextUSN,
"deleted": true,
"body": "",
}).Error; err != nil {
- return note, pkgErrors.Wrap(err, "deleting note")
+ return note, errors.Wrap(err, "deleting note")
}
return note, nil
@@ -147,145 +163,14 @@ func (a *App) DeleteNote(tx *gorm.DB, user database.User, note database.Note) (d
// GetUserNoteByUUID retrives a digest by the uuid for the given user
func (a *App) GetUserNoteByUUID(userID int, uuid string) (*database.Note, error) {
var ret database.Note
- err := a.DB.Where("user_id = ? AND uuid = ?", userID, uuid).First(&ret).Error
+ conn := a.DB.Where("user_id = ? AND uuid = ?", userID, uuid).First(&ret)
- if errors.Is(err, gorm.ErrRecordNotFound) {
+ if conn.RecordNotFound() {
return nil, nil
}
- if err != nil {
- return nil, pkgErrors.Wrap(err, "finding digest")
+ if err := conn.Error; err != nil {
+ return nil, errors.Wrap(err, "finding digest")
}
return &ret, nil
}
-
-// GetNotesParams is params for finding notes
-type GetNotesParams struct {
- Year int
- Month int
- Page int
- Books []string
- Search string
- PerPage int
-}
-
-type ftsParams struct {
- HighlightAll bool
-}
-
-func getFTSBodyExpression(params *ftsParams) string {
- if params != nil && params.HighlightAll {
- return "highlight(notes_fts, 0, '', ' ') AS body"
- }
-
- return "snippet(notes_fts, 0, '', ' ', '...', 50) AS body"
-}
-
-func selectFTSFields(conn *gorm.DB, params *ftsParams) *gorm.DB {
- bodyExpr := getFTSBodyExpression(params)
-
- return conn.Select(`
-notes.id,
-notes.uuid,
-notes.created_at,
-notes.updated_at,
-notes.book_uuid,
-notes.user_id,
-notes.added_on,
-notes.edited_on,
-notes.usn,
-notes.deleted,
-` + bodyExpr)
-}
-
-func getNotesBaseQuery(db *gorm.DB, userID int, q GetNotesParams) *gorm.DB {
- conn := db.Where(
- "notes.user_id = ? AND notes.deleted = ?",
- userID, false,
- )
-
- if q.Search != "" {
- conn = selectFTSFields(conn, nil)
- conn = conn.Joins("INNER JOIN notes_fts ON notes_fts.rowid = notes.id")
- conn = conn.Where("notes_fts MATCH ?", q.Search)
- }
-
- if len(q.Books) > 0 {
- conn = conn.Joins("INNER JOIN books ON books.uuid = notes.book_uuid").
- Where("books.label in (?)", q.Books)
- }
-
- if q.Year != 0 || q.Month != 0 {
- dateLowerbound, dateUpperbound := getDateBounds(q.Year, q.Month)
- conn = conn.Where("notes.added_on >= ? AND notes.added_on < ?", dateLowerbound, dateUpperbound)
- }
-
- return conn
-}
-
-func getDateBounds(year, month int) (int64, int64) {
- var yearUpperbound, monthUpperbound int
-
- if month == 12 {
- monthUpperbound = 1
- yearUpperbound = year + 1
- } else {
- monthUpperbound = month + 1
- yearUpperbound = year
- }
-
- lower := time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.UTC).UnixNano()
- upper := time.Date(yearUpperbound, time.Month(monthUpperbound), 1, 0, 0, 0, 0, time.UTC).UnixNano()
-
- return lower, upper
-}
-
-func orderGetNotes(conn *gorm.DB) *gorm.DB {
- return conn.Order("notes.updated_at DESC, notes.id DESC")
-}
-
-func paginate(conn *gorm.DB, page, perPage int) *gorm.DB {
- // Paginate
- if page > 0 {
- offset := perPage * (page - 1)
- conn = conn.Offset(offset)
- }
-
- conn = conn.Limit(perPage)
-
- return conn
-}
-
-// GetNotesResult is the result of getting notes
-type GetNotesResult struct {
- Notes []database.Note
- Total int64
-}
-
-// GetNotes returns a list of matching notes
-func (a *App) GetNotes(userID int, params GetNotesParams) (GetNotesResult, error) {
- conn := getNotesBaseQuery(a.DB, userID, params)
-
- var total int64
- if err := conn.Model(database.Note{}).Count(&total).Error; err != nil {
- return GetNotesResult{}, pkgErrors.Wrap(err, "counting total")
- }
-
- notes := []database.Note{}
- if total != 0 {
- conn = orderGetNotes(conn)
- conn = database.PreloadNote(conn)
- conn = paginate(conn, params.Page, params.PerPage)
-
- if err := conn.Find(¬es).Error; err != nil {
- return GetNotesResult{}, pkgErrors.Wrap(err, "finding notes")
- }
- }
-
- res := GetNotesResult{
- Notes: notes,
- Total: total,
- }
-
- return res, nil
-}
diff --git a/pkg/server/app/notes_test.go b/pkg/server/app/notes_test.go
index a165312d..4ce6c701 100644
--- a/pkg/server/app/notes_test.go
+++ b/pkg/server/app/notes_test.go
@@ -1,23 +1,25 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
import (
"fmt"
- "strings"
"testing"
"time"
@@ -30,6 +32,8 @@ import (
func TestCreateNote(t *testing.T) {
serverTime := time.Date(2017, time.March, 14, 21, 15, 0, 0, time.UTC)
+ mockClock := clock.NewMock()
+ mockClock.SetNow(serverTime)
ts1 := time.Date(2018, time.November, 12, 10, 11, 0, 0, time.UTC).UnixNano()
ts2 := time.Date(2018, time.November, 15, 0, 1, 10, 0, time.UTC).UnixNano()
@@ -70,41 +74,39 @@ func TestCreateNote(t *testing.T) {
for idx, tc := range testCases {
func() {
- // Create a new clock for each test case to avoid race conditions in parallel tests
- mockClock := clock.NewMock()
- mockClock.SetNow(serverTime)
+ defer testutils.ClearData(testutils.DB)
- db := testutils.InitMemoryDB(t)
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
- fmt.Println(user)
-
- anotherUser := testutils.SetupUserData(db, "another@test.com", "password123")
- testutils.MustExec(t, db.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ anotherUser := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
b1 := database.Book{UserID: user.ID, Label: "js", Deleted: false}
- testutils.MustExec(t, db.Save(&b1), fmt.Sprintf("preparing b1 for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Save(&b1), fmt.Sprintf("preparing b1 for test case %d", idx))
- a := NewTest()
- a.DB = db
- a.Clock = mockClock
+ a := NewTest(&App{
+ Clock: mockClock,
+ })
- if _, err := a.CreateNote(user, b1.UUID, "note content", tc.addedOn, tc.editedOn, ""); err != nil {
- t.Fatal(errors.Wrapf(err, "creating note for test case %d", idx))
+ tx := testutils.DB.Begin()
+ if _, err := a.CreateNote(user, b1.UUID, "note content", tc.addedOn, tc.editedOn, false, ""); err != nil {
+ tx.Rollback()
+ t.Fatal(errors.Wrap(err, "deleting note"))
}
+ tx.Commit()
- var bookCount, noteCount int64
+ var bookCount, noteCount int
var noteRecord database.Note
var userRecord database.User
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), fmt.Sprintf("counting book for test case %d", idx))
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), fmt.Sprintf("counting notes for test case %d", idx))
- testutils.MustExec(t, db.First(¬eRecord), fmt.Sprintf("finding note for test case %d", idx))
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), fmt.Sprintf("counting book for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), fmt.Sprintf("counting notes for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.First(¬eRecord), fmt.Sprintf("finding note for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
- assert.Equal(t, bookCount, int64(1), "book count mismatch")
- assert.Equal(t, noteCount, int64(1), "note count mismatch")
+ assert.Equal(t, bookCount, 1, "book count mismatch")
+ assert.Equal(t, noteCount, 1, "note count mismatch")
assert.NotEqual(t, noteRecord.UUID, "", "note UUID should have been generated")
assert.Equal(t, noteRecord.UserID, user.ID, "note UserID mismatch")
assert.Equal(t, noteRecord.Body, "note content", "note Body mismatch")
@@ -114,41 +116,10 @@ func TestCreateNote(t *testing.T) {
assert.Equal(t, noteRecord.EditedOn, tc.expectedEditedOn, "note EditedOn mismatch")
assert.Equal(t, userRecord.MaxUSN, tc.expectedUSN, "user max_usn mismatch")
-
- // Assert FTS table is updated
- var ftsBody string
- testutils.MustExec(t, db.Raw("SELECT body FROM notes_fts WHERE rowid = ?", noteRecord.ID).Scan(&ftsBody), fmt.Sprintf("querying notes_fts for test case %d", idx))
- assert.Equal(t, ftsBody, "note content", "FTS body mismatch")
- var searchCount int64
- testutils.MustExec(t, db.Raw("SELECT COUNT(*) FROM notes_fts WHERE notes_fts MATCH ?", "content").Scan(&searchCount), "searching notes_fts")
- assert.Equal(t, searchCount, int64(1), "Note should still be searchable")
}()
}
}
-func TestCreateNote_EmptyBody(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- b1 := database.Book{UserID: user.ID, Label: "testBook"}
- testutils.MustExec(t, db.Save(&b1), "preparing book")
-
- a := NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
-
- // Create note with empty body
- note, err := a.CreateNote(user, b1.UUID, "", nil, nil, "")
- if err != nil {
- t.Fatal(errors.Wrap(err, "creating note with empty body"))
- }
-
- // Assert FTS entry exists with empty body
- var ftsBody string
- testutils.MustExec(t, db.Raw("SELECT body FROM notes_fts WHERE rowid = ?", note.ID).Scan(&ftsBody), "querying notes_fts for empty body note")
- assert.Equal(t, ftsBody, "", "FTS body should be empty for note created with empty body")
-}
-
func TestUpdateNote(t *testing.T) {
testCases := []struct {
userUSN int
@@ -166,107 +137,60 @@ func TestUpdateNote(t *testing.T) {
for idx, tc := range testCases {
t.Run(fmt.Sprintf("test case %d", idx), func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
+ defer testutils.ClearData(testutils.DB)
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", tc.userUSN), "preparing user max_usn for test case")
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", tc.userUSN), "preparing user max_usn for test case")
- anotherUser := testutils.SetupUserData(db, "another@test.com", "password123")
- testutils.MustExec(t, db.Model(&anotherUser).Update("max_usn", 55), "preparing user max_usn for test case")
+ anotherUser := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&anotherUser).Update("max_usn", 55), "preparing user max_usn for test case")
b1 := database.Book{UserID: user.ID, Label: "js", Deleted: false}
- testutils.MustExec(t, db.Save(&b1), "preparing b1 for test case")
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1 for test case")
note := database.Note{UserID: user.ID, Deleted: false, Body: "test content", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e), "preparing note for test case")
-
- // Assert FTS table has original content
- var ftsBodyBefore string
- testutils.MustExec(t, db.Raw("SELECT body FROM notes_fts WHERE rowid = ?", note.ID).Scan(&ftsBodyBefore), "querying notes_fts before update")
- assert.Equal(t, ftsBodyBefore, "test content", "FTS body mismatch before update")
+ testutils.MustExec(t, testutils.DB.Save(¬e), "preparing note for test case")
c := clock.NewMock()
content := "updated test content"
+ public := true
- a := NewTest()
- a.DB = db
- a.Clock = c
+ a := NewTest(&App{
+ Clock: c,
+ })
- tx := db.Begin()
+ tx := testutils.DB.Begin()
if _, err := a.UpdateNote(tx, user, note, &UpdateNoteParams{
Content: &content,
+ Public: &public,
}); err != nil {
tx.Rollback()
- t.Fatal(errors.Wrap(err, "updating note"))
+ t.Fatal(errors.Wrap(err, "deleting note"))
}
tx.Commit()
- var bookCount, noteCount int64
+ var bookCount, noteCount int
var noteRecord database.Note
var userRecord database.User
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), "counting book for test case")
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), "counting notes for test case")
- testutils.MustExec(t, db.First(¬eRecord), "finding note for test case")
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), "finding user for test case")
+ testutils.MustExec(t, testutils.DB.Model(&database.Book{}).Count(&bookCount), "counting book for test case")
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), "counting notes for test case")
+ testutils.MustExec(t, testutils.DB.First(¬eRecord), "finding note for test case")
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), "finding user for test case")
expectedUSN := tc.userUSN + 1
- assert.Equal(t, bookCount, int64(1), "book count mismatch")
- assert.Equal(t, noteCount, int64(1), "note count mismatch")
+ assert.Equal(t, bookCount, 1, "book count mismatch")
+ assert.Equal(t, noteCount, 1, "note count mismatch")
assert.Equal(t, noteRecord.UserID, user.ID, "note UserID mismatch")
assert.Equal(t, noteRecord.Body, content, "note Body mismatch")
+ assert.Equal(t, noteRecord.Public, public, "note Public mismatch")
assert.Equal(t, noteRecord.Deleted, false, "note Deleted mismatch")
assert.Equal(t, noteRecord.USN, expectedUSN, "note USN mismatch")
assert.Equal(t, userRecord.MaxUSN, expectedUSN, "user MaxUSN mismatch")
-
- // Assert FTS table is updated with new content
- var ftsBodyAfter string
- testutils.MustExec(t, db.Raw("SELECT body FROM notes_fts WHERE rowid = ?", noteRecord.ID).Scan(&ftsBodyAfter), "querying notes_fts after update")
- assert.Equal(t, ftsBodyAfter, content, "FTS body mismatch after update")
- var searchCount int64
- testutils.MustExec(t, db.Raw("SELECT COUNT(*) FROM notes_fts WHERE notes_fts MATCH ?", "updated").Scan(&searchCount), "searching notes_fts")
- assert.Equal(t, searchCount, int64(1), "Note should still be searchable")
})
}
}
-func TestUpdateNote_SameContent(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- b1 := database.Book{UserID: user.ID, Label: "testBook"}
- testutils.MustExec(t, db.Save(&b1), "preparing book")
-
- note := database.Note{UserID: user.ID, Deleted: false, Body: "test content", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e), "preparing note")
-
- a := NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
-
- // Update note with same content
- sameContent := "test content"
- tx := db.Begin()
- _, err := a.UpdateNote(tx, user, note, &UpdateNoteParams{
- Content: &sameContent,
- })
- if err != nil {
- tx.Rollback()
- t.Fatal(errors.Wrap(err, "updating note with same content"))
- }
- tx.Commit()
-
- // Assert FTS still has the same content
- var ftsBody string
- testutils.MustExec(t, db.Raw("SELECT body FROM notes_fts WHERE rowid = ?", note.ID).Scan(&ftsBody), "querying notes_fts after update")
- assert.Equal(t, ftsBody, "test content", "FTS body should still be 'test content'")
-
- // Assert it's still searchable
- var searchCount int64
- testutils.MustExec(t, db.Raw("SELECT COUNT(*) FROM notes_fts WHERE notes_fts MATCH ?", "test").Scan(&searchCount), "searching notes_fts")
- assert.Equal(t, searchCount, int64(1), "Note should still be searchable")
-}
-
func TestDeleteNote(t *testing.T) {
testCases := []struct {
userUSN int
@@ -288,29 +212,23 @@ func TestDeleteNote(t *testing.T) {
for idx, tc := range testCases {
func() {
- db := testutils.InitMemoryDB(t)
+ defer testutils.ClearData(testutils.DB)
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("max_usn", tc.userUSN), fmt.Sprintf("preparing user max_usn for test case %d", idx))
- anotherUser := testutils.SetupUserData(db, "another@test.com", "password123")
- testutils.MustExec(t, db.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
+ anotherUser := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&anotherUser).Update("max_usn", 55), fmt.Sprintf("preparing user max_usn for test case %d", idx))
b1 := database.Book{UserID: user.ID, Label: "testBook"}
- testutils.MustExec(t, db.Save(&b1), fmt.Sprintf("preparing b1 for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Save(&b1), fmt.Sprintf("preparing b1 for test case %d", idx))
note := database.Note{UserID: user.ID, Deleted: false, Body: "test content", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e), fmt.Sprintf("preparing note for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Save(¬e), fmt.Sprintf("preparing note for test case %d", idx))
- // Assert FTS table has content before delete
- var ftsCountBefore int64
- testutils.MustExec(t, db.Raw("SELECT COUNT(*) FROM notes_fts WHERE rowid = ?", note.ID).Scan(&ftsCountBefore), fmt.Sprintf("counting notes_fts before delete for test case %d", idx))
- assert.Equal(t, ftsCountBefore, int64(1), "FTS should have entry before delete")
+ a := NewTest(nil)
- a := NewTest()
- a.DB = db
-
- tx := db.Begin()
+ tx := testutils.DB.Begin()
ret, err := a.DeleteNote(tx, user, note)
if err != nil {
tx.Rollback()
@@ -318,15 +236,15 @@ func TestDeleteNote(t *testing.T) {
}
tx.Commit()
- var noteCount int64
+ var noteCount int
var noteRecord database.Note
var userRecord database.User
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), fmt.Sprintf("counting notes for test case %d", idx))
- testutils.MustExec(t, db.First(¬eRecord), fmt.Sprintf("finding note for test case %d", idx))
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Model(&database.Note{}).Count(¬eCount), fmt.Sprintf("counting notes for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.First(¬eRecord), fmt.Sprintf("finding note for test case %d", idx))
+ testutils.MustExec(t, testutils.DB.Where("id = ?", user.ID).First(&userRecord), fmt.Sprintf("finding user for test case %d", idx))
- assert.Equal(t, noteCount, int64(1), "note count mismatch")
+ assert.Equal(t, noteCount, 1, "note count mismatch")
assert.Equal(t, noteRecord.UserID, user.ID, "note user_id mismatch")
assert.Equal(t, noteRecord.Body, "", "note content mismatch")
@@ -338,178 +256,6 @@ func TestDeleteNote(t *testing.T) {
assert.Equal(t, ret.Body, "", "note content mismatch")
assert.Equal(t, ret.Deleted, true, "note deleted flag mismatch")
assert.Equal(t, ret.USN, tc.expectedUSN, "note label mismatch")
-
- // Assert FTS body is empty after delete (row still exists but content is cleared)
- var ftsBody string
- testutils.MustExec(t, db.Raw("SELECT body FROM notes_fts WHERE rowid = ?", noteRecord.ID).Scan(&ftsBody), fmt.Sprintf("querying notes_fts after delete for test case %d", idx))
- assert.Equal(t, ftsBody, "", "FTS body should be empty after delete")
}()
}
}
-
-func TestGetNotes_FTSSearch(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- b1 := database.Book{UserID: user.ID, Label: "testBook"}
- testutils.MustExec(t, db.Save(&b1), "preparing book")
-
- // Create notes with different content
- note1 := database.Note{UserID: user.ID, Deleted: false, Body: "foo bar baz bar", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e1), "preparing note1")
-
- note2 := database.Note{UserID: user.ID, Deleted: false, Body: "hello run foo", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e2), "preparing note2")
-
- note3 := database.Note{UserID: user.ID, Deleted: false, Body: "running quz succeeded", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e3), "preparing note3")
-
- a := NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
-
- // Search "baz"
- result, err := a.GetNotes(user.ID, GetNotesParams{
- Search: "baz",
- Page: 1,
- PerPage: 30,
- })
- if err != nil {
- t.Fatal(errors.Wrap(err, "getting notes with FTS search"))
- }
- assert.Equal(t, result.Total, int64(1), "Should find 1 note with 'baz'")
- assert.Equal(t, len(result.Notes), 1, "Should return 1 note")
- for i, note := range result.Notes {
- assert.Equal(t, strings.Contains(note.Body, "baz "), true, fmt.Sprintf("Note %d should contain highlighted dnote", i))
- }
-
- // Search for "running" - should return 1 note
- result, err = a.GetNotes(user.ID, GetNotesParams{
- Search: "running",
- Page: 1,
- PerPage: 30,
- })
- if err != nil {
- t.Fatal(errors.Wrap(err, "getting notes with FTS search for review"))
- }
- assert.Equal(t, result.Total, int64(2), "Should find 2 note with 'running'")
- assert.Equal(t, len(result.Notes), 2, "Should return 2 notes")
- assert.Equal(t, result.Notes[0].Body, "running quz succeeded", "Should return the review note with highlighting")
- assert.Equal(t, result.Notes[1].Body, "hello run foo", "Should return the review note with highlighting")
-
- // Search for non-existent term - should return 0 notes
- result, err = a.GetNotes(user.ID, GetNotesParams{
- Search: "nonexistent",
- Page: 1,
- PerPage: 30,
- })
- if err != nil {
- t.Fatal(errors.Wrap(err, "getting notes with FTS search for nonexistent"))
- }
-
- assert.Equal(t, result.Total, int64(0), "Should find 0 notes with 'nonexistent'")
- assert.Equal(t, len(result.Notes), 0, "Should return 0 notes")
-}
-
-func TestGetNotes_FTSSearch_Snippet(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- b1 := database.Book{UserID: user.ID, Label: "testBook"}
- testutils.MustExec(t, db.Save(&b1), "preparing book")
-
- // Create a long note to test snippet truncation with "..."
- // The snippet limit is 50 tokens, so we generate enough words to exceed it
- longBody := strings.Repeat("filler ", 100) + "the important keyword appears here"
- longNote := database.Note{UserID: user.ID, Deleted: false, Body: longBody, BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(&longNote), "preparing long note")
-
- a := NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
-
- // Search for "keyword" in long note - should return snippet with "..."
- result, err := a.GetNotes(user.ID, GetNotesParams{
- Search: "keyword",
- Page: 1,
- PerPage: 30,
- })
- if err != nil {
- t.Fatal(errors.Wrap(err, "getting notes with FTS search for keyword"))
- }
-
- assert.Equal(t, result.Total, int64(1), "Should find 1 note with 'keyword'")
- assert.Equal(t, len(result.Notes), 1, "Should return 1 note")
- // The snippet should contain "..." to indicate truncation and the highlighted keyword
- assert.Equal(t, strings.Contains(result.Notes[0].Body, "..."), true, "Snippet should contain '...' for truncation")
- assert.Equal(t, strings.Contains(result.Notes[0].Body, "keyword "), true, "Snippet should contain highlighted keyword")
-}
-
-func TestGetNotes_FTSSearch_ShortWord(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- b1 := database.Book{UserID: user.ID, Label: "testBook"}
- testutils.MustExec(t, db.Save(&b1), "preparing book")
-
- // Create notes with short words
- note1 := database.Note{UserID: user.ID, Deleted: false, Body: "a b c", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e1), "preparing note1")
-
- note2 := database.Note{UserID: user.ID, Deleted: false, Body: "d", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e2), "preparing note2")
-
- a := NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
-
- result, err := a.GetNotes(user.ID, GetNotesParams{
- Search: "a",
- Page: 1,
- PerPage: 30,
- })
- if err != nil {
- t.Fatal(errors.Wrap(err, "getting notes with FTS search for 'a'"))
- }
-
- assert.Equal(t, result.Total, int64(1), "Should find 1 note")
- assert.Equal(t, len(result.Notes), 1, "Should return 1 note")
- assert.Equal(t, strings.Contains(result.Notes[0].Body, "a "), true, "Should contain highlighted 'a'")
-}
-
-func TestGetNotes_All(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- b1 := database.Book{UserID: user.ID, Label: "testBook"}
- testutils.MustExec(t, db.Save(&b1), "preparing book")
-
- note1 := database.Note{UserID: user.ID, Deleted: false, Body: "a b c", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e1), "preparing note1")
-
- note2 := database.Note{UserID: user.ID, Deleted: false, Body: "d", BookUUID: b1.UUID}
- testutils.MustExec(t, db.Save(¬e2), "preparing note2")
-
- a := NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
-
- result, err := a.GetNotes(user.ID, GetNotesParams{
- Search: "",
- Page: 1,
- PerPage: 30,
- })
- if err != nil {
- t.Fatal(errors.Wrap(err, "getting notes with FTS search for 'a'"))
- }
-
- assert.Equal(t, result.Total, int64(2), "Should not find all notes")
- assert.Equal(t, len(result.Notes), 2, "Should not find all notes")
-
- for _, note := range result.Notes {
- assert.Equal(t, strings.Contains(note.Body, ""), false, "There should be no keywords")
- assert.Equal(t, strings.Contains(note.Body, " "), false, "There should be no keywords")
- }
- assert.Equal(t, result.Notes[0].Body, "d", "Full content should be returned")
- assert.Equal(t, result.Notes[1].Body, "a b c", "Full content should be returned")
-}
diff --git a/pkg/server/app/sessions.go b/pkg/server/app/sessions.go
index 6c230d76..d4831053 100644
--- a/pkg/server/app/sessions.go
+++ b/pkg/server/app/sessions.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
@@ -20,7 +23,7 @@ import (
"github.com/dnote/dnote/pkg/server/crypt"
"github.com/dnote/dnote/pkg/server/database"
- "gorm.io/gorm"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
)
@@ -48,7 +51,7 @@ func (a *App) CreateSession(userID int) (database.Session, error) {
// DeleteUserSessions deletes all existing sessions for the given user. It effectively
// invalidates all existing sessions.
func (a *App) DeleteUserSessions(db *gorm.DB, userID int) error {
- if err := db.Where("user_id = ?", userID).Delete(&database.Session{}).Error; err != nil {
+ if err := db.Debug().Where("user_id = ?", userID).Delete(&database.Session{}).Error; err != nil {
return errors.Wrap(err, "deleting sessions")
}
diff --git a/pkg/server/app/testutils.go b/pkg/server/app/testutils.go
index 248f4784..8accf480 100644
--- a/pkg/server/app/testutils.go
+++ b/pkg/server/app/testutils.go
@@ -1,36 +1,65 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
import (
+ "os"
+
"github.com/dnote/dnote/pkg/clock"
- "github.com/dnote/dnote/pkg/server/assets"
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/dnote/dnote/pkg/server/mailer"
"github.com/dnote/dnote/pkg/server/testutils"
)
// NewTest returns an app for a testing environment
-func NewTest() App {
- return App{
- Clock: clock.NewMock(),
- EmailBackend: &testutils.MockEmailbackendImplementation{},
- HTTP500Page: assets.MustGetHTTP500ErrorPage(),
- BaseURL: "http://127.0.0.0.1",
- Port: "3000",
- DisableRegistration: false,
- DBPath: "",
- AssetBaseURL: "",
+func NewTest(appParams *App) App {
+ emailTmplDir := os.Getenv("DNOTE_TEST_EMAIL_TEMPLATE_DIR")
+ c := config.Load()
+ c.SetOnPremise(false)
+
+ a := App{
+ DB: testutils.DB,
+ Clock: clock.NewMock(),
+ EmailTemplates: mailer.NewTemplates(&emailTmplDir),
+ EmailBackend: &testutils.MockEmailbackendImplementation{},
+ Config: c,
}
+
+ // Allow to override with appParams
+ if appParams != nil && appParams.EmailBackend != nil {
+ a.EmailBackend = appParams.EmailBackend
+ }
+ if appParams != nil && appParams.Clock != nil {
+ a.Clock = appParams.Clock
+ }
+ if appParams != nil && appParams.EmailTemplates != nil {
+ a.EmailTemplates = appParams.EmailTemplates
+ }
+ if appParams != nil && appParams.Config.OnPremise {
+ a.Config.OnPremise = appParams.Config.OnPremise
+ }
+ if appParams != nil && appParams.Config.WebURL != "" {
+ a.Config.WebURL = appParams.Config.WebURL
+ }
+ if appParams != nil && appParams.Config.DisableRegistration {
+ a.Config.DisableRegistration = appParams.Config.DisableRegistration
+ }
+
+ return a
}
diff --git a/pkg/server/app/users.go b/pkg/server/app/users.go
index 9c167b69..ca902775 100644
--- a/pkg/server/app/users.go
+++ b/pkg/server/app/users.go
@@ -1,214 +1,101 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
import (
- "errors"
-
"github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/helpers"
- "github.com/dnote/dnote/pkg/server/log"
- pkgErrors "github.com/pkg/errors"
+ "github.com/dnote/dnote/pkg/server/token"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
"golang.org/x/crypto/bcrypt"
- "gorm.io/gorm"
)
-// validatePassword validates a password
-func validatePassword(password string) error {
- if len(password) < 8 {
- return ErrPasswordTooShort
+// TouchLastLoginAt updates the last login timestamp
+func (a *App) TouchLastLoginAt(user database.User, tx *gorm.DB) error {
+ t := a.Clock.Now()
+ if err := tx.Model(&user).Update(database.User{LastLoginAt: &t}).Error; err != nil {
+ return errors.Wrap(err, "updating last_login_at")
}
return nil
}
-// TouchLastLoginAt updates the last login timestamp
-func (a *App) TouchLastLoginAt(user database.User, tx *gorm.DB) error {
- t := a.Clock.Now()
- if err := tx.Model(&user).Update("last_login_at", &t).Error; err != nil {
- return pkgErrors.Wrap(err, "updating last_login_at")
+func createEmailPreference(user database.User, tx *gorm.DB) error {
+ p := database.EmailPreference{
+ UserID: user.ID,
+ }
+ if err := tx.Save(&p).Error; err != nil {
+ return errors.Wrap(err, "inserting email preference")
}
return nil
}
// CreateUser creates a user
-func (a *App) CreateUser(email, password string, passwordConfirmation string) (database.User, error) {
- if email == "" {
- return database.User{}, ErrEmailRequired
- }
-
- if err := validatePassword(password); err != nil {
- return database.User{}, err
- }
-
- if password != passwordConfirmation {
- return database.User{}, ErrPasswordConfirmationMismatch
- }
-
+func (a *App) CreateUser(email, password string) (database.User, error) {
tx := a.DB.Begin()
- var count int64
- if err := tx.Model(&database.User{}).Where("email = ?", email).Count(&count).Error; err != nil {
- tx.Rollback()
- return database.User{}, pkgErrors.Wrap(err, "counting user")
- }
- if count > 0 {
- tx.Rollback()
- return database.User{}, ErrDuplicateEmail
- }
-
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if err != nil {
tx.Rollback()
- return database.User{}, pkgErrors.Wrap(err, "hashing password")
+ return database.User{}, errors.Wrap(err, "hashing password")
}
- uuid, err := helpers.GenUUID()
- if err != nil {
- tx.Rollback()
- return database.User{}, pkgErrors.Wrap(err, "generating UUID")
+ // Grant all privileges if self-hosting
+ var pro bool
+ if a.Config.OnPremise {
+ pro = true
+ } else {
+ pro = false
}
user := database.User{
- UUID: uuid,
- Email: database.ToNullString(email),
- Password: database.ToNullString(string(hashedPassword)),
+ Cloud: pro,
}
if err = tx.Save(&user).Error; err != nil {
tx.Rollback()
- return database.User{}, pkgErrors.Wrap(err, "saving user")
+ return database.User{}, errors.Wrap(err, "saving user")
+ }
+ account := database.Account{
+ Email: database.ToNullString(email),
+ Password: database.ToNullString(string(hashedPassword)),
+ UserID: user.ID,
+ }
+ if err = tx.Save(&account).Error; err != nil {
+ tx.Rollback()
+ return database.User{}, errors.Wrap(err, "saving account")
}
+ if _, err := token.Create(tx, user.ID, database.TokenTypeEmailPreference); err != nil {
+ tx.Rollback()
+ return database.User{}, errors.Wrap(err, "creating email verificaiton token")
+ }
+ if err := createEmailPreference(user, tx); err != nil {
+ tx.Rollback()
+ return database.User{}, errors.Wrap(err, "creating email preference")
+ }
if err := a.TouchLastLoginAt(user, tx); err != nil {
tx.Rollback()
- return database.User{}, pkgErrors.Wrap(err, "updating last login")
+ return database.User{}, errors.Wrap(err, "updating last login")
}
tx.Commit()
return user, nil
}
-
-// GetUserByEmail finds a user by email
-func (a *App) GetUserByEmail(email string) (*database.User, error) {
- var user database.User
- err := a.DB.Where("email = ?", email).First(&user).Error
- if errors.Is(err, gorm.ErrRecordNotFound) {
- return nil, ErrNotFound
- } else if err != nil {
- return nil, err
- }
-
- return &user, nil
-}
-
-// GetAllUsers retrieves all users from the database
-func (a *App) GetAllUsers() ([]database.User, error) {
- var users []database.User
- err := a.DB.Find(&users).Error
- if err != nil {
- return nil, pkgErrors.Wrap(err, "finding users")
- }
-
- return users, nil
-}
-
-// Authenticate authenticates a user
-func (a *App) Authenticate(email, password string) (*database.User, error) {
- user, err := a.GetUserByEmail(email)
- if err != nil {
- return nil, err
- }
-
- err = bcrypt.CompareHashAndPassword([]byte(user.Password.String), []byte(password))
- if err != nil {
- return nil, ErrLoginInvalid
- }
-
- return user, nil
-}
-
-// UpdateUserPassword updates a user's password with validation
-func UpdateUserPassword(db *gorm.DB, user *database.User, newPassword string) error {
- // Validate password
- if err := validatePassword(newPassword); err != nil {
- return err
- }
-
- // Hash the password
- hashedPassword, err := bcrypt.GenerateFromPassword([]byte(newPassword), bcrypt.DefaultCost)
- if err != nil {
- return pkgErrors.Wrap(err, "hashing password")
- }
-
- // Update the password
- if err := db.Model(&user).Update("password", string(hashedPassword)).Error; err != nil {
- return pkgErrors.Wrap(err, "updating password")
- }
-
- return nil
-}
-
-// RemoveUser removes a user from the system
-// Returns an error if the user has any notes or books
-func (a *App) RemoveUser(email string) error {
- // Find the user
- user, err := a.GetUserByEmail(email)
- if err != nil {
- return err
- }
-
- // Check if user has any notes
- var noteCount int64
- if err := a.DB.Model(&database.Note{}).Where("user_id = ? AND deleted = ?", user.ID, false).Count(¬eCount).Error; err != nil {
- return pkgErrors.Wrap(err, "counting notes")
- }
- if noteCount > 0 {
- return ErrUserHasExistingResources
- }
-
- // Check if user has any books
- var bookCount int64
- if err := a.DB.Model(&database.Book{}).Where("user_id = ? AND deleted = ?", user.ID, false).Count(&bookCount).Error; err != nil {
- return pkgErrors.Wrap(err, "counting books")
- }
- if bookCount > 0 {
- return ErrUserHasExistingResources
- }
-
- // Delete user
- if err := a.DB.Delete(&user).Error; err != nil {
- return pkgErrors.Wrap(err, "deleting user")
- }
-
- return nil
-}
-
-// SignIn signs in a user
-func (a *App) SignIn(user *database.User) (*database.Session, error) {
- err := a.TouchLastLoginAt(*user, a.DB)
- if err != nil {
- log.ErrorWrap(err, "touching login timestamp")
- }
-
- session, err := a.CreateSession(user.ID)
- if err != nil {
- return nil, pkgErrors.Wrap(err, "creating session")
- }
-
- return &session, nil
-}
diff --git a/pkg/server/app/users_test.go b/pkg/server/app/users_test.go
index 52183520..580bed25 100644
--- a/pkg/server/app/users_test.go
+++ b/pkg/server/app/users_test.go
@@ -1,423 +1,70 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package app
import (
+ "fmt"
"testing"
"github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/server/config"
"github.com/dnote/dnote/pkg/server/database"
"github.com/dnote/dnote/pkg/server/testutils"
"github.com/pkg/errors"
- "golang.org/x/crypto/bcrypt"
)
-func TestValidatePassword(t *testing.T) {
+func TestCreateUser(t *testing.T) {
testCases := []struct {
- name string
- password string
- wantErr error
+ onPremise bool
+ expectedPro bool
}{
{
- name: "valid password",
- password: "password123",
- wantErr: nil,
+ onPremise: true,
+ expectedPro: true,
},
{
- name: "valid password exactly 8 chars",
- password: "12345678",
- wantErr: nil,
- },
- {
- name: "password too short",
- password: "1234567",
- wantErr: ErrPasswordTooShort,
- },
- {
- name: "empty password",
- password: "",
- wantErr: ErrPasswordTooShort,
+ onPremise: false,
+ expectedPro: false,
},
}
for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- err := validatePassword(tc.password)
- assert.Equal(t, err, tc.wantErr, "error mismatch")
+ t.Run(fmt.Sprintf("self hosting %t", tc.onPremise), func(t *testing.T) {
+ c := config.Load()
+ c.SetOnPremise(tc.onPremise)
+
+ defer testutils.ClearData(testutils.DB)
+
+ a := NewTest(&App{
+ Config: c,
+ })
+ if _, err := a.CreateUser("alice@example.com", "pass1234"); err != nil {
+ t.Fatal(errors.Wrap(err, "executing"))
+ }
+
+ var userCount int
+ var userRecord database.User
+ testutils.MustExec(t, testutils.DB.Model(&database.User{}).Count(&userCount), "counting user")
+ testutils.MustExec(t, testutils.DB.First(&userRecord), "finding user")
+
+ assert.Equal(t, userCount, 1, "book count mismatch")
+ assert.Equal(t, userRecord.Cloud, tc.expectedPro, "user pro mismatch")
})
}
}
-
-func TestCreateUser_ProValue(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- a := NewTest()
- a.DB = db
- if _, err := a.CreateUser("alice@example.com", "pass1234", "pass1234"); err != nil {
- t.Fatal(errors.Wrap(err, "executing"))
- }
-
- var userCount int64
- var userRecord database.User
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting user")
- testutils.MustExec(t, db.First(&userRecord), "finding user")
-
- assert.Equal(t, userCount, int64(1), "book count mismatch")
-
-}
-
-func TestGetUserByEmail(t *testing.T) {
- t.Run("success", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "password123")
-
- a := NewTest()
- a.DB = db
-
- foundUser, err := a.GetUserByEmail("alice@example.com")
-
- assert.Equal(t, err, nil, "should not error")
- assert.Equal(t, foundUser.Email.String, "alice@example.com", "email mismatch")
- assert.Equal(t, foundUser.ID, user.ID, "user ID mismatch")
- })
-
- t.Run("not found", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- a := NewTest()
- a.DB = db
-
- user, err := a.GetUserByEmail("nonexistent@example.com")
-
- assert.Equal(t, err, ErrNotFound, "should return ErrNotFound")
- assert.Equal(t, user, (*database.User)(nil), "user should be nil")
- })
-}
-
-func TestGetAllUsers(t *testing.T) {
- t.Run("success with multiple users", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user1 := testutils.SetupUserData(db, "alice@example.com", "password123")
- user2 := testutils.SetupUserData(db, "bob@example.com", "password123")
- user3 := testutils.SetupUserData(db, "charlie@example.com", "password123")
-
- a := NewTest()
- a.DB = db
-
- users, err := a.GetAllUsers()
-
- assert.Equal(t, err, nil, "should not error")
- assert.Equal(t, len(users), 3, "should return 3 users")
-
- // Verify all users are returned
- emails := make(map[string]bool)
- for _, user := range users {
- emails[user.Email.String] = true
- }
- assert.Equal(t, emails["alice@example.com"], true, "alice should be in results")
- assert.Equal(t, emails["bob@example.com"], true, "bob should be in results")
- assert.Equal(t, emails["charlie@example.com"], true, "charlie should be in results")
-
- // Verify user details match
- for _, user := range users {
- if user.Email.String == "alice@example.com" {
- assert.Equal(t, user.ID, user1.ID, "alice ID mismatch")
- } else if user.Email.String == "bob@example.com" {
- assert.Equal(t, user.ID, user2.ID, "bob ID mismatch")
- } else if user.Email.String == "charlie@example.com" {
- assert.Equal(t, user.ID, user3.ID, "charlie ID mismatch")
- }
- }
- })
-
- t.Run("empty database", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- a := NewTest()
- a.DB = db
-
- users, err := a.GetAllUsers()
-
- assert.Equal(t, err, nil, "should not error")
- assert.Equal(t, len(users), 0, "should return 0 users")
- })
-
- t.Run("single user", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "password123")
-
- a := NewTest()
- a.DB = db
-
- users, err := a.GetAllUsers()
-
- assert.Equal(t, err, nil, "should not error")
- assert.Equal(t, len(users), 1, "should return 1 user")
- assert.Equal(t, users[0].Email.String, "alice@example.com", "email mismatch")
- assert.Equal(t, users[0].ID, user.ID, "user ID mismatch")
- })
-}
-
-func TestCreateUser(t *testing.T) {
- t.Run("success", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- a := NewTest()
- a.DB = db
- if _, err := a.CreateUser("alice@example.com", "pass1234", "pass1234"); err != nil {
- t.Fatal(errors.Wrap(err, "executing"))
- }
-
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting user")
- assert.Equal(t, userCount, int64(1), "user count mismatch")
-
- var userRecord database.User
- testutils.MustExec(t, db.First(&userRecord), "finding user")
-
- assert.Equal(t, userRecord.Email.String, "alice@example.com", "user email mismatch")
-
- passwordErr := bcrypt.CompareHashAndPassword([]byte(userRecord.Password.String), []byte("pass1234"))
- assert.Equal(t, passwordErr, nil, "Password mismatch")
- })
-
- t.Run("duplicate email", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- testutils.SetupUserData(db, "alice@example.com", "somepassword")
-
- a := NewTest()
- a.DB = db
- _, err := a.CreateUser("alice@example.com", "newpassword", "newpassword")
-
- assert.Equal(t, err, ErrDuplicateEmail, "error mismatch")
-
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting user")
-
- assert.Equal(t, userCount, int64(1), "user count mismatch")
- })
-}
-
-func TestUpdateUserPassword(t *testing.T) {
- t.Run("success", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "oldpassword123")
-
- err := UpdateUserPassword(db, &user, "newpassword123")
-
- assert.Equal(t, err, nil, "should not error")
-
- // Verify password was updated in database
- var updatedUser database.User
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&updatedUser), "finding updated user")
-
- // Verify new password works
- passwordErr := bcrypt.CompareHashAndPassword([]byte(updatedUser.Password.String), []byte("newpassword123"))
- assert.Equal(t, passwordErr, nil, "New password should match")
-
- // Verify old password no longer works
- oldPasswordErr := bcrypt.CompareHashAndPassword([]byte(updatedUser.Password.String), []byte("oldpassword123"))
- assert.NotEqual(t, oldPasswordErr, nil, "Old password should not match")
- })
-
- t.Run("password too short", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "oldpassword123")
-
- err := UpdateUserPassword(db, &user, "short")
-
- assert.Equal(t, err, ErrPasswordTooShort, "should return ErrPasswordTooShort")
-
- // Verify password was NOT updated in database
- var unchangedUser database.User
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&unchangedUser), "finding unchanged user")
-
- // Verify old password still works
- passwordErr := bcrypt.CompareHashAndPassword([]byte(unchangedUser.Password.String), []byte("oldpassword123"))
- assert.Equal(t, passwordErr, nil, "Old password should still match")
- })
-
- t.Run("empty password", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "oldpassword123")
-
- err := UpdateUserPassword(db, &user, "")
-
- assert.Equal(t, err, ErrPasswordTooShort, "should return ErrPasswordTooShort")
-
- // Verify password was NOT updated in database
- var unchangedUser database.User
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&unchangedUser), "finding unchanged user")
-
- // Verify old password still works
- passwordErr := bcrypt.CompareHashAndPassword([]byte(unchangedUser.Password.String), []byte("oldpassword123"))
- assert.Equal(t, passwordErr, nil, "Old password should still match")
- })
-
- t.Run("transaction rollback", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "oldpassword123")
-
- // Start a transaction and rollback to verify UpdateUserPassword respects transactions
- tx := db.Begin()
- err := UpdateUserPassword(tx, &user, "newpassword123")
- assert.Equal(t, err, nil, "should not error")
- tx.Rollback()
-
- // Verify password was NOT updated after rollback
- var unchangedUser database.User
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&unchangedUser), "finding unchanged user")
-
- // Verify old password still works
- passwordErr := bcrypt.CompareHashAndPassword([]byte(unchangedUser.Password.String), []byte("oldpassword123"))
- assert.Equal(t, passwordErr, nil, "Old password should still match after rollback")
- })
-
- t.Run("transaction commit", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "oldpassword123")
-
- // Start a transaction and commit to verify UpdateUserPassword respects transactions
- tx := db.Begin()
- err := UpdateUserPassword(tx, &user, "newpassword123")
- assert.Equal(t, err, nil, "should not error")
- tx.Commit()
-
- // Verify password was updated after commit
- var updatedUser database.User
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&updatedUser), "finding updated user")
-
- // Verify new password works
- passwordErr := bcrypt.CompareHashAndPassword([]byte(updatedUser.Password.String), []byte("newpassword123"))
- assert.Equal(t, passwordErr, nil, "New password should match after commit")
- })
-}
-
-func TestRemoveUser(t *testing.T) {
- t.Run("success", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- testutils.SetupUserData(db, "alice@example.com", "password123")
-
- a := NewTest()
- a.DB = db
-
- err := a.RemoveUser("alice@example.com")
-
- assert.Equal(t, err, nil, "should not error")
-
- // Verify user was deleted
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting users")
- assert.Equal(t, userCount, int64(0), "user should be deleted")
- })
-
- t.Run("user not found", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- a := NewTest()
- a.DB = db
-
- err := a.RemoveUser("nonexistent@example.com")
-
- assert.Equal(t, err, ErrNotFound, "should return ErrNotFound")
- })
-
- t.Run("user has notes", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "password123")
-
- book := database.Book{UserID: user.ID, Label: "testbook", Deleted: false}
- testutils.MustExec(t, db.Save(&book), "creating book")
-
- note := database.Note{UserID: user.ID, BookUUID: book.UUID, Body: "test note", Deleted: false}
- testutils.MustExec(t, db.Save(¬e), "creating note")
-
- a := NewTest()
- a.DB = db
-
- err := a.RemoveUser("alice@example.com")
-
- assert.Equal(t, err, ErrUserHasExistingResources, "should return ErrUserHasExistingResources")
-
- // Verify user was NOT deleted
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting users")
- assert.Equal(t, userCount, int64(1), "user should not be deleted")
-
- })
-
- t.Run("user has books", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "password123")
-
- book := database.Book{UserID: user.ID, Label: "testbook", Deleted: false}
- testutils.MustExec(t, db.Save(&book), "creating book")
-
- a := NewTest()
- a.DB = db
-
- err := a.RemoveUser("alice@example.com")
-
- assert.Equal(t, err, ErrUserHasExistingResources, "should return ErrUserHasExistingResources")
-
- // Verify user was NOT deleted
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting users")
- assert.Equal(t, userCount, int64(1), "user should not be deleted")
-
- })
-
- t.Run("user has deleted notes and books", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@example.com", "password123")
-
- book := database.Book{UserID: user.ID, Label: "testbook", Deleted: false}
- testutils.MustExec(t, db.Save(&book), "creating book")
-
- note := database.Note{UserID: user.ID, BookUUID: book.UUID, Body: "test note", Deleted: false}
- testutils.MustExec(t, db.Save(¬e), "creating note")
-
- // Soft delete the note and book
- testutils.MustExec(t, db.Model(¬e).Update("deleted", true), "soft deleting note")
- testutils.MustExec(t, db.Model(&book).Update("deleted", true), "soft deleting book")
-
- a := NewTest()
- a.DB = db
-
- err := a.RemoveUser("alice@example.com")
-
- assert.Equal(t, err, nil, "should not error when user only has deleted notes and books")
-
- // Verify user was deleted
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting users")
- assert.Equal(t, userCount, int64(0), "user should be deleted")
-
- })
-}
diff --git a/pkg/server/assets/.gitignore b/pkg/server/assets/.gitignore
deleted file mode 100644
index 7ba54dae..00000000
--- a/pkg/server/assets/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-# Ignore CSS and JS files in static directory because
-# those files are built from the sources
-
-/static/*.css
-/static/*.css.map
-/static/*.js
-/static/*.js.map
diff --git a/pkg/server/assets/embed.go b/pkg/server/assets/embed.go
deleted file mode 100644
index e0272d95..00000000
--- a/pkg/server/assets/embed.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package assets
-
-import (
- "embed"
- "github.com/pkg/errors"
- "io/fs"
-)
-
-//go:embed static
-var staticFiles embed.FS
-
-// GetStaticFS returns a filesystem for static files, with
-// all files situated in the root of the filesystem
-func GetStaticFS() (fs.FS, error) {
- subFs, err := fs.Sub(staticFiles, "static")
- if err != nil {
- return nil, errors.Wrap(err, "getting sub filesystem")
- }
-
- return subFs, nil
-}
-
-// MustGetHTTP500ErrorPage returns the content of HTML file for HTTP 500 error
-func MustGetHTTP500ErrorPage() []byte {
- ret, err := staticFiles.ReadFile("static/500.html")
- if err != nil {
- panic(errors.Wrap(err, "reading HTML file for 500 HTTP error"))
- }
-
- return ret
-}
diff --git a/pkg/server/assets/js/build.sh b/pkg/server/assets/js/build.sh
deleted file mode 100755
index f00ddf3c..00000000
--- a/pkg/server/assets/js/build.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-# build.sh builds styles
-set -ex
-
-dir=$(dirname "${BASH_SOURCE[0]}")
-basePath="$dir/../../.."
-serverDir="$dir/../.."
-outputDir="$serverDir/assets/static"
-inputDir="$dir/src"
-
-task="cp $inputDir/main.js $outputDir"
-
-
-if [[ "$1" == "true" ]]; then
-(
- cd "$basePath/watcher" && \
- go run main.go \
- --task="$task" \
- --context="$inputDir" \
- "$inputDir"
-)
-else
- eval "$task"
-fi
diff --git a/pkg/server/assets/js/src/main.js b/pkg/server/assets/js/src/main.js
deleted file mode 100644
index 9e58d92a..00000000
--- a/pkg/server/assets/js/src/main.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var getNextSibling = function (el, selector) {
- var sibling = el.nextElementSibling;
-
- if (!selector) {
- return sibling;
- }
-
- while (sibling) {
- if (sibling.matches(selector)) return sibling;
- sibling = sibling.nextElementSibling;
- }
-};
-
-var dropdownTriggerEls = document.getElementsByClassName('dropdown-trigger');
-
-for (var i = 0; i < dropdownTriggerEls.length; i++) {
- var dropdownTriggerEl = dropdownTriggerEls[i];
-
- dropdownTriggerEl.addEventListener('click', function (e) {
- var el = getNextSibling(e.target, '.dropdown-content');
-
- el.classList.toggle('show');
- });
-}
-
-// Dropdown closer
-window.onclick = function (e) {
- // Close dropdown on click outside the dropdown content or trigger
- function shouldClose(target) {
- var dropdownContentEls = document.getElementsByClassName(
- 'dropdown-content'
- );
-
- for (let i = 0; i < dropdownContentEls.length; ++i) {
- var el = dropdownContentEls[i];
- if (el.contains(target)) {
- return false;
- }
- }
- for (let i = 0; i < dropdownTriggerEls.length; ++i) {
- var el = dropdownTriggerEls[i];
- if (el.contains(target)) {
- return false;
- }
- }
-
- return true;
- }
-
- if (shouldClose(e.target)) {
- var dropdowns = document.getElementsByClassName('dropdown-content');
- for (var i = 0; i < dropdowns.length; i++) {
- var openDropdown = dropdowns[i];
- if (openDropdown.classList.contains('show')) {
- openDropdown.classList.remove('show');
- }
- }
- }
-};
diff --git a/pkg/server/assets/package-lock.json b/pkg/server/assets/package-lock.json
deleted file mode 100644
index 7eb1c411..00000000
--- a/pkg/server/assets/package-lock.json
+++ /dev/null
@@ -1,495 +0,0 @@
-{
- "name": "assets",
- "version": "1.0.0",
- "lockfileVersion": 3,
- "requires": true,
- "packages": {
- "": {
- "name": "assets",
- "version": "1.0.0",
- "license": "Apache-2.0",
- "devDependencies": {
- "sass": "^1.50.1"
- }
- },
- "node_modules/@parcel/watcher": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz",
- "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==",
- "dev": true,
- "hasInstallScript": true,
- "optional": true,
- "dependencies": {
- "detect-libc": "^1.0.3",
- "is-glob": "^4.0.3",
- "micromatch": "^4.0.5",
- "node-addon-api": "^7.0.0"
- },
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- },
- "optionalDependencies": {
- "@parcel/watcher-android-arm64": "2.5.1",
- "@parcel/watcher-darwin-arm64": "2.5.1",
- "@parcel/watcher-darwin-x64": "2.5.1",
- "@parcel/watcher-freebsd-x64": "2.5.1",
- "@parcel/watcher-linux-arm-glibc": "2.5.1",
- "@parcel/watcher-linux-arm-musl": "2.5.1",
- "@parcel/watcher-linux-arm64-glibc": "2.5.1",
- "@parcel/watcher-linux-arm64-musl": "2.5.1",
- "@parcel/watcher-linux-x64-glibc": "2.5.1",
- "@parcel/watcher-linux-x64-musl": "2.5.1",
- "@parcel/watcher-win32-arm64": "2.5.1",
- "@parcel/watcher-win32-ia32": "2.5.1",
- "@parcel/watcher-win32-x64": "2.5.1"
- }
- },
- "node_modules/@parcel/watcher-android-arm64": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz",
- "integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-darwin-arm64": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz",
- "integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-darwin-x64": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz",
- "integrity": "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-freebsd-x64": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz",
- "integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "freebsd"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-linux-arm-glibc": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz",
- "integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==",
- "cpu": [
- "arm"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-linux-arm-musl": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz",
- "integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==",
- "cpu": [
- "arm"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-linux-arm64-glibc": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz",
- "integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-linux-arm64-musl": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz",
- "integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-linux-x64-glibc": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz",
- "integrity": "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-linux-x64-musl": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz",
- "integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-win32-arm64": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz",
- "integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-win32-ia32": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz",
- "integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==",
- "cpu": [
- "ia32"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/@parcel/watcher-win32-x64": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz",
- "integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/parcel"
- }
- },
- "node_modules/braces": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
- "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
- "dev": true,
- "optional": true,
- "dependencies": {
- "fill-range": "^7.1.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/chokidar": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
- "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
- "dev": true,
- "dependencies": {
- "readdirp": "^4.0.1"
- },
- "engines": {
- "node": ">= 14.16.0"
- },
- "funding": {
- "url": "https://paulmillr.com/funding/"
- }
- },
- "node_modules/detect-libc": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
- "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==",
- "dev": true,
- "optional": true,
- "bin": {
- "detect-libc": "bin/detect-libc.js"
- },
- "engines": {
- "node": ">=0.10"
- }
- },
- "node_modules/fill-range": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
- "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
- "dev": true,
- "optional": true,
- "dependencies": {
- "to-regex-range": "^5.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/immutable": {
- "version": "5.1.5",
- "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.5.tgz",
- "integrity": "sha512-t7xcm2siw+hlUM68I+UEOK+z84RzmN59as9DZ7P1l0994DKUWV7UXBMQZVxaoMSRQ+PBZbHCOoBt7a2wxOMt+A==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/is-extglob": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
- "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
- "dev": true,
- "optional": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/is-glob": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
- "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
- "dev": true,
- "optional": true,
- "dependencies": {
- "is-extglob": "^2.1.1"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/is-number": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
- "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
- "dev": true,
- "optional": true,
- "engines": {
- "node": ">=0.12.0"
- }
- },
- "node_modules/micromatch": {
- "version": "4.0.8",
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
- "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
- "dev": true,
- "optional": true,
- "dependencies": {
- "braces": "^3.0.3",
- "picomatch": "^2.3.1"
- },
- "engines": {
- "node": ">=8.6"
- }
- },
- "node_modules/node-addon-api": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
- "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
- "dev": true,
- "optional": true
- },
- "node_modules/picomatch": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
- "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
- "dev": true,
- "optional": true,
- "engines": {
- "node": ">=8.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/jonschlinkert"
- }
- },
- "node_modules/readdirp": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
- "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
- "dev": true,
- "engines": {
- "node": ">= 14.18.0"
- },
- "funding": {
- "type": "individual",
- "url": "https://paulmillr.com/funding/"
- }
- },
- "node_modules/sass": {
- "version": "1.93.2",
- "resolved": "https://registry.npmjs.org/sass/-/sass-1.93.2.tgz",
- "integrity": "sha512-t+YPtOQHpGW1QWsh1CHQ5cPIr9lbbGZLZnbihP/D/qZj/yuV68m8qarcV17nvkOX81BCrvzAlq2klCQFZghyTg==",
- "dev": true,
- "dependencies": {
- "chokidar": "^4.0.0",
- "immutable": "^5.0.2",
- "source-map-js": ">=0.6.2 <2.0.0"
- },
- "bin": {
- "sass": "sass.js"
- },
- "engines": {
- "node": ">=14.0.0"
- },
- "optionalDependencies": {
- "@parcel/watcher": "^2.4.1"
- }
- },
- "node_modules/source-map-js": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
- "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/to-regex-range": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
- "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
- "dev": true,
- "optional": true,
- "dependencies": {
- "is-number": "^7.0.0"
- },
- "engines": {
- "node": ">=8.0"
- }
- }
- }
-}
diff --git a/pkg/server/assets/package.json b/pkg/server/assets/package.json
deleted file mode 100644
index 1561f6da..00000000
--- a/pkg/server/assets/package.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name": "assets",
- "version": "1.0.0",
- "description": "assets",
- "main": "index.js",
- "scripts": {},
- "author": "Dnote",
- "license": "Apache-2.0",
- "devDependencies": {
- "sass": "^1.50.1"
- }
-}
diff --git a/pkg/server/assets/static/500.html b/pkg/server/assets/static/500.html
deleted file mode 100644
index ccf85d20..00000000
--- a/pkg/server/assets/static/500.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
- 500
-
-
diff --git a/pkg/server/assets/styles/build.sh b/pkg/server/assets/styles/build.sh
deleted file mode 100755
index 261560d8..00000000
--- a/pkg/server/assets/styles/build.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-# build.sh builds styles
-set -ex
-
-dir=$(dirname "${BASH_SOURCE[0]}")
-serverDir="$dir/../.."
-outputDir="$serverDir/assets/static"
-inputDir="$dir/src"
-
-rm -rf "${outputDir:?}/*"
-
-"$dir/../node_modules/.bin/sass" --version
-
-task="$dir/../node_modules/.bin/sass \
- --style compressed \
- --source-map \
- $inputDir:$outputDir"
-
-# compile first then watch
-eval "$task"
-
-if [[ "$1" == "true" ]]; then
- eval "$task --watch --poll"
-fi
diff --git a/pkg/server/assets/styles/src/_books.scss b/pkg/server/assets/styles/src/_books.scss
deleted file mode 100644
index 10f9a8aa..00000000
--- a/pkg/server/assets/styles/src/_books.scss
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@use "rem";
-@use "theme";
-
-
-.books-page {
- .books-content {
- padding: rem.rem(16px) rem.rem(24px);
- margin-top: rem.rem(16px);
-
- h1 {
- border-bottom: 1px solid theme.$lighter-gray;
- margin-bottom: rem.rem(12px);
- }
- }
-}
diff --git a/pkg/server/assets/styles/src/_global.scss b/pkg/server/assets/styles/src/_global.scss
deleted file mode 100644
index 7bad7d58..00000000
--- a/pkg/server/assets/styles/src/_global.scss
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@use "font";
-@use "rem";
-@use "responsive";
-@use "theme";
-@use "variables";
-
-
-.main {
- position: relative;
- display: flex;
- flex-direction: column;
- background: theme.$lighter-gray;
- min-height: calc(100vh - #{variables.$header-height});
- // margin-bottom: $footer-height;
-
- &.nofooter {
- margin-bottom: 0;
- }
-
- &.noheader:not(.nofooter) {
- min-height: calc(100vh - #{variables.$footer-height});
- }
- &.nofooter:not(.noheader) {
- min-height: calc(100vh - #{variables.$header-height});
- }
- &.nofooter.noheader {
- min-height: 100vh;
- }
-
- @include responsive.breakpoint(lg) {
- margin-bottom: 0;
- min-height: calc(100vh - #{variables.$header-height});
- }
-}
-
-/* partials */
-.partial--time {
- color: theme.$gray;
- @include font.font-size('small');
-
- .mobile-text {
- @include responsive.breakpoint(md) {
- display: none;
- }
- }
- .text {
- display: none;
-
- @include responsive.breakpoint(md) {
- display: inherit;
- }
- }
-}
-
-.partial--page-toolbar {
- @include responsive.breakpoint(lg) {
- height: rem.rem(48px);
- border-radius: rem.rem(4px);
- background: theme.$light;
- box-shadow: 0 0 8px rgba(0, 0, 0, 0.14);
-
- &.bottom {
- margin-top: rem.rem(12px);
- }
- }
-}
-
-/* icons */
-.icon--caret-right {
- transform: rotate(-90deg);
-}
-
-.icon--caret-left {
- transform: rotate(90deg);
-}
-
-// was originally used in note show
-.frame {
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
- background: white;
-
- &.collapsed {
- .book-label {
- // control the coloro of ellipsis when overflown
- // color: $light-gray;
- }
-
- .book-label a {
- // color: $light-gray;
- }
- }
-}
diff --git a/pkg/server/assets/styles/src/_header.scss b/pkg/server/assets/styles/src/_header.scss
deleted file mode 100644
index 28374fb7..00000000
--- a/pkg/server/assets/styles/src/_header.scss
+++ /dev/null
@@ -1,211 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@use "sass:color";
-@use 'theme';
-@use 'variables';
-@use "font";
-@use "rem";
-@use "responsive";
-
-.header-wrapper {
- padding: 0;
- z-index: 2;
- position: relative;
- display: flex;
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
- background: theme.$first;
- align-items: stretch;
- justify-content: space-between;
- flex: 1;
- flex-direction: column;
- position: sticky;
- top: 0;
- z-index: 4;
- height: variables.$header-height;
-
- .container {
- height: 100%;
- }
-
- @include responsive.breakpoint(md) {
- flex-direction: row;
- }
-
- .header-content {
- display: flex;
- justify-content: space-between;
- height: 100%;
- }
-
- .left {
- display: flex;
- }
-
- .right {
- display: flex;
- }
-
- .search-wrapper {
- align-items: center;
- display: flex;
- margin-left: rem.rem(32px);
- }
-
- .search-input {
- width: rem.rem(356px);
- border: 0;
- padding: 4px 12px;
- border-radius: rem.rem(4px);
- @include font.font-size('small');
- }
-
- .brand {
- display: flex;
- align-items: center;
-
- &:hover {
- text-decoration: none;
- }
- }
-
- .main-nav {
- margin-left: rem.rem(32px);
- display: flex;
-
- .list {
- display: flex;
- }
-
- .item {
- display: flex;
- align-items: stretch;
- }
-
- .nav-link {
- @include font.font-size('small');
- display: flex;
- font-weight: 600;
- align-items: center;
- padding: 0 rem.rem(16px);
- color: theme.$white;
-
- &:hover {
- color: theme.$white;
- text-decoration: none;
- background: color.adjust(theme.$first, $lightness: 10%);
- }
- }
-
- .nav-item {
- @include font.font-size('small');
- font-weight: 600;
- }
- }
-
- .dropdown-trigger {
- color: white;
- padding: 16px;
- font-size: 16px;
- border: none;
- cursor: pointer;
- }
-
- .dropdown {
- position: relative;
- display: inline-block;
- }
-
- .dropdown-content {
- display: none;
- position: absolute;
- background-color: #f1f1f1;
- width: rem.rem(240px);
- background: #fff;
- border: 1px solid #d8d8d8;
- border-radius: 4px;
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
- top: calc(100% + 4px);
- z-index: 1;
-
- &.show {
- display: block;
- }
-
- &.right-align {
- right: 0;
- }
- }
-
- .account-dropdown {
- .dropdown-trigger {
- height: 100%;
- }
-
- .account-dropdown-header {
- @include font.font-size('small');
- color: theme.$light-gray;
- padding: rem.rem(8px) rem.rem(12px);
- display: block;
- margin-bottom: 0;
- white-space: nowrap;
-
- svg {
- fill: theme.$light-gray;
- }
-
- .email {
- font-weight: 600;
- white-space: normal;
- word-break: break-all;
- }
- }
-
- .dropdown-link {
- @include font.font-size('small');
- white-space: pre;
- padding: rem.rem(8px) rem.rem(14px);
- width: 100%;
- display: block;
- color: black;
-
- &:hover {
- background: theme.$lighter-gray;
- text-decoration: none;
- color: #0056b3;
- }
-
- &.disabled {
- color: #d4d4d4;
- cursor: not-allowed;
- }
-
- &:not(.disabled):focus {
- background: theme.$lighter-gray;
- color: #0056b3;
- outline: 1px dotted gray;
- }
- }
-
- .session-notice-wrapper {
- display: flex;
- align-items: center;
- }
-
- .session-notice {
- margin-left: rem.rem(4px);
- }
- }
-}
diff --git a/pkg/server/assets/styles/src/_home.scss b/pkg/server/assets/styles/src/_home.scss
deleted file mode 100644
index 6ec13eaa..00000000
--- a/pkg/server/assets/styles/src/_home.scss
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@use 'theme';
-@use 'font';
-@use "rem";
-@use "responsive";
-
-.home-page {
- .note-group-list {
- flex-grow: 1;
-
- @include responsive.breakpoint(lg) {
- margin-top: rem.rem(16px);
- }
-
- .note-group-list-empty {
- padding: rem.rem(40px) rem.rem(16px);
- text-align: center;
- color: theme.$gray;
- }
- }
-
- .note-group {
- position: relative;
- border-radius: 4px;
- box-shadow: 0 0 8px rgba(0, 0, 0, 0.14);
-
- &:not(:first-of-type) {
- margin-top: rem.rem(20px);
-
- @include responsive.breakpoint(md) {
- margin-top: rem.rem(24px);
- }
- }
-
- .note-group-header {
- @include font.font-size('small');
- display: flex;
- justify-content: space-between;
- color: white;
- padding: rem.rem(12px) rem.rem(16px);
- background: theme.$light;
- color: theme.$black;
- border-bottom: 1px solid theme.$border-color;
- border-top-left-radius: 4px;
- border-top-right-radius: 4px;
- }
-
- .date {
- font-weight: 600;
- @include font.font-size('small');
- }
-
- .mask {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- background: white;
- z-index: 1;
- opacity: 0.8;
- }
-
- .header-date {
- font-weight: 600;
- @include font.font-size('regular');
- }
- .header-count {
- font-weight: 300;
- }
-
- .list {
- list-style: none;
- padding-left: 0;
- margin-bottom: 0;
- }
- }
-
- .note-list {
- list-style: none;
- padding-left: 0;
- margin-bottom: 0;
- }
-
- .note-item {
- background: white;
- position: relative;
-
- border-bottom: 1px solid theme.$border-color;
-
- .link {
- color: theme.$black;
- display: block;
- padding: rem.rem(12px) rem.rem(16px);
- border: 2px solid transparent;
-
- &:hover {
- text-decoration: none;
- background: theme.$light-blue;
- color: inherit;
- }
- }
-
- .meta {
- line-height: rem.rem(16px);
- }
-
- .body {
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- .note-header {
- display: flex;
- justify-content: space-between;
- }
-
- .note-content {
- margin-top: rem.rem(12px);
- line-height: 1.6rem;
- overflow: hidden;
- text-overflow: ellipsis;
- color: theme.$gray;
- }
-
- .book-label {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-weight: 700;
- @include font.font-size('small');
-
- width: 212px;
-
- @include responsive.breakpoint('md') {
- width: 320px;
- }
- }
-
- .match {
- display: inline-block;
- background: #f7f77d;
- padding: rem.rem(4px) rem.rem(4px);
- }
- }
-
- .toolbar {
- text-align: right;
- }
-
- .paginator {
- display: inline-flex;
- align-items: center;
-
- .paginator-info {
- @include font.font-size('small');
- color: theme.$gray;
- }
-
- .paginator-link {
- padding: rem.rem(12px) rem.rem(12px);
-
- &.disabled {
- cursor: not-allowed;
- }
- }
-
- .paginator-link-prev {
- margin-left: rem.rem(8px);
-
- @include responsive.breakpoint(md) {
- margin-left: rem.rem(20px);
- }
- }
-
- .caret-next {
- transform: rotate(-90deg);
- }
-
- .caret-prev {
- transform: rotate(90deg);
- }
-
- .paginator-label {
- font-weight: 600;
- }
- }
-}
diff --git a/pkg/server/assets/styles/src/_login.scss b/pkg/server/assets/styles/src/_login.scss
deleted file mode 100644
index 1b8bfa97..00000000
--- a/pkg/server/assets/styles/src/_login.scss
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@use 'theme';
-@use 'font';
-@use "rem";
-
-.auth-page {
- background: theme.$lighter-gray;
- text-align: center;
- min-height: 100vh;
- padding: 50px 0;
-
- .auth-button {
- margin-top: 8px;
- }
-
- .heading {
- color: theme.$black;
- @include font.font-size('2x-large');
- font-weight: 300;
- margin-top: 12px;
- margin-bottom: 0;
- }
-
- .body {
- max-width: 420px;
- margin-left: auto;
- margin-right: auto;
- margin-top: 20px;
- }
-
- .referrer-flash {
- margin: 24px 0;
- }
- .error-flash {
- margin-bottom: 24px;
- }
-
- .footer {
- margin-top: 20px;
- line-height: 20px;
- }
-
- .callout {
- color: #7c7c7c;
- @include font.font-size('small');
- }
- .cta {
- @include font.font-size('small');
- }
-
- .panel {
- border: 1px solid theme.$border-color;
- background: theme.$white;
- border-radius: 2px;
- padding: 20px;
- text-align: left;
- }
-
- .auth-button {
- margin-top: 16px;
- }
-
- .input-row {
- & ~ .input-row {
- margin-top: 12px;
- }
- }
- .label {
- @include font.font-size('small');
- font-weight: 600;
- width: 100%;
- margin-bottom: 0;
- }
-
- .forgot {
- @include font.font-size('small');
- float: right;
- font-weight: 400;
- }
-
- &.password-reset-page {
- .email-input {
- margin-top: rem.rem(16px);
- }
- }
-
- .alert {
- margin-bottom: 1rem;
- }
-}
diff --git a/pkg/server/assets/styles/src/_marker.scss b/pkg/server/assets/styles/src/_marker.scss
deleted file mode 100644
index db583dd2..00000000
--- a/pkg/server/assets/styles/src/_marker.scss
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.marker {
- display: inline-block;
- padding: 0.25em 0.4em;
- font-size: 75%;
- font-weight: 700;
- line-height: 1;
- text-align: center;
- white-space: nowrap;
- vertical-align: baseline;
- border-radius: 0.25rem;
-}
-
-.marker-first {
- color: #fff;
- background-color: #007bff;
-}
-
-.marker-info {
- color: #fff;
- background-color: #17a2b8;
-}
diff --git a/pkg/server/assets/styles/src/_note.scss b/pkg/server/assets/styles/src/_note.scss
deleted file mode 100644
index 87f6e790..00000000
--- a/pkg/server/assets/styles/src/_note.scss
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@use "font";
-@use "rem";
-@use "responsive";
-@use "theme";
-
-
-.note-page {
- // min-height: calc(100vh - 57px);
- background: theme.$lighter-gray;
- flex-grow: 1;
- flex-basis: 0;
-
- // .inner {
- // display: flex;
- // justify-content: center;
- // padding-top: rem(40px);
- // padding-bottom: rem(40px);
- //
- // @include breakpoint(md) {
- // padding-top: rem(52px);
- // padding-bottom: rem(52px);
- // }
- // }
-
- .header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: rem.rem(12px) rem.rem(16px);
- border-bottom: 1px solid theme.$border-color;
- }
- .header-left,
- .header-right {
- display: flex;
- align-items: center;
- }
-
- .book-icon {
- vertical-align: middle;
- }
-
- .content-wrapper {
- padding: rem.rem(12px) rem.rem(16px);
- }
-
- .collapsed-content {
- color: theme.$light-gray;
- }
-
- .footer {
- display: flex;
- justify-content: space-between;
- align-items: center;
- @include font.font-size('small');
- padding: rem.rem(12px) rem.rem(16px);
- }
-
- .ts {
- color: theme.$light-gray;
- }
- .ts-lead {
- display: none;
- @include responsive.breakpoint(md) {
- display: inline;
- }
- }
-
- .match {
- display: inline-block;
- background: #f7f77d;
- }
-
- .book-label {
- @include font.font-size('medium');
- font-weight: 600;
- display: inline-block;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: theme.$black;
-
- a {
- color: inherit;
-
- &:hover {
- color: inherit;
- }
- }
- }
-
- // header
- .header {
- .book-label {
- max-width: rem.rem(200px);
- margin-left: rem.rem(12px);
-
- @include responsive.breakpoint(sm) {
- max-width: rem.rem(200px);
- }
- @include responsive.breakpoint(md) {
- max-width: rem.rem(420px);
- }
- @include responsive.breakpoint(lg) {
- max-width: rem.rem(600px);
- }
- }
- }
-}
diff --git a/pkg/server/assets/styles/src/_responsive.scss b/pkg/server/assets/styles/src/_responsive.scss
deleted file mode 100644
index 2ebbf0ab..00000000
--- a/pkg/server/assets/styles/src/_responsive.scss
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@use 'variables';
-
-@mixin breakpoint($point) {
- @if $point == xl {
- @media (min-width: variables.$xl-breakpoint) {
- @content;
- }
- } @else if $point == lg {
- @media (min-width: variables.$lg-breakpoint) {
- @content;
- }
- } @else if $point == md {
- @media (min-width: variables.$md-breakpoint) {
- @content;
- }
- } @else if $point == sm {
- @media (min-width: variables.$sm-breakpoint) {
- @content;
- }
- } @else if $point == smonly {
- @media (min-width: variables.$sm-breakpoint) and (max-width: variables.$md-breakpoint - 1px) {
- @content;
- }
- } @else if $point == smdown {
- @media (max-width: variables.$md-breakpoint - 1px) {
- @content;
- }
- } @else if $point == mdonly {
- @media (min-width: variables.$md-breakpoint) and (max-width: variables.$lg-breakpoint - 1px) {
- @content;
- }
- } @else if $point == mddown {
- @media (max-width: variables.$lg-breakpoint - 1px) {
- @content;
- }
- }
-}
-
-// landscape is the mobile landscape mode
-@mixin landscape() {
- @media (max-height: 400px) {
- @content;
- }
-}
diff --git a/pkg/server/assets/styles/src/_settings.scss b/pkg/server/assets/styles/src/_settings.scss
deleted file mode 100644
index a965ecbb..00000000
--- a/pkg/server/assets/styles/src/_settings.scss
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@use 'theme';
-@use 'font';
-@use "rem";
-@use "responsive";
-
-.settings-page {
- .sidebar {
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
- background: white;
- margin-bottom: rem.rem(20px);
- margin-top: rem.rem(20px);
-
- @include responsive.breakpoint(lg) {
- margin-bottom: 0;
- margin-top: 0;
- }
- }
-
- .sidebar-item {
- display: block;
- padding: rem.rem(12px) rem.rem(16px);
- border-left: 4px solid transparent;
- @include font.font-size('regular');
-
- &:hover {
- text-decoration: none;
- background: theme.$light;
- }
-
- &.active {
- font-weight: 600;
- border-left-color: theme.$first;
- }
- }
-
- .setting-section-wrapper {
- .header {
- @include responsive.breakpoint(lg) {
- display: none;
- }
- }
-
- .setting-section {
- margin-top: rem.rem(24px);
- background: white;
- box-shadow: 0 0 8px rgba(0, 0, 0, 0.14);
-
- &:first-child {
- margin-top: 0;
- }
- }
-
- .section-heading {
- @include font.font-size('regular');
- font-weight: 600;
- padding-bottom: rem.rem(4px);
- background: theme.$light;
- padding: rem.rem(16px) rem.rem(20px);
- }
- .section-content {
- margin-top: rem.rem(20px);
- }
-
- .actions {
- margin-top: rem.rem(18px);
- text-align: right;
- }
- }
-
- .setting-row {
- padding: rem.rem(16px) rem.rem(20px);
-
- &:not(:last-child) {
- border-bottom: 1px solid theme.$border-color;
- }
-
- .setting-row-summary {
- display: flex;
- flex-direction: column;
- // align-items: flex-start;
-
- @include responsive.breakpoint(md) {
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- }
- }
-
- .setting-row-main {
- padding-top: rem.rem(24px);
- }
-
- .setting-name {
- font-weight: 400;
- @include font.font-size('regular');
- margin-bottom: 0;
- }
- .setting-desc {
- margin-bottom: 0;
- @include font.font-size('small');
- color: theme.$gray;
- }
- .setting-action {
- display: flex;
- flex-direction: column;
-
- @include responsive.breakpoint(md) {
- flex-direction: row;
- }
- }
-
- .setting-right {
- display: flex;
- word-break: break-all;
- justify-content: space-between;
- align-items: center;
- margin-top: rem.rem(4px);
-
- @include responsive.breakpoint(md) {
- flex-direction: row;
- align-items: center;
- margin-top: 0;
- }
- }
-
- .setting-edit {
- color: theme.$link;
- padding: 0;
-
- &:hover {
- color: theme.$link-hover;
- }
- @include responsive.breakpoint(md) {
- margin-left: rem.rem(16px);
- }
- }
-
- .input-row {
- & ~ .input-row,
- .input-row {
- margin-top: rem.rem(12px);
- }
- }
- }
-
- .email-verification-form {
- margin-left: rem.rem(12px);
- }
-}
diff --git a/pkg/server/assets/styles/src/_theme.scss b/pkg/server/assets/styles/src/_theme.scss
deleted file mode 100644
index 5654cb7a..00000000
--- a/pkg/server/assets/styles/src/_theme.scss
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@use "sass:color";
-
-// basic colors
-$black: #2a2a2a;
-$white: #ffffff;
-$light: #f7f9fa;
-$gray: #686868;
-$light-gray: #8c8c8c;
-$lighter-gray: #f3f3f3;
-$dark-gray: #637283;
-
-// primary colors
-$first: #333745;
-$second: #e7e7e7;
-$third: #0a4b73;
-
-// functional colors
-$border-color: #d8d8d8;
-$border-color-light: $lighter-gray;
-
-$link: #6f53c0;
-$link-hover: color.adjust($link, $lightness: -5%);
-
-$danger-text: #cb2431;
-$danger-background: #f8d7da;
-
-$blue: #0668d7;
-$light-blue: #ecf4ff;
-$green: #28a755;
-
-$active: #49abfd;
diff --git a/pkg/server/assets/styles/src/_variables.scss b/pkg/server/assets/styles/src/_variables.scss
deleted file mode 100644
index 490d9dbb..00000000
--- a/pkg/server/assets/styles/src/_variables.scss
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$header-height: 60px;
-$footer-height: 56px;
-
-// breakpoints
-$xl-breakpoint: 1441px;
-$lg-breakpoint: 992px;
-$md-breakpoint: 576px;
-$sm-breakpoint: 321px;
-
-:export {
- mdBreakpoint: $md-breakpoint;
- smBreakpoint: $sm-breakpoint;
-}
diff --git a/pkg/server/buildinfo/info.go b/pkg/server/buildinfo/info.go
deleted file mode 100644
index 4e6661f8..00000000
--- a/pkg/server/buildinfo/info.go
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package buildinfo
-
-var (
- // Version is the server version
- Version = "master"
- // CSSFiles is the css files
- CSSFiles = ""
- // JSFiles is the js files
- JSFiles = ""
- // RootURL is the root url
- RootURL = "/"
- // Standalone reprsents whether the build is for on-premises. It is a string
- // rather than a boolean, so that it can be overridden during compile time.
- Standalone = "false"
-)
diff --git a/pkg/server/cmd/helpers.go b/pkg/server/cmd/helpers.go
deleted file mode 100644
index ba90a7ce..00000000
--- a/pkg/server/cmd/helpers.go
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cmd
-
-import (
- "flag"
- "fmt"
- "os"
-
- "github.com/dnote/dnote/pkg/clock"
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/config"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/log"
- "github.com/dnote/dnote/pkg/server/mailer"
- "gorm.io/gorm"
-)
-
-func initDB(dbPath string) *gorm.DB {
- db := database.Open(dbPath)
- database.InitSchema(db)
- database.Migrate(db)
-
- return db
-}
-
-func getEmailBackend() mailer.Backend {
- defaultBackend, err := mailer.NewDefaultBackend()
- if err != nil {
- log.Debug("SMTP not configured, using StdoutBackend for emails")
- return mailer.NewStdoutBackend()
- }
-
- log.Debug("Email backend configured")
- return defaultBackend
-}
-
-func initApp(cfg config.Config) app.App {
- db := initDB(cfg.DBPath)
- emailBackend := getEmailBackend()
-
- return app.App{
- DB: db,
- Clock: clock.New(),
- EmailBackend: emailBackend,
- HTTP500Page: cfg.HTTP500Page,
- BaseURL: cfg.BaseURL,
- DisableRegistration: cfg.DisableRegistration,
- Port: cfg.Port,
- DBPath: cfg.DBPath,
- AssetBaseURL: cfg.AssetBaseURL,
- }
-}
-
-// printFlags prints flags with -- prefix for consistency with CLI
-func printFlags(fs *flag.FlagSet) {
- fs.VisitAll(func(f *flag.Flag) {
- fmt.Printf(" --%s", f.Name)
-
- // Print type hint for non-boolean flags
- name, usage := flag.UnquoteUsage(f)
- if name != "" {
- fmt.Printf(" %s", name)
- }
- fmt.Println()
-
- // Print usage description with indentation
- if usage != "" {
- fmt.Printf(" \t%s", usage)
- if f.DefValue != "" && f.DefValue != "false" {
- fmt.Printf(" (default: %s)", f.DefValue)
- }
- fmt.Println()
- }
- })
-}
-
-// setupFlagSet creates a FlagSet with standard usage format
-func setupFlagSet(name, usageCmd string) *flag.FlagSet {
- fs := flag.NewFlagSet(name, flag.ExitOnError)
- fs.Usage = func() {
- fmt.Printf(`Usage:
- %s [flags]
-
-Flags:
-`, usageCmd)
- printFlags(fs)
- }
- return fs
-}
-
-// requireString validates that a required string flag is not empty
-func requireString(fs *flag.FlagSet, value, fieldName string) {
- if value == "" {
- fmt.Printf("Error: %s is required\n", fieldName)
- fs.Usage()
- os.Exit(1)
- }
-}
-
-// createApp creates config, initializes app, and returns cleanup function
-func createApp(fs *flag.FlagSet, dbPath string) (*app.App, func()) {
- cfg, err := config.New(config.Params{
- DBPath: dbPath,
- })
- if err != nil {
- fmt.Printf("Error: %s\n\n", err)
- fs.Usage()
- os.Exit(1)
- }
-
- a := initApp(cfg)
- cleanup := func() {
- sqlDB, err := a.DB.DB()
- if err == nil {
- sqlDB.Close()
- }
- }
-
- return &a, cleanup
-}
diff --git a/pkg/server/cmd/root.go b/pkg/server/cmd/root.go
deleted file mode 100644
index 106ab2d9..00000000
--- a/pkg/server/cmd/root.go
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cmd
-
-import (
- "fmt"
- "os"
-)
-
-func rootCmd() {
- fmt.Printf(`Dnote server - a simple command line notebook
-
-Usage:
- dnote-server [command] [flags]
-
-Available commands:
- start: Start the server (use 'dnote-server start --help' for flags)
- user: Manage users (use 'dnote-server user' for subcommands)
- version: Print the version
-`)
-}
-
-// Execute is the main entry point for the CLI
-func Execute() {
- if len(os.Args) < 2 {
- rootCmd()
- return
- }
-
- cmd := os.Args[1]
-
- switch cmd {
- case "start":
- startCmd(os.Args[2:])
- case "user":
- userCmd(os.Args[2:])
- case "version":
- versionCmd()
- default:
- fmt.Printf("Unknown command %s\n", cmd)
- rootCmd()
- os.Exit(1)
- }
-}
diff --git a/pkg/server/cmd/start.go b/pkg/server/cmd/start.go
deleted file mode 100644
index 0a4e5292..00000000
--- a/pkg/server/cmd/start.go
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cmd
-
-import (
- "fmt"
- "net/http"
- "os"
- "time"
-
- "github.com/dnote/dnote/pkg/server/buildinfo"
- "github.com/dnote/dnote/pkg/server/config"
- "github.com/dnote/dnote/pkg/server/controllers"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/log"
- "github.com/pkg/errors"
-)
-
-func startCmd(args []string) {
- fs := setupFlagSet("start", "dnote-server start")
-
- port := fs.String("port", "", "Server port (env: PORT, default: 3001)")
- baseURL := fs.String("baseUrl", "", "Full URL to server without trailing slash (env: BaseURL, default: http://localhost:3001)")
- dbPath := fs.String("dbPath", "", "Path to SQLite database file (env: DBPath, default: $XDG_DATA_HOME/dnote/server.db)")
- disableRegistration := fs.Bool("disableRegistration", false, "Disable user registration (env: DisableRegistration, default: false)")
- logLevel := fs.String("logLevel", "", "Log level: debug, info, warn, or error (env: LOG_LEVEL, default: info)")
-
- fs.Parse(args)
-
- cfg, err := config.New(config.Params{
- Port: *port,
- BaseURL: *baseURL,
- DBPath: *dbPath,
- DisableRegistration: *disableRegistration,
- LogLevel: *logLevel,
- })
- if err != nil {
- fmt.Printf("Error: %s\n\n", err)
- fs.Usage()
- os.Exit(1)
- }
-
- // Set log level
- log.SetLevel(cfg.LogLevel)
-
- app := initApp(cfg)
- defer func() {
- sqlDB, err := app.DB.DB()
- if err == nil {
- sqlDB.Close()
- }
- }()
-
- // Start WAL checkpointing to prevent WAL file from growing unbounded.
- database.StartWALCheckpointing(app.DB, 5*time.Minute)
-
- // Start periodic VACUUM to reclaim space and defragment database.
- database.StartPeriodicVacuum(app.DB, 24*time.Hour)
-
- ctl := controllers.New(&app)
- rc := controllers.RouteConfig{
- WebRoutes: controllers.NewWebRoutes(&app, ctl),
- APIRoutes: controllers.NewAPIRoutes(&app, ctl),
- Controllers: ctl,
- }
-
- r, err := controllers.NewRouter(&app, rc)
- if err != nil {
- panic(errors.Wrap(err, "initializing router"))
- }
-
- log.WithFields(log.Fields{
- "version": buildinfo.Version,
- "port": cfg.Port,
- }).Info("Dnote server starting")
-
- if err := http.ListenAndServe(fmt.Sprintf(":%s", cfg.Port), r); err != nil {
- log.ErrorWrap(err, "server failed")
- os.Exit(1)
- }
-}
diff --git a/pkg/server/cmd/user.go b/pkg/server/cmd/user.go
deleted file mode 100644
index 7a98344d..00000000
--- a/pkg/server/cmd/user.go
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cmd
-
-import (
- "fmt"
- "io"
- "os"
-
- "github.com/dnote/dnote/pkg/prompt"
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/log"
- "github.com/pkg/errors"
-)
-
-// confirm prompts for user input to confirm a choice
-func confirm(r io.Reader, question string, optimistic bool) (bool, error) {
- message := prompt.FormatQuestion(question, optimistic)
- fmt.Print(message + " ")
-
- confirmed, err := prompt.ReadYesNo(r, optimistic)
- if err != nil {
- return false, errors.Wrap(err, "reading stdin")
- }
-
- return confirmed, nil
-}
-
-func userCreateCmd(args []string) {
- fs := setupFlagSet("create", "dnote-server user create")
-
- email := fs.String("email", "", "User email address (required)")
- password := fs.String("password", "", "User password (required)")
- dbPath := fs.String("dbPath", "", "Path to SQLite database file (env: DBPath, default: $XDG_DATA_HOME/dnote/server.db)")
-
- fs.Parse(args)
-
- requireString(fs, *email, "email")
- requireString(fs, *password, "password")
-
- a, cleanup := createApp(fs, *dbPath)
- defer cleanup()
-
- _, err := a.CreateUser(*email, *password, *password)
- if err != nil {
- log.ErrorWrap(err, "creating user")
- os.Exit(1)
- }
-
- fmt.Printf("User created successfully\n")
- fmt.Printf("Email: %s\n", *email)
-}
-
-func userRemoveCmd(args []string, stdin io.Reader) {
- fs := setupFlagSet("remove", "dnote-server user remove")
-
- email := fs.String("email", "", "User email address (required)")
- dbPath := fs.String("dbPath", "", "Path to SQLite database file (env: DBPath, default: $XDG_DATA_HOME/dnote/server.db)")
-
- fs.Parse(args)
-
- requireString(fs, *email, "email")
-
- a, cleanup := createApp(fs, *dbPath)
- defer cleanup()
-
- // Check if user exists first
- _, err := a.GetUserByEmail(*email)
- if err != nil {
- if errors.Is(err, app.ErrNotFound) {
- fmt.Printf("Error: user with email %s not found\n", *email)
- } else {
- log.ErrorWrap(err, "finding user")
- }
- os.Exit(1)
- }
-
- // Show confirmation prompt
- ok, err := confirm(stdin, fmt.Sprintf("Remove user %s?", *email), false)
- if err != nil {
- log.ErrorWrap(err, "getting confirmation")
- os.Exit(1)
- }
- if !ok {
- fmt.Println("Aborted by user")
- os.Exit(0)
- }
-
- // Remove the user
- if err := a.RemoveUser(*email); err != nil {
- if errors.Is(err, app.ErrNotFound) {
- fmt.Printf("Error: user with email %s not found\n", *email)
- } else if errors.Is(err, app.ErrUserHasExistingResources) {
- fmt.Printf("Error: %s\n", err)
- } else {
- log.ErrorWrap(err, "removing user")
- }
- os.Exit(1)
- }
-
- fmt.Printf("User removed successfully\n")
- fmt.Printf("Email: %s\n", *email)
-}
-
-func userResetPasswordCmd(args []string) {
- fs := setupFlagSet("reset-password", "dnote-server user reset-password")
-
- email := fs.String("email", "", "User email address (required)")
- password := fs.String("password", "", "New password (required)")
- dbPath := fs.String("dbPath", "", "Path to SQLite database file (env: DBPath, default: $XDG_DATA_HOME/dnote/server.db)")
-
- fs.Parse(args)
-
- requireString(fs, *email, "email")
- requireString(fs, *password, "password")
-
- a, cleanup := createApp(fs, *dbPath)
- defer cleanup()
-
- // Find the user
- user, err := a.GetUserByEmail(*email)
- if err != nil {
- if errors.Is(err, app.ErrNotFound) {
- fmt.Printf("Error: user with email %s not found\n", *email)
- } else {
- log.ErrorWrap(err, "finding user")
- }
- os.Exit(1)
- }
-
- // Update the password
- if err := app.UpdateUserPassword(a.DB, user, *password); err != nil {
- log.ErrorWrap(err, "updating password")
- os.Exit(1)
- }
-
- fmt.Printf("Password reset successfully\n")
- fmt.Printf("Email: %s\n", *email)
-}
-
-func userListCmd(args []string, output io.Writer) {
- fs := setupFlagSet("list", "dnote-server user list")
-
- dbPath := fs.String("dbPath", "", "Path to SQLite database file (env: DBPath, default: $XDG_DATA_HOME/dnote/server.db)")
-
- fs.Parse(args)
-
- a, cleanup := createApp(fs, *dbPath)
- defer cleanup()
-
- users, err := a.GetAllUsers()
- if err != nil {
- log.ErrorWrap(err, "listing users")
- os.Exit(1)
- }
-
- for _, user := range users {
- fmt.Fprintf(output, "%s,%s,%s\n", user.UUID, user.Email.String, user.CreatedAt.UTC().Format("2006-01-02T15:04:05Z"))
- }
-}
-
-func userCmd(args []string) {
- if len(args) < 1 {
- fmt.Println(`Usage:
- dnote-server user [command]
-
-Available commands:
- create: Create a new user
- list: List all users
- remove: Remove a user
- reset-password: Reset a user's password`)
- os.Exit(1)
- }
-
- subcommand := args[0]
- subArgs := []string{}
- if len(args) > 1 {
- subArgs = args[1:]
- }
-
- switch subcommand {
- case "create":
- userCreateCmd(subArgs)
- case "list":
- userListCmd(subArgs, os.Stdout)
- case "remove":
- userRemoveCmd(subArgs, os.Stdin)
- case "reset-password":
- userResetPasswordCmd(subArgs)
- default:
- fmt.Printf("Unknown subcommand: %s\n\n", subcommand)
- fmt.Println(`Available commands:
- create: Create a new user
- list: List all users
- remove: Remove a user (only if they have no notes or books)
- reset-password: Reset a user's password`)
- os.Exit(1)
- }
-}
diff --git a/pkg/server/cmd/user_test.go b/pkg/server/cmd/user_test.go
deleted file mode 100644
index 84e5f4de..00000000
--- a/pkg/server/cmd/user_test.go
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cmd
-
-import (
- "bytes"
- "fmt"
- "strings"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/testutils"
- "golang.org/x/crypto/bcrypt"
-)
-
-func TestUserCreateCmd(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- // Call the function directly
- userCreateCmd([]string{"--dbPath", tmpDB, "--email", "test@example.com", "--password", "password123"})
-
- // Verify user was created in database
- db := testutils.InitDB(tmpDB)
- defer func() {
- sqlDB, _ := db.DB()
- sqlDB.Close()
- }()
-
- var count int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&count), "counting users")
- assert.Equal(t, count, int64(1), "should have 1 user")
-
- var user database.User
- testutils.MustExec(t, db.Where("email = ?", "test@example.com").First(&user), "finding user")
- assert.Equal(t, user.Email.String, "test@example.com", "email mismatch")
-}
-
-func TestUserRemoveCmd(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- // Create a user first
- db := testutils.InitDB(tmpDB)
- testutils.SetupUserData(db, "test@example.com", "password123")
- sqlDB, _ := db.DB()
- sqlDB.Close()
-
- // Remove the user with mock stdin that responds "y"
- mockStdin := strings.NewReader("y\n")
- userRemoveCmd([]string{"--dbPath", tmpDB, "--email", "test@example.com"}, mockStdin)
-
- // Verify user was removed
- db2 := testutils.InitDB(tmpDB)
- defer func() {
- sqlDB2, _ := db2.DB()
- sqlDB2.Close()
- }()
-
- var count int64
- testutils.MustExec(t, db2.Model(&database.User{}).Count(&count), "counting users")
- assert.Equal(t, count, int64(0), "should have 0 users")
-}
-
-func TestUserResetPasswordCmd(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- // Create a user first
- db := testutils.InitDB(tmpDB)
- user := testutils.SetupUserData(db, "test@example.com", "oldpassword123")
- oldPasswordHash := user.Password.String
- sqlDB, _ := db.DB()
- sqlDB.Close()
-
- // Reset password
- userResetPasswordCmd([]string{"--dbPath", tmpDB, "--email", "test@example.com", "--password", "newpassword123"})
-
- // Verify password was changed
- db2 := testutils.InitDB(tmpDB)
- defer func() {
- sqlDB2, _ := db2.DB()
- sqlDB2.Close()
- }()
-
- var updatedUser database.User
- testutils.MustExec(t, db2.Where("email = ?", "test@example.com").First(&updatedUser), "finding user")
-
- // Verify password hash changed
- assert.Equal(t, updatedUser.Password.String != oldPasswordHash, true, "password hash should be different")
- assert.Equal(t, len(updatedUser.Password.String) > 0, true, "password should be set")
-
- // Verify new password works
- err := bcrypt.CompareHashAndPassword([]byte(updatedUser.Password.String), []byte("newpassword123"))
- assert.Equal(t, err, nil, "new password should match")
-
- // Verify old password doesn't work
- err = bcrypt.CompareHashAndPassword([]byte(updatedUser.Password.String), []byte("oldpassword123"))
- assert.Equal(t, err != nil, true, "old password should not match")
-}
-
-func TestUserListCmd(t *testing.T) {
- t.Run("multiple users", func(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- // Create multiple users
- db := testutils.InitDB(tmpDB)
- user1 := testutils.SetupUserData(db, "alice@example.com", "password123")
- user2 := testutils.SetupUserData(db, "bob@example.com", "password123")
- user3 := testutils.SetupUserData(db, "charlie@example.com", "password123")
- sqlDB, _ := db.DB()
- sqlDB.Close()
-
- // Capture output
- var buf bytes.Buffer
- userListCmd([]string{"--dbPath", tmpDB}, &buf)
-
- // Verify output matches expected format
- output := strings.TrimSpace(buf.String())
- lines := strings.Split(output, "\n")
-
- expectedLine1 := fmt.Sprintf("%s,alice@example.com,%s", user1.UUID, user1.CreatedAt.UTC().Format("2006-01-02T15:04:05Z"))
- expectedLine2 := fmt.Sprintf("%s,bob@example.com,%s", user2.UUID, user2.CreatedAt.UTC().Format("2006-01-02T15:04:05Z"))
- expectedLine3 := fmt.Sprintf("%s,charlie@example.com,%s", user3.UUID, user3.CreatedAt.UTC().Format("2006-01-02T15:04:05Z"))
-
- assert.Equal(t, lines[0], expectedLine1, "line 1 should match")
- assert.Equal(t, lines[1], expectedLine2, "line 2 should match")
- assert.Equal(t, lines[2], expectedLine3, "line 3 should match")
- })
-
- t.Run("empty database", func(t *testing.T) {
- tmpDB := t.TempDir() + "/test.db"
-
- // Initialize empty database
- db := testutils.InitDB(tmpDB)
- sqlDB, _ := db.DB()
- sqlDB.Close()
-
- // Capture output
- var buf bytes.Buffer
- userListCmd([]string{"--dbPath", tmpDB}, &buf)
-
- // Verify no output
- output := buf.String()
- assert.Equal(t, output, "", "should have no output for empty database")
- })
-}
diff --git a/pkg/server/cmd/version.go b/pkg/server/cmd/version.go
deleted file mode 100644
index c36405d4..00000000
--- a/pkg/server/cmd/version.go
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package cmd
-
-import (
- "fmt"
-
- "github.com/dnote/dnote/pkg/server/buildinfo"
-)
-
-func versionCmd() {
- fmt.Printf("dnote-server-%s\n", buildinfo.Version)
-}
diff --git a/pkg/server/config/config.go b/pkg/server/config/config.go
index 19ee45f2..0ed705d1 100644
--- a/pkg/server/config/config.go
+++ b/pkg/server/config/config.go
@@ -1,117 +1,140 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package config
import (
+ "fmt"
+ "github.com/pkg/errors"
"net/url"
"os"
- "path/filepath"
-
- "github.com/dnote/dnote/pkg/dirs"
- "github.com/dnote/dnote/pkg/server/assets"
- "github.com/pkg/errors"
-)
-
-const (
- // DefaultDBDir is the default directory name for Dnote data
- DefaultDBDir = "dnote"
- // DefaultDBFilename is the default database filename
- DefaultDBFilename = "server.db"
)
var (
- // DefaultDBPath is the default path to the database file
- DefaultDBPath = filepath.Join(dirs.DataHome, DefaultDBDir, DefaultDBFilename)
-)
-
-var (
- // ErrDBMissingPath is an error for an incomplete configuration missing the database path
- ErrDBMissingPath = errors.New("DB Path is empty")
- // ErrBaseURLInvalid is an error for an incomplete configuration with invalid base url
- ErrBaseURLInvalid = errors.New("Invalid BaseURL")
+ // ErrDBMissingHost is an error for an incomplete configuration missing the host
+ ErrDBMissingHost = errors.New("DB Host is empty")
+ // ErrDBMissingPort is an error for an incomplete configuration missing the port
+ ErrDBMissingPort = errors.New("DB Port is empty")
+ // ErrDBMissingName is an error for an incomplete configuration missing the name
+ ErrDBMissingName = errors.New("DB Name is empty")
+ // ErrDBMissingUser is an error for an incomplete configuration missing the user
+ ErrDBMissingUser = errors.New("DB User is empty")
+ // ErrWebURLInvalid is an error for an incomplete configuration with invalid web url
+ ErrWebURLInvalid = errors.New("Invalid WebURL")
// ErrPortInvalid is an error for an incomplete configuration with invalid port
ErrPortInvalid = errors.New("Invalid Port")
)
-func readBoolEnv(name string) bool {
- return os.Getenv(name) == "true"
+// PostgresConfig holds the postgres connection configuration.
+type PostgresConfig struct {
+ SSLMode string
+ Host string
+ Port string
+ Name string
+ User string
+ Password string
}
-// getOrEnv returns value if non-empty, otherwise env var, otherwise default
-func getOrEnv(value, envKey, defaultVal string) string {
- if value != "" {
- return value
+func readBoolEnv(name string) bool {
+ if os.Getenv(name) == "true" {
+ return true
}
- if env := os.Getenv(envKey); env != "" {
- return env
+
+ return false
+}
+
+// checkSSLMode checks if SSL is required for the database connection
+func checkSSLMode() bool {
+ // TODO: deprecate DB_NOSSL in favor of DBSkipSSL
+ if os.Getenv("DB_NOSSL") != "" {
+ return true
+ }
+
+ if os.Getenv("DBSkipSSL") == "true" {
+ return true
+ }
+
+ return os.Getenv("GO_ENV") != "PRODUCTION"
+}
+
+func loadDBConfig() PostgresConfig {
+ var sslmode string
+ if checkSSLMode() {
+ sslmode = "disable"
+ } else {
+ sslmode = "require"
+ }
+
+ return PostgresConfig{
+ SSLMode: sslmode,
+ Host: os.Getenv("DBHost"),
+ Port: os.Getenv("DBPort"),
+ Name: os.Getenv("DBName"),
+ User: os.Getenv("DBUser"),
+ Password: os.Getenv("DBPassword"),
}
- return defaultVal
}
// Config is an application configuration
type Config struct {
- BaseURL string
+ WebURL string
+ OnPremise bool
DisableRegistration bool
Port string
- DBPath string
- AssetBaseURL string
- HTTP500Page []byte
- LogLevel string
+ DB PostgresConfig
}
-// Params are the configuration parameters for creating a new Config
-type Params struct {
- Port string
- BaseURL string
- DBPath string
- DisableRegistration bool
- LogLevel string
-}
+// Load constructs and returns a new config based on the environment variables.
+func Load() Config {
+ port := os.Getenv("PORT")
+ if port == "" {
+ port = "3000"
+ }
-// New constructs and returns a new validated config.
-// Empty string params will fall back to environment variables and defaults.
-func New(p Params) (Config, error) {
c := Config{
- Port: getOrEnv(p.Port, "PORT", "3001"),
- BaseURL: getOrEnv(p.BaseURL, "BaseURL", "http://localhost:3001"),
- DBPath: getOrEnv(p.DBPath, "DBPath", DefaultDBPath),
- DisableRegistration: p.DisableRegistration || readBoolEnv("DisableRegistration"),
- LogLevel: getOrEnv(p.LogLevel, "LOG_LEVEL", "info"),
- AssetBaseURL: "/static",
- HTTP500Page: assets.MustGetHTTP500ErrorPage(),
+ WebURL: os.Getenv("WebURL"),
+ Port: port,
+ OnPremise: readBoolEnv("OnPremise"),
+ DisableRegistration: readBoolEnv("DisableRegistration"),
+ DB: loadDBConfig(),
}
if err := validate(c); err != nil {
- return Config{}, err
+ panic(err)
}
- return c, nil
+ return c
+}
+
+// SetOnPremise sets the OnPremise value
+func (c *Config) SetOnPremise(val bool) {
+ c.OnPremise = val
}
func validate(c Config) error {
- if _, err := url.ParseRequestURI(c.BaseURL); err != nil {
- return errors.Wrapf(ErrBaseURLInvalid, "'%s'", c.BaseURL)
+ if _, err := url.ParseRequestURI(c.WebURL); err != nil {
+ return errors.Wrapf(ErrWebURLInvalid, "provided: '%s'", c.WebURL)
}
if c.Port == "" {
return ErrPortInvalid
}
- if c.DBPath == "" {
- return ErrDBMissingPath
+ if c.DB.Host == "" {
+ return ErrDBMissingHost
+ }
+ if c.DB.Port == "" {
+ return ErrDBMissingPort
+ }
+ if c.DB.Name == "" {
+ return ErrDBMissingName
+ }
+ if c.DB.User == "" {
+ return ErrDBMissingUser
}
return nil
}
+
+// GetConnectionStr returns a postgres connection string.
+func (c PostgresConfig) GetConnectionStr() string {
+ return fmt.Sprintf(
+ "sslmode=%s host=%s port=%s dbname=%s user=%s password=%s",
+ c.SSLMode, c.Host, c.Port, c.Name, c.User, c.Password)
+}
diff --git a/pkg/server/config/config_test.go b/pkg/server/config/config_test.go
index 9c3c1baa..b86841f4 100644
--- a/pkg/server/config/config_test.go
+++ b/pkg/server/config/config_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package config
@@ -30,30 +33,85 @@ func TestValidate(t *testing.T) {
}{
{
config: Config{
- DBPath: "test.db",
- BaseURL: "http://mock.url",
- Port: "3000",
+ DB: PostgresConfig{
+ Host: "mockHost",
+ Port: "5432",
+ Name: "mockDB",
+ User: "mockUser",
+ },
+ WebURL: "http://mock.url",
+ Port: "3000",
},
expectedErr: nil,
},
{
config: Config{
- DBPath: "",
- BaseURL: "http://mock.url",
- Port: "3000",
+ DB: PostgresConfig{
+ Port: "5432",
+ Name: "mockDB",
+ User: "mockUser",
+ },
+ WebURL: "http://mock.url",
+ Port: "3000",
},
- expectedErr: ErrDBMissingPath,
+ expectedErr: ErrDBMissingHost,
},
{
config: Config{
- DBPath: "test.db",
+ DB: PostgresConfig{
+ Host: "mockHost",
+ Name: "mockDB",
+ User: "mockUser",
+ },
+ WebURL: "http://mock.url",
+ Port: "3000",
},
- expectedErr: ErrBaseURLInvalid,
+ expectedErr: ErrDBMissingPort,
},
{
config: Config{
- DBPath: "test.db",
- BaseURL: "http://mock.url",
+ DB: PostgresConfig{
+ Host: "mockHost",
+ Port: "5432",
+ User: "mockUser",
+ },
+ WebURL: "http://mock.url",
+ Port: "3000",
+ },
+ expectedErr: ErrDBMissingName,
+ },
+ {
+ config: Config{
+ DB: PostgresConfig{
+ Host: "mockHost",
+ Port: "5432",
+ Name: "mockDB",
+ },
+ WebURL: "http://mock.url",
+ Port: "3000",
+ },
+ expectedErr: ErrDBMissingUser,
+ },
+ {
+ config: Config{
+ DB: PostgresConfig{
+ Host: "mockHost",
+ Port: "5432",
+ Name: "mockDB",
+ User: "mockUser",
+ },
+ },
+ expectedErr: ErrWebURLInvalid,
+ },
+ {
+ config: Config{
+ DB: PostgresConfig{
+ Host: "mockHost",
+ Port: "5432",
+ Name: "mockDB",
+ User: "mockUser",
+ },
+ WebURL: "http://mock.url",
},
expectedErr: ErrPortInvalid,
},
diff --git a/pkg/server/consts/consts.go b/pkg/server/consts/consts.go
deleted file mode 100644
index 1f464951..00000000
--- a/pkg/server/consts/consts.go
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package consts
-
-const (
- // ContentTypeForm is the content type header for form encoded data
- ContentTypeForm = "application/x-www-form-urlencoded"
- // ContentTypeForm is the content type header for JSON encoded data
- ContentTypeJSON = "application/json"
- // ContentTypeHTML is the content type header for HTML
- ContentTypeHTML = "text/html"
-)
diff --git a/pkg/server/context/user.go b/pkg/server/context/user.go
deleted file mode 100644
index b58d40e9..00000000
--- a/pkg/server/context/user.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package context
-
-import (
- "context"
-
- "github.com/dnote/dnote/pkg/server/database"
-)
-
-const (
- userKey privateKey = "user"
- tokenKey privateKey = "token"
-)
-
-type privateKey string
-
-// WithUser creates a new context with the given user
-func WithUser(ctx context.Context, user *database.User) context.Context {
- return context.WithValue(ctx, userKey, user)
-}
-
-// WithToken creates a new context with the given user
-func WithToken(ctx context.Context, tok *database.Token) context.Context {
- return context.WithValue(ctx, tokenKey, tok)
-}
-
-// User retrieves a user from the given context. It returns a pointer to
-// a user. If the context does not contain a user, it returns nil.
-func User(ctx context.Context) *database.User {
- if temp := ctx.Value(userKey); temp != nil {
- if user, ok := temp.(*database.User); ok {
- return user
- }
- }
-
- return nil
-}
-
-// Token retrieves a token from the given context.
-func Token(ctx context.Context) *database.Token {
- if temp := ctx.Value(tokenKey); temp != nil {
- if tok, ok := temp.(*database.Token); ok {
- return tok
- }
- }
-
- return nil
-}
diff --git a/pkg/server/controllers/books.go b/pkg/server/controllers/books.go
deleted file mode 100644
index c20ea679..00000000
--- a/pkg/server/controllers/books.go
+++ /dev/null
@@ -1,308 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "errors"
- "fmt"
- "net/http"
-
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/context"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/helpers"
- "github.com/dnote/dnote/pkg/server/presenters"
- "github.com/gorilla/mux"
- "gorm.io/gorm"
- pkgErrors "github.com/pkg/errors"
-)
-
-// NewBooks creates a new Books controller.
-// It panics if the necessary templates are not parsed.
-func NewBooks(app *app.App) *Books {
- return &Books{
- app: app,
- }
-}
-
-// Books is a user controller.
-type Books struct {
- app *app.App
-}
-
-func (b *Books) getBooks(r *http.Request) ([]database.Book, error) {
- user := context.User(r.Context())
- if user == nil {
- return []database.Book{}, app.ErrLoginRequired
- }
-
- conn := b.app.DB.Where("user_id = ? AND NOT deleted", user.ID).Order("label ASC")
-
- query := r.URL.Query()
- name := query.Get("name")
-
- if name != "" {
- part := fmt.Sprintf("%%%s%%", name)
- conn = conn.Where("LOWER(label) LIKE ?", part)
- }
-
- var books []database.Book
- if err := conn.Find(&books).Error; err != nil {
- return []database.Book{}, nil
- }
-
- return books, nil
-}
-
-// V3Index gets books
-func (b *Books) V3Index(w http.ResponseWriter, r *http.Request) {
- result, err := b.getBooks(r)
- if err != nil {
- handleJSONError(w, err, "getting books")
- return
- }
-
- respondJSON(w, http.StatusOK, presenters.PresentBooks(result))
-}
-
-// V3Show gets a book
-func (b *Books) V3Show(w http.ResponseWriter, r *http.Request) {
- user := context.User(r.Context())
- if user == nil {
- handleJSONError(w, app.ErrLoginRequired, "login required")
- return
- }
-
- vars := mux.Vars(r)
- bookUUID := vars["bookUUID"]
-
- if !helpers.ValidateUUID(bookUUID) {
- handleJSONError(w, app.ErrInvalidUUID, "login required")
- return
- }
-
- var book database.Book
- err := b.app.DB.Where("uuid = ? AND user_id = ?", bookUUID, user.ID).First(&book).Error
-
- if errors.Is(err, gorm.ErrRecordNotFound) {
- w.WriteHeader(http.StatusNotFound)
- return
- }
- if err != nil {
- handleJSONError(w, err, "finding the book")
- return
- }
-
- respondJSON(w, http.StatusOK, presenters.PresentBook(book))
-}
-
-type createBookPayload struct {
- Name string `schema:"name" json:"name"`
-}
-
-func validateCreateBookPayload(p createBookPayload) error {
- if p.Name == "" {
- return app.ErrBookNameRequired
- }
-
- return nil
-}
-
-func (b *Books) create(r *http.Request) (database.Book, error) {
- user := context.User(r.Context())
- if user == nil {
- return database.Book{}, app.ErrLoginRequired
- }
-
- var params createBookPayload
- if err := parseRequestData(r, ¶ms); err != nil {
- return database.Book{}, pkgErrors.Wrap(err, "parsing request payload")
- }
-
- if err := validateCreateBookPayload(params); err != nil {
- return database.Book{}, pkgErrors.Wrap(err, "validating payload")
- }
-
- var bookCount int64
- err := b.app.DB.Model(database.Book{}).
- Where("user_id = ? AND label = ?", user.ID, params.Name).
- Count(&bookCount).Error
- if err != nil {
- return database.Book{}, pkgErrors.Wrap(err, "checking duplicate")
- }
- if bookCount > 0 {
- return database.Book{}, app.ErrDuplicateBook
- }
-
- book, err := b.app.CreateBook(*user, params.Name)
- if err != nil {
- return database.Book{}, pkgErrors.Wrap(err, "inserting a book")
- }
-
- return book, nil
-}
-
-// CreateBookResp is the response from create book api
-type CreateBookResp struct {
- Book presenters.Book `json:"book"`
-}
-
-// V3Create creates a book
-func (b *Books) V3Create(w http.ResponseWriter, r *http.Request) {
- result, err := b.create(r)
- if err != nil {
- handleJSONError(w, err, "creating a book")
- return
- }
-
- resp := CreateBookResp{
- Book: presenters.PresentBook(result),
- }
- respondJSON(w, http.StatusCreated, resp)
-}
-
-type updateBookPayload struct {
- Name *string `schema:"name" json:"name"`
-}
-
-// UpdateBookResp is the response from create book api
-type UpdateBookResp struct {
- Book presenters.Book `json:"book"`
-}
-
-func (b *Books) update(r *http.Request) (database.Book, error) {
- user := context.User(r.Context())
- if user == nil {
- return database.Book{}, app.ErrLoginRequired
- }
-
- vars := mux.Vars(r)
- uuid := vars["bookUUID"]
-
- if !helpers.ValidateUUID(uuid) {
- return database.Book{}, app.ErrInvalidUUID
- }
-
- tx := b.app.DB.Begin()
-
- var book database.Book
- if err := tx.Where("user_id = ? AND uuid = ?", user.ID, uuid).First(&book).Error; err != nil {
- tx.Rollback()
- return database.Book{}, pkgErrors.Wrap(err, "finding book")
- }
-
- var params updateBookPayload
- if err := parseRequestData(r, ¶ms); err != nil {
- tx.Rollback()
- return database.Book{}, pkgErrors.Wrap(err, "decoding payload")
- }
-
- book, err := b.app.UpdateBook(tx, *user, book, params.Name)
- if err != nil {
- tx.Rollback()
- return database.Book{}, pkgErrors.Wrap(err, "updating a book")
- }
-
- tx.Commit()
-
- return book, nil
-}
-
-// V3Update updates a book
-func (b *Books) V3Update(w http.ResponseWriter, r *http.Request) {
- book, err := b.update(r)
- if err != nil {
- handleJSONError(w, err, "updating a book")
- return
- }
-
- resp := UpdateBookResp{
- Book: presenters.PresentBook(book),
- }
- respondJSON(w, http.StatusOK, resp)
-}
-
-func (b *Books) del(r *http.Request) (database.Book, error) {
- user := context.User(r.Context())
- if user == nil {
- return database.Book{}, app.ErrLoginRequired
- }
-
- vars := mux.Vars(r)
- uuid := vars["bookUUID"]
-
- if !helpers.ValidateUUID(uuid) {
- return database.Book{}, app.ErrInvalidUUID
- }
-
- tx := b.app.DB.Begin()
-
- var book database.Book
- if err := tx.Where("user_id = ? AND uuid = ?", user.ID, uuid).First(&book).Error; err != nil {
- tx.Rollback()
- return database.Book{}, pkgErrors.Wrap(err, "finding a book")
- }
-
- var notes []database.Note
- if err := tx.Where("book_uuid = ? AND NOT deleted", uuid).Order("usn ASC").Find(¬es).Error; err != nil {
- tx.Rollback()
- return database.Book{}, pkgErrors.Wrap(err, "finding notes for the book")
- }
-
- for _, note := range notes {
- if _, err := b.app.DeleteNote(tx, *user, note); err != nil {
- tx.Rollback()
- return database.Book{}, pkgErrors.Wrap(err, "deleting a note in the book")
- }
- }
-
- book, err := b.app.DeleteBook(tx, *user, book)
- if err != nil {
- tx.Rollback()
- return database.Book{}, pkgErrors.Wrap(err, "deleting the book")
- }
-
- tx.Commit()
-
- return book, nil
-}
-
-// deleteBookResp is the response from create book api
-type deleteBookResp struct {
- Status int `json:"status"`
- Book presenters.Book `json:"book"`
-}
-
-// Delete updates a book
-func (b *Books) V3Delete(w http.ResponseWriter, r *http.Request) {
- book, err := b.del(r)
- if err != nil {
- handleJSONError(w, err, "creating a books")
- return
- }
-
- resp := deleteBookResp{
- Status: http.StatusOK,
- Book: presenters.PresentBook(book),
- }
- respondJSON(w, http.StatusOK, resp)
-}
-
-// IndexOptions is a handler for OPTIONS endpoint for notes
-func (b *Books) IndexOptions(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Access-Control-Allow-Methods", "GET, POST")
- w.Header().Set("Access-Control-Allow-Headers", "Authorization, Version")
-}
diff --git a/pkg/server/controllers/books_test.go b/pkg/server/controllers/books_test.go
deleted file mode 100644
index af6ba42d..00000000
--- a/pkg/server/controllers/books_test.go
+++ /dev/null
@@ -1,683 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "net/http"
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/clock"
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/presenters"
- "github.com/dnote/dnote/pkg/server/testutils"
- "github.com/pkg/errors"
-)
-
-// truncateMicro rounds time to microsecond precision to match SQLite storage
-func truncateMicro(t time.Time) time.Time {
- return t.Round(time.Microsecond)
-}
-
-func TestGetBooks(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- anotherUser := testutils.SetupUserData(db, "bob@test.com", "pass1234")
-
- b1 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "js",
- USN: 1123,
- Deleted: false,
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
- b2 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "css",
- USN: 1125,
- Deleted: false,
- }
- testutils.MustExec(t, db.Save(&b2), "preparing b2")
- b3 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: anotherUser.ID,
- Label: "css",
- USN: 1128,
- Deleted: false,
- }
- testutils.MustExec(t, db.Save(&b3), "preparing b3")
- b4 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "",
- USN: 1129,
- Deleted: true,
- }
- testutils.MustExec(t, db.Save(&b4), "preparing b4")
-
- // Execute
- endpoint := "/api/v3/books"
-
- req := testutils.MakeReq(server.URL, "GET", endpoint, "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "")
-
- var payload []presenters.Book
- if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload"))
- }
-
- var b1Record, b2Record database.Book
- testutils.MustExec(t, db.Where("id = ?", b1.ID).First(&b1Record), "finding b1")
- testutils.MustExec(t, db.Where("id = ?", b2.ID).First(&b2Record), "finding b2")
- testutils.MustExec(t, db.Where("id = ?", b2.ID).First(&b2Record), "finding b2")
-
- expected := []presenters.Book{
- {
- UUID: b2Record.UUID,
- CreatedAt: truncateMicro(b2Record.CreatedAt),
- UpdatedAt: truncateMicro(b2Record.UpdatedAt),
- Label: b2Record.Label,
- USN: b2Record.USN,
- },
- {
- UUID: b1Record.UUID,
- CreatedAt: truncateMicro(b1Record.CreatedAt),
- UpdatedAt: truncateMicro(b1Record.UpdatedAt),
- Label: b1Record.Label,
- USN: b1Record.USN,
- },
- }
-
- // Truncate payload timestamps to match SQLite precision
- for i := range payload {
- payload[i].CreatedAt = truncateMicro(payload[i].CreatedAt)
- payload[i].UpdatedAt = truncateMicro(payload[i].UpdatedAt)
- }
-
- assert.DeepEqual(t, payload, expected, "payload mismatch")
-}
-
-func TestGetBooksByName(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- anotherUser := testutils.SetupUserData(db, "bob@test.com", "pass1234")
-
- b1 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
- b2 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "css",
- }
- testutils.MustExec(t, db.Save(&b2), "preparing b2")
- b3 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: anotherUser.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b3), "preparing b3")
-
- // Execute
- endpoint := "/api/v3/books?name=js"
-
- req := testutils.MakeReq(server.URL, "GET", endpoint, "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "")
-
- var payload []presenters.Book
- if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload"))
- }
-
- var b1Record database.Book
- testutils.MustExec(t, db.Where("id = ?", b1.ID).First(&b1Record), "finding b1")
-
- expected := []presenters.Book{
- {
- UUID: b1Record.UUID,
- CreatedAt: truncateMicro(b1Record.CreatedAt),
- UpdatedAt: truncateMicro(b1Record.UpdatedAt),
- Label: b1Record.Label,
- USN: b1Record.USN,
- },
- }
-
- for i := range payload {
- payload[i].CreatedAt = truncateMicro(payload[i].CreatedAt)
- payload[i].UpdatedAt = truncateMicro(payload[i].UpdatedAt)
- }
-
- assert.DeepEqual(t, payload, expected, "payload mismatch")
-}
-
-func TestGetBook(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- anotherUser := testutils.SetupUserData(db, "bob@test.com", "pass1234")
-
- b1 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
- b2 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "css",
- }
- testutils.MustExec(t, db.Save(&b2), "preparing b2")
- b3 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: anotherUser.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b3), "preparing b3")
-
- // Execute
- endpoint := fmt.Sprintf("/api/v3/books/%s", b1.UUID)
- req := testutils.MakeReq(server.URL, "GET", endpoint, "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "")
-
- var payload presenters.Book
- if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload"))
- }
-
- var b1Record database.Book
- testutils.MustExec(t, db.Where("id = ?", b1.ID).First(&b1Record), "finding b1")
-
- expected := presenters.Book{
- UUID: b1Record.UUID,
- CreatedAt: truncateMicro(b1Record.CreatedAt),
- UpdatedAt: truncateMicro(b1Record.UpdatedAt),
- Label: b1Record.Label,
- USN: b1Record.USN,
- }
-
- payload.CreatedAt = truncateMicro(payload.CreatedAt)
- payload.UpdatedAt = truncateMicro(payload.UpdatedAt)
-
- assert.DeepEqual(t, payload, expected, "payload mismatch")
-}
-
-func TestGetBookNonOwner(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- nonOwner := testutils.SetupUserData(db, "bob@test.com", "pass1234")
-
- b1 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
-
- // Execute
- endpoint := fmt.Sprintf("/api/v3/books/%s", b1.UUID)
- req := testutils.MakeReq(server.URL, "GET", endpoint, "")
- res := testutils.HTTPAuthDo(t, db, req, nonOwner)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusNotFound, "")
-
- body, err := io.ReadAll(res.Body)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reading body"))
- }
- assert.DeepEqual(t, string(body), "", "payload mismatch")
-}
-
-func TestCreateBook(t *testing.T) {
- t.Run("success", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", 101), "preparing user max_usn")
-
- req := testutils.MakeReq(server.URL, "POST", "/api/v3/books", `{"name": "js"}`)
-
- // Execute
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusCreated, "")
-
- var bookRecord database.Book
- var userRecord database.User
- var bookCount, noteCount int64
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), "counting books")
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), "counting notes")
- testutils.MustExec(t, db.First(&bookRecord), "finding book")
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), "finding user record")
-
- maxUSN := 102
-
- assert.Equalf(t, bookCount, int64(1), "book count mismatch")
- assert.Equalf(t, noteCount, int64(0), "note count mismatch")
-
- assert.NotEqual(t, bookRecord.UUID, "", "book uuid should have been generated")
- assert.Equal(t, bookRecord.Label, "js", "book name mismatch")
- assert.Equal(t, bookRecord.UserID, user.ID, "book user_id mismatch")
- assert.Equal(t, bookRecord.USN, maxUSN, "book user_id mismatch")
- assert.Equal(t, userRecord.MaxUSN, maxUSN, "user max_usn mismatch")
-
- var got CreateBookResp
- if err := json.NewDecoder(res.Body).Decode(&got); err != nil {
- t.Fatal(errors.Wrap(err, "decoding"))
- }
- expected := CreateBookResp{
- Book: presenters.Book{
- UUID: bookRecord.UUID,
- USN: bookRecord.USN,
- CreatedAt: truncateMicro(bookRecord.CreatedAt),
- UpdatedAt: truncateMicro(bookRecord.UpdatedAt),
- Label: "js",
- },
- }
-
- got.Book.CreatedAt = truncateMicro(got.Book.CreatedAt)
- got.Book.UpdatedAt = truncateMicro(got.Book.UpdatedAt)
-
- assert.DeepEqual(t, got, expected, "payload mismatch")
- })
-
- t.Run("duplicate", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", 101), "preparing user max_usn")
-
- b1 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "js",
- USN: 58,
- }
- testutils.MustExec(t, db.Save(&b1), "preparing book data")
-
- // Execute
- req := testutils.MakeReq(server.URL, "POST", "/api/v3/books", `{"name": "js"}`)
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusConflict, "")
-
- var bookRecord database.Book
- var bookCount, noteCount int64
- var userRecord database.User
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), "counting books")
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), "counting notes")
- testutils.MustExec(t, db.First(&bookRecord), "finding book")
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), "finding user record")
-
- assert.Equalf(t, bookCount, int64(1), "book count mismatch")
- assert.Equalf(t, noteCount, int64(0), "note count mismatch")
-
- assert.Equal(t, bookRecord.Label, "js", "book name mismatch")
- assert.Equal(t, bookRecord.UserID, user.ID, "book user_id mismatch")
- assert.Equal(t, bookRecord.USN, b1.USN, "book usn mismatch")
- assert.Equal(t, userRecord.MaxUSN, 101, "user max_usn mismatch")
- })
-}
-
-func TestUpdateBook(t *testing.T) {
- updatedLabel := "updated-label"
-
- b1UUID := "ead8790f-aff9-4bdf-8eec-f734ccd29202"
- b2UUID := "0ecaac96-8d72-4e04-8925-5a21b79a16da"
-
- type payloadData struct {
- Name *string `schema:"name" json:"name,omitempty"`
- }
-
- testCases := []struct {
- payload testutils.PayloadWrapper
- bookUUID string
- bookDeleted bool
- bookLabel string
- expectedBookLabel string
- }{
- {
- payload: testutils.PayloadWrapper{
- Data: payloadData{
- Name: &updatedLabel,
- },
- },
- bookUUID: b1UUID,
- bookDeleted: false,
- bookLabel: "original-label",
- expectedBookLabel: updatedLabel,
- },
- // if a deleted book is updated, it should be un-deleted
- {
- payload: testutils.PayloadWrapper{
- Data: payloadData{
- Name: &updatedLabel,
- },
- },
- bookUUID: b1UUID,
- bookDeleted: true,
- bookLabel: "",
- expectedBookLabel: updatedLabel,
- },
- }
-
- for idx, tc := range testCases {
- t.Run(fmt.Sprintf("test case %d", idx), func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", 101), "preparing user max_usn")
-
- b1 := database.Book{
- UUID: tc.bookUUID,
- UserID: user.ID,
- Label: tc.bookLabel,
- Deleted: tc.bookDeleted,
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
- b2 := database.Book{
- UUID: b2UUID,
- UserID: user.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b2), "preparing b2")
-
- // Execute
- endpoint := fmt.Sprintf("/api/v3/books/%s", tc.bookUUID)
- req := testutils.MakeReq(server.URL, "PATCH", endpoint, tc.payload.ToJSON(t))
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, fmt.Sprintf("status code mismatch for test case %d", idx))
-
- var bookRecord database.Book
- var userRecord database.User
- var noteCount, bookCount int64
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), "counting books")
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), "counting notes")
- testutils.MustExec(t, db.Where("id = ?", b1.ID).First(&bookRecord), "finding book")
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), "finding user record")
-
- assert.Equalf(t, bookCount, int64(2), "book count mismatch")
- assert.Equalf(t, noteCount, int64(0), "note count mismatch")
-
- assert.Equalf(t, bookRecord.UUID, tc.bookUUID, "book uuid mismatch")
- assert.Equalf(t, bookRecord.Label, tc.expectedBookLabel, "book label mismatch")
- assert.Equalf(t, bookRecord.USN, 102, "book usn mismatch")
- assert.Equalf(t, bookRecord.Deleted, false, "book Deleted mismatch")
-
- assert.Equal(t, userRecord.MaxUSN, 102, fmt.Sprintf("user max_usn mismatch for test case %d", idx))
- })
- }
-}
-
-func TestDeleteBook(t *testing.T) {
- testCases := []struct {
- label string
- deleted bool
- expectedB2USN int
- expectedMaxUSN int
- expectedN2USN int
- expectedN3USN int
- }{
- {
- label: "n1 content",
- deleted: false,
- expectedMaxUSN: 61,
- expectedB2USN: 61,
- expectedN2USN: 59,
- expectedN3USN: 60,
- },
- {
- label: "",
- deleted: true,
- expectedMaxUSN: 59,
- expectedB2USN: 59,
- expectedN2USN: 5,
- expectedN3USN: 6,
- },
- }
-
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("originally deleted %t", tc.deleted), func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", 58), "preparing user max_usn")
- anotherUser := testutils.SetupUserData(db, "bob@test.com", "pass1234")
- testutils.MustExec(t, db.Model(&anotherUser).Update("max_usn", 109), "preparing another user max_usn")
-
- b1 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "js",
- USN: 1,
- }
- testutils.MustExec(t, db.Save(&b1), "preparing a book data")
- b2 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: tc.label,
- USN: 2,
- Deleted: tc.deleted,
- }
- testutils.MustExec(t, db.Save(&b2), "preparing a book data")
- b3 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: anotherUser.ID,
- Label: "linux",
- USN: 3,
- }
- testutils.MustExec(t, db.Save(&b3), "preparing a book data")
-
- var n2Body string
- if !tc.deleted {
- n2Body = "n2 content"
- }
- var n3Body string
- if !tc.deleted {
- n3Body = "n3 content"
- }
-
- n1 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b1.UUID,
- Body: "n1 content",
- USN: 4,
- }
- testutils.MustExec(t, db.Save(&n1), "preparing a note data")
- n2 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b2.UUID,
- Body: n2Body,
- USN: 5,
- Deleted: tc.deleted,
- }
- testutils.MustExec(t, db.Save(&n2), "preparing a note data")
- n3 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b2.UUID,
- Body: n3Body,
- USN: 6,
- Deleted: tc.deleted,
- }
- testutils.MustExec(t, db.Save(&n3), "preparing a note data")
- n4 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b2.UUID,
- Body: "",
- USN: 7,
- Deleted: true,
- }
- testutils.MustExec(t, db.Save(&n4), "preparing a note data")
- n5 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: anotherUser.ID,
- BookUUID: b3.UUID,
- Body: "n5 content",
- USN: 8,
- }
- testutils.MustExec(t, db.Save(&n5), "preparing a note data")
-
- // Execute
- endpoint := fmt.Sprintf("/api/v3/books/%s", b2.UUID)
-
- req := testutils.MakeReq(server.URL, "DELETE", endpoint, "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "")
-
- var b1Record, b2Record, b3Record database.Book
- var n1Record, n2Record, n3Record, n4Record, n5Record database.Note
- var userRecord database.User
- var bookCount, noteCount int64
-
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), "counting books")
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), "counting notes")
- testutils.MustExec(t, db.Where("id = ?", b1.ID).First(&b1Record), "finding b1")
- testutils.MustExec(t, db.Where("id = ?", b2.ID).First(&b2Record), "finding b2")
- testutils.MustExec(t, db.Where("id = ?", b3.ID).First(&b3Record), "finding b3")
- testutils.MustExec(t, db.Where("id = ?", n1.ID).First(&n1Record), "finding n1")
- testutils.MustExec(t, db.Where("id = ?", n2.ID).First(&n2Record), "finding n2")
- testutils.MustExec(t, db.Where("id = ?", n3.ID).First(&n3Record), "finding n3")
- testutils.MustExec(t, db.Where("id = ?", n4.ID).First(&n4Record), "finding n4")
- testutils.MustExec(t, db.Where("id = ?", n5.ID).First(&n5Record), "finding n5")
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), "finding user record")
-
- assert.Equal(t, bookCount, int64(3), "book count mismatch")
- assert.Equal(t, noteCount, int64(5), "note count mismatch")
-
- assert.Equal(t, userRecord.MaxUSN, tc.expectedMaxUSN, "user max_usn mismatch")
-
- assert.Equal(t, b1Record.Deleted, false, "b1 deleted mismatch")
- assert.Equal(t, b1Record.Label, b1.Label, "b1 content mismatch")
- assert.Equal(t, b1Record.USN, b1.USN, "b1 usn mismatch")
- assert.Equal(t, b2Record.Deleted, true, "b2 deleted mismatch")
- assert.Equal(t, b2Record.Label, "", "b2 content mismatch")
- assert.Equal(t, b2Record.USN, tc.expectedB2USN, "b2 usn mismatch")
- assert.Equal(t, b3Record.Deleted, false, "b3 deleted mismatch")
- assert.Equal(t, b3Record.Label, b3.Label, "b3 content mismatch")
- assert.Equal(t, b3Record.USN, b3.USN, "b3 usn mismatch")
-
- assert.Equal(t, n1Record.USN, n1.USN, "n1 usn mismatch")
- assert.Equal(t, n1Record.Deleted, false, "n1 deleted mismatch")
- assert.Equal(t, n1Record.Body, n1.Body, "n1 content mismatch")
-
- assert.Equal(t, n2Record.USN, tc.expectedN2USN, "n2 usn mismatch")
- assert.Equal(t, n2Record.Deleted, true, "n2 deleted mismatch")
- assert.Equal(t, n2Record.Body, "", "n2 content mismatch")
-
- assert.Equal(t, n3Record.USN, tc.expectedN3USN, "n3 usn mismatch")
- assert.Equal(t, n3Record.Deleted, true, "n3 deleted mismatch")
- assert.Equal(t, n3Record.Body, "", "n3 content mismatch")
-
- // if already deleted, usn should remain the same and hence should not contribute to bumping the max_usn
- assert.Equal(t, n4Record.USN, n4.USN, "n4 usn mismatch")
- assert.Equal(t, n4Record.Deleted, true, "n4 deleted mismatch")
- assert.Equal(t, n4Record.Body, "", "n4 content mismatch")
-
- assert.Equal(t, n5Record.USN, n5.USN, "n5 usn mismatch")
- assert.Equal(t, n5Record.Deleted, false, "n5 deleted mismatch")
- assert.Equal(t, n5Record.Body, n5.Body, "n5 content mismatch")
- })
- }
-}
diff --git a/pkg/server/controllers/controllers.go b/pkg/server/controllers/controllers.go
deleted file mode 100644
index 4ab9980d..00000000
--- a/pkg/server/controllers/controllers.go
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/views"
-)
-
-// Controllers is a group of controllers
-type Controllers struct {
- Users *Users
- Notes *Notes
- Books *Books
- Sync *Sync
- Static *Static
- Health *Health
-}
-
-// New returns a new group of controllers
-func New(app *app.App) *Controllers {
- c := Controllers{}
-
- viewEngine := views.NewDefaultEngine()
-
- c.Users = NewUsers(app, viewEngine)
- c.Notes = NewNotes(app)
- c.Books = NewBooks(app)
- c.Sync = NewSync(app)
- c.Static = NewStatic(app, viewEngine)
- c.Health = NewHealth(app)
-
- return &c
-}
diff --git a/pkg/server/controllers/health.go b/pkg/server/controllers/health.go
deleted file mode 100644
index 85d8e048..00000000
--- a/pkg/server/controllers/health.go
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "net/http"
-
- "github.com/dnote/dnote/pkg/server/app"
-)
-
-// NewHealth creates a new Health controller.
-// It panics if the necessary templates are not parsed.
-func NewHealth(app *app.App) *Health {
- return &Health{}
-}
-
-// Health is a health controller.
-type Health struct {
-}
-
-// Index handles GET /
-func (n *Health) Index(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- w.Write([]byte("ok"))
-}
diff --git a/pkg/server/controllers/health_test.go b/pkg/server/controllers/health_test.go
deleted file mode 100644
index 56fe9778..00000000
--- a/pkg/server/controllers/health_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "net/http"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/testutils"
-)
-
-func TestHealth(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- a := app.NewTest()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- // Execute
- req := testutils.MakeReq(server.URL, "GET", "/health", "")
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "Status code mismtach")
-}
diff --git a/pkg/server/controllers/helpers.go b/pkg/server/controllers/helpers.go
deleted file mode 100644
index c17e83a1..00000000
--- a/pkg/server/controllers/helpers.go
+++ /dev/null
@@ -1,321 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "encoding/json"
- "net/http"
- "net/url"
- "strings"
- "time"
-
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/consts"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/log"
- "github.com/dnote/dnote/pkg/server/views"
- "github.com/gorilla/schema"
- "github.com/pkg/errors"
-)
-
-func parseRequestData(r *http.Request, dst interface{}) error {
- ct := r.Header.Get("Content-Type")
-
- if ct == consts.ContentTypeForm {
- if err := parseForm(r, dst); err != nil {
- return errors.Wrap(err, "parsing form")
- }
-
- return nil
- }
-
- // default to JSON
- if err := parseJSON(r, dst); err != nil {
- return errors.Wrap(err, "parsing JSON")
- }
-
- return nil
-}
-
-func parseForm(r *http.Request, dst interface{}) error {
- if err := r.ParseForm(); err != nil {
- return err
- }
-
- return parseValues(r.PostForm, dst)
-}
-
-func parseValues(values url.Values, dst interface{}) error {
- dec := schema.NewDecoder()
-
- // Ignore CSRF token field
- dec.IgnoreUnknownKeys(true)
-
- if err := dec.Decode(dst, values); err != nil {
- return err
- }
-
- return nil
-}
-
-func parseJSON(r *http.Request, dst interface{}) error {
- dec := json.NewDecoder(r.Body)
-
- if err := dec.Decode(dst); err != nil {
- return err
- }
-
- return nil
-}
-
-// GetCredential extracts a session key from the request from the request header. Concretely,
-// it first looks at the 'Cookie' and then the 'Authorization' header. If no credential is found,
-// it returns an empty string.
-func GetCredential(r *http.Request) (string, error) {
- ret, err := getSessionKeyFromCookie(r)
- if err != nil {
- return "", errors.Wrap(err, "getting session key from cookie")
- }
- if ret != "" {
- return ret, nil
- }
-
- ret, err = getSessionKeyFromAuth(r)
- if err != nil {
- return "", errors.Wrap(err, "getting session key from Authorization header")
- }
-
- return ret, nil
-}
-
-// getSessionKeyFromCookie reads and returns a session key from the cookie sent by the
-// request. If no session key is found, it returns an empty string
-func getSessionKeyFromCookie(r *http.Request) (string, error) {
- c, err := r.Cookie("id")
-
- if err == http.ErrNoCookie {
- return "", nil
- } else if err != nil {
- return "", errors.Wrap(err, "reading cookie")
- }
-
- return c.Value, nil
-}
-
-// getSessionKeyFromAuth reads and returns a session key from the Authorization header
-func getSessionKeyFromAuth(r *http.Request) (string, error) {
- h := r.Header.Get("Authorization")
- if h == "" {
- return "", nil
- }
-
- payload, err := parseAuthHeader(h)
- if err != nil {
- return "", errors.Wrap(err, "parsing the authorization header")
- }
- if payload.scheme != "Bearer" {
- return "", errors.New("unsupported scheme")
- }
-
- return payload.credential, nil
-}
-
-func parseAuthHeader(h string) (authHeader, error) {
- parts := strings.Split(h, " ")
-
- if len(parts) != 2 {
- return authHeader{}, errors.New("Invalid authorization header")
- }
-
- parsed := authHeader{
- scheme: parts[0],
- credential: parts[1],
- }
-
- return parsed, nil
-}
-
-type authHeader struct {
- scheme string
- credential string
-}
-
-const (
- sessionCookieName = "id"
- sessionCookiePath = "/"
-)
-
-func setSessionCookie(w http.ResponseWriter, key string, expires time.Time) {
- cookie := http.Cookie{
- Name: sessionCookieName,
- Value: key,
- Expires: expires,
- Path: sessionCookiePath,
- HttpOnly: true,
- }
- http.SetCookie(w, &cookie)
-}
-
-func unsetSessionCookie(w http.ResponseWriter) {
- expires := time.Now().Add(time.Hour * -24 * 30)
- cookie := http.Cookie{
- Name: sessionCookieName,
- Value: "",
- Expires: expires,
- Path: sessionCookiePath,
- HttpOnly: true,
- }
-
- w.Header().Set("Cache-Control", "no-cache")
- http.SetCookie(w, &cookie)
-}
-
-// SessionResponse is a response containing a session information
-type SessionResponse struct {
- Key string `json:"key"`
- ExpiresAt int64 `json:"expires_at"`
-}
-
-func logError(err error, msg string) {
- // log if internal error
- // if _, ok := err.(views.PublicError); !ok {
- // log.ErrorWrap(err, msg)
- // }
- log.ErrorWrap(err, msg)
-}
-
-func getStatusCode(err error) int {
- rootErr := errors.Cause(err)
-
- switch rootErr {
- case app.ErrNotFound:
- return http.StatusNotFound
- case app.ErrLoginInvalid:
- return http.StatusUnauthorized
- case app.ErrDuplicateEmail, app.ErrEmailRequired, app.ErrPasswordTooShort:
- return http.StatusBadRequest
- case app.ErrLoginRequired:
- return http.StatusUnauthorized
- case app.ErrBookUUIDRequired:
- return http.StatusBadRequest
- case app.ErrEmptyUpdate:
- return http.StatusBadRequest
- case app.ErrInvalidUUID:
- return http.StatusBadRequest
- case app.ErrDuplicateBook:
- return http.StatusConflict
- case app.ErrInvalidToken:
- return http.StatusBadRequest
- case app.ErrPasswordResetTokenExpired:
- return http.StatusGone
- case app.ErrPasswordConfirmationMismatch:
- return http.StatusBadRequest
- case app.ErrInvalidPasswordChangeInput:
- return http.StatusBadRequest
- case app.ErrInvalidPassword:
- return http.StatusUnauthorized
- case app.ErrEmailTooLong:
- return http.StatusBadRequest
- case app.ErrMissingToken:
- return http.StatusBadRequest
- case app.ErrExpiredToken:
- return http.StatusGone
- }
-
- return http.StatusInternalServerError
-}
-
-// handleHTMLError writes the error to the log and sets the error message in the data.
-func handleHTMLError(w http.ResponseWriter, r *http.Request, err error, msg string, v *views.View, d views.Data) {
- statusCode := getStatusCode(err)
-
- logError(err, msg)
-
- d.SetAlert(err, v.AlertInBody)
- v.Render(w, r, &d, statusCode)
-}
-
-// handleJSONError logs the error and responds with the given status code with a generic status text
-func handleJSONError(w http.ResponseWriter, err error, msg string) {
- statusCode := getStatusCode(err)
-
- rootErr := errors.Cause(err)
-
- var respText string
- if pErr, ok := rootErr.(views.PublicError); ok {
- respText = pErr.Public()
- } else {
- respText = http.StatusText(statusCode)
- }
-
- logError(err, msg)
- http.Error(w, respText, statusCode)
-}
-
-// respondWithSession makes a HTTP response with the session from the user with the given userID.
-// It sets the HTTP-Only cookie for browser clients and also sends a JSON response for non-browser clients.
-func respondWithSession(w http.ResponseWriter, statusCode int, session *database.Session) {
- setSessionCookie(w, session.Key, session.ExpiresAt)
-
- response := SessionResponse{
- Key: session.Key,
- ExpiresAt: session.ExpiresAt.Unix(),
- }
-
- w.Header().Set("Content-Type", "application/json")
-
- dat, err := json.Marshal(response)
- if err != nil {
- handleJSONError(w, err, "encoding response")
- return
- }
-
- w.WriteHeader(statusCode)
- w.Write(dat)
-}
-
-// respondJSON encodes the given payload into a JSON format and writes it to the given response writer
-func respondJSON(w http.ResponseWriter, statusCode int, payload interface{}) {
- w.Header().Set("Content-Type", "application/json")
-
- dat, err := json.Marshal(payload)
- if err != nil {
- handleJSONError(w, err, "encoding response")
- return
- }
-
- w.WriteHeader(statusCode)
- w.Write(dat)
-}
-
-func getClientType(r *http.Request) string {
- origin := r.Header.Get("Origin")
-
- if strings.HasPrefix(origin, "moz-extension://") {
- return "firefox-extension"
- }
-
- if strings.HasPrefix(origin, "chrome-extension://") {
- return "chrome-extension"
- }
-
- userAgent := r.Header.Get("User-Agent")
- if strings.HasPrefix(userAgent, "Go-http-client") {
- return "cli"
- }
-
- return "web"
-}
diff --git a/pkg/server/controllers/main_test.go b/pkg/server/controllers/main_test.go
deleted file mode 100644
index cc0383b3..00000000
--- a/pkg/server/controllers/main_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "os"
- "testing"
- "time"
-)
-
-func TestMain(m *testing.M) {
- // Set timezone to UTC to match database timestamps
- time.Local = time.UTC
-
- code := m.Run()
- os.Exit(code)
-}
diff --git a/pkg/server/controllers/notes.go b/pkg/server/controllers/notes.go
deleted file mode 100644
index 964a608f..00000000
--- a/pkg/server/controllers/notes.go
+++ /dev/null
@@ -1,384 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "net/http"
- "net/url"
- "strconv"
- "strings"
-
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/context"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/operations"
- "github.com/dnote/dnote/pkg/server/presenters"
- "github.com/gorilla/mux"
- "github.com/pkg/errors"
-)
-
-// NewNotes creates a new Notes controller.
-// It panics if the necessary templates are not parsed.
-func NewNotes(app *app.App) *Notes {
- return &Notes{
- app: app,
- }
-}
-
-var notesPerPage = 30
-
-// Notes is a user controller.
-type Notes struct {
- app *app.App
-}
-
-// escapeSearchQuery escapes the query for full text search
-func escapeSearchQuery(searchQuery string) string {
- return strings.Join(strings.Fields(searchQuery), "&")
-}
-
-func parseSearchQuery(q url.Values) string {
- searchStr := q.Get("q")
-
- return escapeSearchQuery(searchStr)
-}
-
-func parsePageQuery(q url.Values) (int, error) {
- pageStr := q.Get("page")
- if len(pageStr) == 0 {
- return 1, nil
- }
-
- p, err := strconv.Atoi(pageStr)
- return p, err
-}
-
-func parseGetNotesQuery(q url.Values) (app.GetNotesParams, error) {
- yearStr := q.Get("year")
- monthStr := q.Get("month")
- books := q["book"]
- pageStr := q.Get("page")
-
- page, err := parsePageQuery(q)
- if err != nil {
- return app.GetNotesParams{}, errors.Errorf("invalid page %s", pageStr)
- }
- if page < 1 {
- return app.GetNotesParams{}, errors.Errorf("invalid page %s", pageStr)
- }
-
- var year int
- if len(yearStr) > 0 {
- y, err := strconv.Atoi(yearStr)
- if err != nil {
- return app.GetNotesParams{}, errors.Errorf("invalid year %s", yearStr)
- }
-
- year = y
- }
-
- var month int
- if len(monthStr) > 0 {
- m, err := strconv.Atoi(monthStr)
- if err != nil {
- return app.GetNotesParams{}, errors.Errorf("invalid month %s", monthStr)
- }
- if m < 1 || m > 12 {
- return app.GetNotesParams{}, errors.Errorf("invalid month %s", monthStr)
- }
-
- month = m
- }
-
- ret := app.GetNotesParams{
- Year: year,
- Month: month,
- Page: page,
- Search: parseSearchQuery(q),
- Books: books,
- PerPage: notesPerPage,
- }
-
- return ret, nil
-}
-
-func (n *Notes) getNotes(r *http.Request) (app.GetNotesResult, app.GetNotesParams, error) {
- user := context.User(r.Context())
- if user == nil {
- return app.GetNotesResult{}, app.GetNotesParams{}, app.ErrLoginRequired
- }
-
- query := r.URL.Query()
- p, err := parseGetNotesQuery(query)
- if err != nil {
- return app.GetNotesResult{}, app.GetNotesParams{}, errors.Wrap(err, "parsing query")
- }
-
- res, err := n.app.GetNotes(user.ID, p)
- if err != nil {
- return app.GetNotesResult{}, app.GetNotesParams{}, errors.Wrap(err, "getting notes")
- }
-
- return res, p, nil
-}
-
-// GetNotesResponse is a reponse by getNotesHandler
-type GetNotesResponse struct {
- Notes []presenters.Note `json:"notes"`
- Total int64 `json:"total"`
-}
-
-// V3Index is a v3 handler for getting notes
-func (n *Notes) V3Index(w http.ResponseWriter, r *http.Request) {
- result, _, err := n.getNotes(r)
- if err != nil {
- handleJSONError(w, err, "getting notes")
- return
- }
-
- respondJSON(w, http.StatusOK, GetNotesResponse{
- Notes: presenters.PresentNotes(result.Notes),
- Total: result.Total,
- })
-}
-
-func (n *Notes) getNote(r *http.Request) (database.Note, error) {
- user := context.User(r.Context())
-
- vars := mux.Vars(r)
- noteUUID := vars["noteUUID"]
-
- note, ok, err := operations.GetNote(n.app.DB, noteUUID, user)
- if !ok {
- return database.Note{}, app.ErrNotFound
- }
- if err != nil {
- return database.Note{}, errors.Wrap(err, "finding note")
- }
-
- return note, nil
-}
-
-// V3Show is api for show
-func (n *Notes) V3Show(w http.ResponseWriter, r *http.Request) {
- note, err := n.getNote(r)
- if err != nil {
- handleJSONError(w, err, "getting note")
- return
- }
-
- respondJSON(w, http.StatusOK, presenters.PresentNote(note))
-}
-
-type createNotePayload struct {
- BookUUID string `schema:"book_uuid" json:"book_uuid"`
- Content string `schema:"content" json:"content"`
- AddedOn *int64 `schema:"added_on" json:"added_on"`
- EditedOn *int64 `schema:"edited_on" json:"edited_on"`
-}
-
-func validateCreateNotePayload(p createNotePayload) error {
- if p.BookUUID == "" {
- return app.ErrBookUUIDRequired
- }
-
- return nil
-}
-
-func (n *Notes) create(r *http.Request) (database.Note, error) {
- user := context.User(r.Context())
- if user == nil {
- return database.Note{}, app.ErrLoginRequired
- }
-
- var params createNotePayload
- if err := parseRequestData(r, ¶ms); err != nil {
- return database.Note{}, errors.Wrap(err, "parsing request payload")
- }
-
- if err := validateCreateNotePayload(params); err != nil {
- return database.Note{}, err
- }
-
- var book database.Book
- if err := n.app.DB.Where("uuid = ? AND user_id = ?", params.BookUUID, user.ID).First(&book).Error; err != nil {
- return database.Note{}, errors.Wrapf(err, "finding book %s", params.BookUUID)
- }
-
- client := getClientType(r)
- note, err := n.app.CreateNote(*user, params.BookUUID, params.Content, params.AddedOn, params.EditedOn, client)
- if err != nil {
- return database.Note{}, errors.Wrap(err, "creating note")
- }
-
- // preload associations
- note.User = *user
- note.Book = book
-
- return note, nil
-}
-
-func (n *Notes) del(r *http.Request) (database.Note, error) {
- vars := mux.Vars(r)
- noteUUID := vars["noteUUID"]
-
- user := context.User(r.Context())
- if user == nil {
- return database.Note{}, app.ErrLoginRequired
- }
-
- var note database.Note
- if err := n.app.DB.Where("uuid = ? AND user_id = ?", noteUUID, user.ID).Preload("Book").First(¬e).Error; err != nil {
- return database.Note{}, errors.Wrap(err, "finding note")
- }
-
- tx := n.app.DB.Begin()
-
- note, err := n.app.DeleteNote(tx, *user, note)
- if err != nil {
- tx.Rollback()
- return database.Note{}, errors.Wrap(err, "deleting note")
- }
-
- tx.Commit()
-
- return note, nil
-}
-
-// CreateNoteResp is a response for creating a note
-type CreateNoteResp struct {
- Result presenters.Note `json:"result"`
-}
-
-// V3Create creates note
-func (n *Notes) V3Create(w http.ResponseWriter, r *http.Request) {
- note, err := n.create(r)
- if err != nil {
- handleJSONError(w, err, "creating note")
- return
- }
-
- respondJSON(w, http.StatusCreated, CreateNoteResp{
- Result: presenters.PresentNote(note),
- })
-}
-
-type DeleteNoteResp struct {
- Status int `json:"status"`
- Result presenters.Note `json:"result"`
-}
-
-// V3Delete deletes note
-func (n *Notes) V3Delete(w http.ResponseWriter, r *http.Request) {
- note, err := n.del(r)
- if err != nil {
- handleJSONError(w, err, "deleting note")
- return
- }
-
- respondJSON(w, http.StatusOK, DeleteNoteResp{
- Status: http.StatusNoContent,
- Result: presenters.PresentNote(note),
- })
-}
-
-type updateNotePayload struct {
- BookUUID *string `schema:"book_uuid" json:"book_uuid"`
- Content *string `schema:"content" json:"content"`
-}
-
-func validateUpdateNotePayload(p updateNotePayload) error {
- if p.BookUUID == nil && p.Content == nil {
- return app.ErrEmptyUpdate
- }
-
- return nil
-}
-
-func (n *Notes) update(r *http.Request) (database.Note, error) {
- vars := mux.Vars(r)
- noteUUID := vars["noteUUID"]
-
- user := context.User(r.Context())
- if user == nil {
- return database.Note{}, app.ErrLoginRequired
- }
-
- var params updateNotePayload
- err := parseRequestData(r, ¶ms)
- if err != nil {
- return database.Note{}, errors.Wrap(err, "decoding params")
- }
-
- if err := validateUpdateNotePayload(params); err != nil {
- return database.Note{}, err
- }
-
- var note database.Note
- if err := n.app.DB.Where("uuid = ? AND user_id = ?", noteUUID, user.ID).First(¬e).Error; err != nil {
- return database.Note{}, errors.Wrap(err, "finding note")
- }
-
- tx := n.app.DB.Begin()
-
- note, err = n.app.UpdateNote(tx, *user, note, &app.UpdateNoteParams{
- BookUUID: params.BookUUID,
- Content: params.Content,
- })
- if err != nil {
- tx.Rollback()
- return database.Note{}, errors.Wrap(err, "updating note")
- }
-
- var book database.Book
- if err := tx.Where("uuid = ? AND user_id = ?", note.BookUUID, user.ID).First(&book).Error; err != nil {
- tx.Rollback()
- return database.Note{}, errors.Wrapf(err, "finding book %s to preload", note.BookUUID)
- }
-
- tx.Commit()
-
- // preload associations
- note.User = *user
- note.Book = book
-
- return note, nil
-}
-
-type updateNoteResp struct {
- Status int `json:"status"`
- Result presenters.Note `json:"result"`
-}
-
-// V3Update updates a note
-func (n *Notes) V3Update(w http.ResponseWriter, r *http.Request) {
- note, err := n.update(r)
- if err != nil {
- handleJSONError(w, err, "updating note")
- return
- }
-
- respondJSON(w, http.StatusOK, updateNoteResp{
- Status: http.StatusOK,
- Result: presenters.PresentNote(note),
- })
-}
-
-// IndexOptions is a handler for OPTIONS endpoint for notes
-func (n *Notes) IndexOptions(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Access-Control-Allow-Methods", "POST")
- w.Header().Set("Access-Control-Allow-Headers", "Authorization, Version")
-}
diff --git a/pkg/server/controllers/notes_test.go b/pkg/server/controllers/notes_test.go
deleted file mode 100644
index afbca59b..00000000
--- a/pkg/server/controllers/notes_test.go
+++ /dev/null
@@ -1,611 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "net/http"
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/clock"
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/presenters"
- "github.com/dnote/dnote/pkg/server/testutils"
- "github.com/pkg/errors"
-)
-
-func getExpectedNotePayload(n database.Note, b database.Book, u database.User) presenters.Note {
- return presenters.Note{
- UUID: n.UUID,
- CreatedAt: truncateMicro(n.CreatedAt),
- UpdatedAt: truncateMicro(n.UpdatedAt),
- Body: n.Body,
- AddedOn: n.AddedOn,
- USN: n.USN,
- Book: presenters.NoteBook{
- UUID: b.UUID,
- Label: b.Label,
- },
- User: presenters.NoteUser{
- UUID: u.UUID,
- },
- }
-}
-
-func TestGetNotes(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- anotherUser := testutils.SetupUserData(db, "bob@test.com", "pass1234")
-
- b1 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
- b2 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "css",
- }
- testutils.MustExec(t, db.Save(&b2), "preparing b2")
- b3 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: anotherUser.ID,
- Label: "css",
- }
- testutils.MustExec(t, db.Save(&b3), "preparing b3")
-
- n1 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b1.UUID,
- Body: "n1 content",
- USN: 11,
- Deleted: false,
- AddedOn: time.Date(2018, time.August, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
- }
- testutils.MustExec(t, db.Save(&n1), "preparing n1")
- n2 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b1.UUID,
- Body: "n2 content",
- USN: 14,
- Deleted: false,
- AddedOn: time.Date(2018, time.August, 11, 22, 0, 0, 0, time.UTC).UnixNano(),
- }
- testutils.MustExec(t, db.Save(&n2), "preparing n2")
- n3 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b1.UUID,
- Body: "n3 content",
- USN: 17,
- Deleted: false,
- AddedOn: time.Date(2017, time.January, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
- }
- testutils.MustExec(t, db.Save(&n3), "preparing n3")
- n4 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b2.UUID,
- Body: "n4 content",
- USN: 18,
- Deleted: false,
- AddedOn: time.Date(2018, time.September, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
- }
- testutils.MustExec(t, db.Save(&n4), "preparing n4")
- n5 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: anotherUser.ID,
- BookUUID: b3.UUID,
- Body: "n5 content",
- USN: 19,
- Deleted: false,
- AddedOn: time.Date(2018, time.August, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
- }
- testutils.MustExec(t, db.Save(&n5), "preparing n5")
- n6 := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b1.UUID,
- Body: "",
- USN: 11,
- Deleted: true,
- AddedOn: time.Date(2018, time.August, 10, 23, 0, 0, 0, time.UTC).UnixNano(),
- }
- testutils.MustExec(t, db.Save(&n6), "preparing n6")
-
- // Execute
- endpoint := "/api/v3/notes"
-
- req := testutils.MakeReq(server.URL, "GET", fmt.Sprintf("%s?year=2018&month=8", endpoint), "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "")
-
- var payload GetNotesResponse
- if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload"))
- }
-
- var n2Record, n1Record database.Note
- testutils.MustExec(t, db.Where("uuid = ?", n2.UUID).First(&n2Record), "finding n2Record")
- testutils.MustExec(t, db.Where("uuid = ?", n1.UUID).First(&n1Record), "finding n1Record")
-
- expected := GetNotesResponse{
- Notes: []presenters.Note{
- getExpectedNotePayload(n2Record, b1, user),
- getExpectedNotePayload(n1Record, b1, user),
- },
- Total: 2,
- }
-
- assert.DeepEqual(t, payload, expected, "payload mismatch")
-}
-
-func TestGetNote(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "user@test.com", "pass1234")
- anotherUser := testutils.SetupUserData(db, "another@test.com", "pass1234")
-
- b1 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
-
- note := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b1.UUID,
- Body: "note content",
- }
- testutils.MustExec(t, db.Save(¬e), "preparing note")
- deletedNote := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b1.UUID,
- Deleted: true,
- }
- testutils.MustExec(t, db.Save(&deletedNote), "preparing deletedNote")
-
- getURL := func(noteUUID string) string {
- return fmt.Sprintf("/api/v3/notes/%s", noteUUID)
- }
-
- t.Run("owner accessing note", func(t *testing.T) {
- // Execute
- url := getURL(note.UUID)
- req := testutils.MakeReq(server.URL, "GET", url, "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "")
-
- var payload presenters.Note
- if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload"))
- }
-
- var noteRecord database.Note
- testutils.MustExec(t, db.Where("uuid = ?", note.UUID).First(¬eRecord), "finding noteRecord")
-
- expected := getExpectedNotePayload(noteRecord, b1, user)
- assert.DeepEqual(t, payload, expected, "payload mismatch")
- })
-
- t.Run("non-owner accessing note", func(t *testing.T) {
- // Execute
- url := getURL(note.UUID)
- req := testutils.MakeReq(server.URL, "GET", url, "")
- res := testutils.HTTPAuthDo(t, db, req, anotherUser)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusNotFound, "")
-
- body, err := io.ReadAll(res.Body)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reading body"))
- }
-
- assert.DeepEqual(t, string(body), "not found\n", "payload mismatch")
- })
-
- t.Run("guest accessing note", func(t *testing.T) {
- // Execute
- url := getURL(note.UUID)
- req := testutils.MakeReq(server.URL, "GET", url, "")
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
-
- body, err := io.ReadAll(res.Body)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reading body"))
- }
-
- assert.DeepEqual(t, string(body), "unauthorized\n", "payload mismatch")
- })
-
- t.Run("nonexistent", func(t *testing.T) {
- // Execute
- url := getURL("somerandomstring")
- req := testutils.MakeReq(server.URL, "GET", url, "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusNotFound, "")
-
- body, err := io.ReadAll(res.Body)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reading body"))
- }
-
- assert.DeepEqual(t, string(body), "not found\n", "payload mismatch")
- })
-
- t.Run("deleted", func(t *testing.T) {
- // Execute
- url := getURL(deletedNote.UUID)
- req := testutils.MakeReq(server.URL, "GET", url, "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusNotFound, "")
-
- body, err := io.ReadAll(res.Body)
- if err != nil {
- t.Fatal(errors.Wrap(err, "reading body"))
- }
-
- assert.DeepEqual(t, string(body), "not found\n", "payload mismatch")
- })
-}
-
-func TestCreateNote(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", 101), "preparing user max_usn")
-
- b1 := database.Book{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- Label: "js",
- USN: 58,
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
-
- // Execute
-
- dat := fmt.Sprintf(`{"book_uuid": "%s", "content": "note content"}`, b1.UUID)
- req := testutils.MakeReq(server.URL, "POST", "/api/v3/notes", dat)
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusCreated, "")
-
- var noteRecord database.Note
- var bookRecord database.Book
- var userRecord database.User
- var bookCount, noteCount int64
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), "counting books")
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), "counting notes")
- testutils.MustExec(t, db.First(¬eRecord), "finding note")
- testutils.MustExec(t, db.Where("id = ?", b1.ID).First(&bookRecord), "finding book")
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), "finding user record")
-
- assert.Equalf(t, bookCount, int64(1), "book count mismatch")
- assert.Equalf(t, noteCount, int64(1), "note count mismatch")
-
- assert.Equal(t, bookRecord.Label, b1.Label, "book name mismatch")
- assert.Equal(t, bookRecord.UUID, b1.UUID, "book uuid mismatch")
- assert.Equal(t, bookRecord.UserID, b1.UserID, "book user_id mismatch")
- assert.Equal(t, bookRecord.USN, 58, "book usn mismatch")
-
- assert.NotEqual(t, noteRecord.UUID, "", "note uuid should have been generated")
- assert.Equal(t, noteRecord.BookUUID, b1.UUID, "note book_uuid mismatch")
- assert.Equal(t, noteRecord.Body, "note content", "note content mismatch")
- assert.Equal(t, noteRecord.USN, 102, "note usn mismatch")
-}
-
-func TestDeleteNote(t *testing.T) {
- b1UUID := "37868a8e-a844-4265-9a4f-0be598084733"
-
- testCases := []struct {
- content string
- deleted bool
- originalUSN int
- expectedUSN int
- expectedMaxUSN int
- }{
- {
- content: "n1 content",
- deleted: false,
- originalUSN: 12,
- expectedUSN: 982,
- expectedMaxUSN: 982,
- },
- {
- content: "",
- deleted: true,
- originalUSN: 12,
- expectedUSN: 982,
- expectedMaxUSN: 982,
- },
- }
-
- for idx, tc := range testCases {
- t.Run(fmt.Sprintf("test case %d", idx), func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
- testutils.MustExec(t, db.Model(&user).Update("max_usn", 981), "preparing user max_usn")
-
- b1 := database.Book{
- UUID: b1UUID,
- UserID: user.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
- note := database.Note{
- UUID: testutils.MustUUID(t),
- UserID: user.ID,
- BookUUID: b1.UUID,
- Body: tc.content,
- Deleted: tc.deleted,
- USN: tc.originalUSN,
- }
- testutils.MustExec(t, db.Save(¬e), "preparing note")
-
- // Execute
- endpoint := fmt.Sprintf("/api/v3/notes/%s", note.UUID)
- req := testutils.MakeReq(server.URL, "DELETE", endpoint, "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "")
-
- var bookRecord database.Book
- var noteRecord database.Note
- var userRecord database.User
- var bookCount, noteCount int64
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), "counting books")
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), "counting notes")
- testutils.MustExec(t, db.Where("uuid = ?", note.UUID).First(¬eRecord), "finding note")
- testutils.MustExec(t, db.Where("id = ?", b1.ID).First(&bookRecord), "finding book")
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), "finding user record")
-
- assert.Equalf(t, bookCount, int64(1), "book count mismatch")
- assert.Equalf(t, noteCount, int64(1), "note count mismatch")
-
- assert.Equal(t, noteRecord.UUID, note.UUID, "note uuid mismatch for test case")
- assert.Equal(t, noteRecord.Body, "", "note content mismatch for test case")
- assert.Equal(t, noteRecord.Deleted, true, "note deleted mismatch for test case")
- assert.Equal(t, noteRecord.BookUUID, note.BookUUID, "note book_uuid mismatch for test case")
- assert.Equal(t, noteRecord.UserID, note.UserID, "note user_id mismatch for test case")
- assert.Equal(t, noteRecord.USN, tc.expectedUSN, "note usn mismatch for test case")
-
- assert.Equal(t, userRecord.MaxUSN, tc.expectedMaxUSN, "user max_usn mismatch for test case")
- })
- }
-}
-
-func TestUpdateNote(t *testing.T) {
- updatedBody := "some updated content"
-
- b1UUID := "37868a8e-a844-4265-9a4f-0be598084733"
- b2UUID := "8f3bd424-6aa5-4ed5-910d-e5b38ab09f8c"
-
- type payloadData struct {
- Content *string `schema:"content" json:"content,omitempty"`
- BookUUID *string `schema:"book_uuid" json:"book_uuid,omitempty"`
- }
-
- testCases := []struct {
- payload testutils.PayloadWrapper
- noteUUID string
- noteBookUUID string
- noteBody string
- noteDeleted bool
- expectedNoteBody string
- expectedNoteBookName string
- expectedNoteBookUUID string
- }{
- {
- payload: testutils.PayloadWrapper{
- Data: payloadData{
- Content: &updatedBody,
- },
- },
- noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
- noteBookUUID: b1UUID,
- noteBody: "original content",
- noteDeleted: false,
- expectedNoteBookUUID: b1UUID,
- expectedNoteBody: "some updated content",
- expectedNoteBookName: "css",
- },
- {
- payload: testutils.PayloadWrapper{
- Data: payloadData{
- BookUUID: &b1UUID,
- },
- },
- noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
- noteBookUUID: b1UUID,
- noteBody: "original content",
- noteDeleted: false,
- expectedNoteBookUUID: b1UUID,
- expectedNoteBody: "original content",
- expectedNoteBookName: "css",
- },
- {
- payload: testutils.PayloadWrapper{
- Data: payloadData{
- BookUUID: &b2UUID,
- },
- },
- noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
- noteBookUUID: b1UUID,
- noteBody: "original content",
- noteDeleted: false,
- expectedNoteBookUUID: b2UUID,
- expectedNoteBody: "original content",
- expectedNoteBookName: "js",
- },
- {
- payload: testutils.PayloadWrapper{
- Data: payloadData{
- BookUUID: &b2UUID,
- Content: &updatedBody,
- },
- },
- noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
- noteBookUUID: b1UUID,
- noteBody: "original content",
- noteDeleted: false,
- expectedNoteBookUUID: b2UUID,
- expectedNoteBody: "some updated content",
- expectedNoteBookName: "js",
- },
- {
- payload: testutils.PayloadWrapper{
- Data: payloadData{
- BookUUID: &b1UUID,
- Content: &updatedBody,
- },
- },
- noteUUID: "ab50aa32-b232-40d8-b10f-10a7f9134053",
- noteBookUUID: b1UUID,
- noteBody: "",
- noteDeleted: true,
- expectedNoteBookUUID: b1UUID,
- expectedNoteBody: updatedBody,
- expectedNoteBookName: "js",
- },
- }
-
- for idx, tc := range testCases {
- t.Run(fmt.Sprintf("test case %d", idx), func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.DB = db
- a.Clock = clock.NewMock()
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
-
- testutils.MustExec(t, db.Model(&user).Update("max_usn", 101), "preparing user max_usn")
-
- b1 := database.Book{
- UUID: b1UUID,
- UserID: user.ID,
- Label: "css",
- }
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
- b2 := database.Book{
- UUID: b2UUID,
- UserID: user.ID,
- Label: "js",
- }
- testutils.MustExec(t, db.Save(&b2), "preparing b2")
-
- note := database.Note{
- UUID: tc.noteUUID,
- UserID: user.ID,
- BookUUID: tc.noteBookUUID,
- Body: tc.noteBody,
- Deleted: tc.noteDeleted,
- }
- testutils.MustExec(t, db.Save(¬e), "preparing note")
-
- // Execute
- var req *http.Request
-
- endpoint := fmt.Sprintf("/api/v3/notes/%s", note.UUID)
- req = testutils.MakeReq(server.URL, "PATCH", endpoint, tc.payload.ToJSON(t))
-
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "status code mismatch for test case")
-
- var bookRecord database.Book
- var noteRecord database.Note
- var userRecord database.User
- var noteCount, bookCount int64
- testutils.MustExec(t, db.Model(&database.Book{}).Count(&bookCount), "counting books")
- testutils.MustExec(t, db.Model(&database.Note{}).Count(¬eCount), "counting notes")
- testutils.MustExec(t, db.Where("uuid = ?", note.UUID).First(¬eRecord), "finding note")
- testutils.MustExec(t, db.Where("id = ?", b1.ID).First(&bookRecord), "finding book")
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&userRecord), "finding user record")
-
- assert.Equalf(t, bookCount, int64(2), "book count mismatch")
- assert.Equalf(t, noteCount, int64(1), "note count mismatch")
-
- assert.Equal(t, noteRecord.UUID, tc.noteUUID, "note uuid mismatch for test case")
- assert.Equal(t, noteRecord.Body, tc.expectedNoteBody, "note content mismatch for test case")
- assert.Equal(t, noteRecord.BookUUID, tc.expectedNoteBookUUID, "note book_uuid mismatch for test case")
- assert.Equal(t, noteRecord.USN, 102, "note usn mismatch for test case")
-
- assert.Equal(t, userRecord.MaxUSN, 102, "user max_usn mismatch for test case")
- })
- }
-}
diff --git a/pkg/server/controllers/routes.go b/pkg/server/controllers/routes.go
deleted file mode 100644
index 3552d081..00000000
--- a/pkg/server/controllers/routes.go
+++ /dev/null
@@ -1,139 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "net/http"
-
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/assets"
- mw "github.com/dnote/dnote/pkg/server/middleware"
- "github.com/gorilla/mux"
- "github.com/pkg/errors"
-)
-
-// Route represents a single route
-type Route struct {
- Method string
- Pattern string
- Handler http.HandlerFunc
- RateLimit bool
-}
-
-// RouteConfig is the configuration for routes
-type RouteConfig struct {
- Controllers *Controllers
- WebRoutes []Route
- APIRoutes []Route
-}
-
-// NewWebRoutes returns a new web routes
-func NewWebRoutes(a *app.App, c *Controllers) []Route {
- redirectGuest := &mw.AuthParams{RedirectGuestsToLogin: true}
-
- ret := []Route{
- {"GET", "/", mw.Auth(a.DB, c.Users.Settings, redirectGuest), true},
- {"GET", "/about", mw.Auth(a.DB, c.Users.About, redirectGuest), true},
- {"GET", "/login", mw.GuestOnly(a.DB, c.Users.NewLogin), true},
- {"POST", "/login", mw.GuestOnly(a.DB, c.Users.Login), true},
- {"POST", "/logout", c.Users.Logout, true},
-
- {"GET", "/password-reset", c.Users.PasswordResetView.ServeHTTP, true},
- {"PATCH", "/password-reset", c.Users.PasswordReset, true},
- {"GET", "/password-reset/{token}", c.Users.PasswordResetConfirm, true},
- {"POST", "/reset-token", c.Users.CreateResetToken, true},
- {"PATCH", "/account/profile", mw.Auth(a.DB, c.Users.ProfileUpdate, nil), true},
- {"PATCH", "/account/password", mw.Auth(a.DB, c.Users.PasswordUpdate, nil), true},
-
- {"GET", "/health", c.Health.Index, true},
- }
-
- if !a.DisableRegistration {
- ret = append(ret, Route{"GET", "/join", c.Users.New, true})
- ret = append(ret, Route{"POST", "/join", c.Users.Create, true})
- }
-
- return ret
-}
-
-// NewAPIRoutes returns a new api routes
-func NewAPIRoutes(a *app.App, c *Controllers) []Route {
- return []Route{
- // v3
- {"GET", "/v3/sync/fragment", mw.Auth(a.DB, c.Sync.GetSyncFragment, nil), false},
- {"GET", "/v3/sync/state", mw.Auth(a.DB, c.Sync.GetSyncState, nil), false},
- {"POST", "/v3/signin", c.Users.V3Login, true},
- {"POST", "/v3/signout", c.Users.V3Logout, true},
- {"OPTIONS", "/v3/signout", c.Users.logoutOptions, true},
- {"GET", "/v3/notes", mw.Auth(a.DB, c.Notes.V3Index, nil), true},
- {"GET", "/v3/notes/{noteUUID}", mw.Auth(a.DB, c.Notes.V3Show, nil), true},
- {"POST", "/v3/notes", mw.Auth(a.DB, c.Notes.V3Create, nil), true},
- {"DELETE", "/v3/notes/{noteUUID}", mw.Auth(a.DB, c.Notes.V3Delete, nil), true},
- {"PATCH", "/v3/notes/{noteUUID}", mw.Auth(a.DB, c.Notes.V3Update, nil), true},
- {"OPTIONS", "/v3/notes", c.Notes.IndexOptions, true},
- {"GET", "/v3/books", mw.Auth(a.DB, c.Books.V3Index, nil), true},
- {"GET", "/v3/books/{bookUUID}", mw.Auth(a.DB, c.Books.V3Show, nil), true},
- {"POST", "/v3/books", mw.Auth(a.DB, c.Books.V3Create, nil), true},
- {"PATCH", "/v3/books/{bookUUID}", mw.Auth(a.DB, c.Books.V3Update, nil), true},
- {"DELETE", "/v3/books/{bookUUID}", mw.Auth(a.DB, c.Books.V3Delete, nil), true},
- {"OPTIONS", "/v3/books", c.Books.IndexOptions, true},
- }
-}
-
-func registerRoutes(router *mux.Router, wrapper mw.Middleware, app *app.App, routes []Route) {
- for _, route := range routes {
- wrappedHandler := wrapper(route.Handler, app, route.RateLimit)
-
- router.
- Handle(route.Pattern, wrappedHandler).
- Methods(route.Method)
- }
-}
-
-// NewRouter creates and returns a new router
-func NewRouter(app *app.App, rc RouteConfig) (http.Handler, error) {
- if err := app.Validate(); err != nil {
- return nil, errors.Wrap(err, "validating the app parameters")
- }
-
- router := mux.NewRouter().StrictSlash(true)
-
- webRouter := router.PathPrefix("/").Subrouter()
- apiRouter := router.PathPrefix("/api").Subrouter()
- registerRoutes(webRouter, mw.WebMw, app, rc.WebRoutes)
- registerRoutes(apiRouter, mw.APIMw, app, rc.APIRoutes)
-
- router.PathPrefix("/api/v1").Handler(mw.ApplyLimit(mw.NotSupported, true))
- router.PathPrefix("/api/v2").Handler(mw.ApplyLimit(mw.NotSupported, true))
-
- // static
- staticFs, err := assets.GetStaticFS()
- if err != nil {
- return nil, errors.Wrap(err, "getting the filesystem for static files")
- }
-
- staticHandler := http.StripPrefix("/static/", http.FileServer(http.FS(staticFs)))
- router.PathPrefix("/static/").Handler(staticHandler)
-
- router.HandleFunc("/robots.txt", func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte("User-agent: *\nAllow: /"))
- })
-
- // catch-all
- router.PathPrefix("/").HandlerFunc(rc.Controllers.Static.NotFound)
-
- return mw.Global(router), nil
-}
diff --git a/pkg/server/controllers/routes_test.go b/pkg/server/controllers/routes_test.go
deleted file mode 100644
index 0d146fe6..00000000
--- a/pkg/server/controllers/routes_test.go
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "net/http"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/clock"
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/testutils"
-)
-
-func TestNotSupportedVersions(t *testing.T) {
- testCases := []struct {
- path string
- }{
- // v1
- {
- path: "/api/v1",
- },
- {
- path: "/api/v1/foo",
- },
- {
- path: "/api/v1/bar/baz",
- },
- // v2
- {
- path: "/api/v2",
- },
- {
- path: "/api/v2/foo",
- },
- {
- path: "/api/v2/bar/baz",
- },
- }
-
- // setup
- db := testutils.InitMemoryDB(t)
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- for _, tc := range testCases {
- t.Run(tc.path, func(t *testing.T) {
- // execute
- req := testutils.MakeReq(server.URL, "GET", tc.path, "")
- res := testutils.HTTPDo(t, req)
-
- // test
- assert.Equal(t, res.StatusCode, http.StatusGone, "status code mismatch")
- })
- }
-}
diff --git a/pkg/server/controllers/static.go b/pkg/server/controllers/static.go
deleted file mode 100644
index 42872438..00000000
--- a/pkg/server/controllers/static.go
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "net/http"
- "strings"
-
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/views"
-)
-
-// NewStatic creates a new Static controller.
-func NewStatic(app *app.App, viewEngine *views.Engine) *Static {
- return &Static{
- NotFoundView: viewEngine.NewView(app, views.Config{Title: "Not Found", Layout: "base"}, "static/not_found"),
- }
-}
-
-// Static is a static controller
-type Static struct {
- NotFoundView *views.View
-}
-
-// NotFound is a catch-all handler for requests with no matching handler
-func (s *Static) NotFound(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusNotFound)
-
- accept := r.Header.Get("Accept")
-
- if strings.Contains(accept, "text/html") {
- s.NotFoundView.Render(w, r, nil, http.StatusOK)
- } else {
- statusText := http.StatusText(http.StatusNotFound)
- w.Write([]byte(statusText))
- }
-}
diff --git a/pkg/server/controllers/testutils.go b/pkg/server/controllers/testutils.go
deleted file mode 100644
index 5da11a41..00000000
--- a/pkg/server/controllers/testutils.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "net/http/httptest"
- "testing"
-
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/pkg/errors"
-)
-
-// MustNewServer is a test utility function to initialize a new server
-// with the given app
-func MustNewServer(t *testing.T, a *app.App) *httptest.Server {
- server, err := NewServer(a)
- if err != nil {
- t.Fatal(errors.Wrap(err, "initializing router"))
- }
-
- return server
-}
-
-func NewServer(a *app.App) (*httptest.Server, error) {
- ctl := New(a)
- rc := RouteConfig{
- WebRoutes: NewWebRoutes(a, ctl),
- APIRoutes: NewAPIRoutes(a, ctl),
- Controllers: ctl,
- }
- r, err := NewRouter(a, rc)
- if err != nil {
- return nil, errors.Wrap(err, "initializing router")
- }
-
- server := httptest.NewServer(r)
-
- return server, nil
-}
diff --git a/pkg/server/controllers/users.go b/pkg/server/controllers/users.go
deleted file mode 100644
index 26881668..00000000
--- a/pkg/server/controllers/users.go
+++ /dev/null
@@ -1,556 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "errors"
- "net/http"
- "net/url"
- "time"
-
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/buildinfo"
- "github.com/dnote/dnote/pkg/server/context"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/helpers"
- "github.com/dnote/dnote/pkg/server/log"
- "github.com/dnote/dnote/pkg/server/token"
- "github.com/dnote/dnote/pkg/server/views"
- "github.com/gorilla/mux"
- "gorm.io/gorm"
- pkgErrors "github.com/pkg/errors"
- "golang.org/x/crypto/bcrypt"
-)
-
-var commonHelpers = map[string]interface{}{
- "getPathWithReferrer": func(base string, referrer string) string {
- if referrer == "" {
- return base
- }
-
- query := url.Values{}
- query.Set("referrer", referrer)
-
- return helpers.GetPath(base, &query)
- },
-}
-
-// NewUsers creates a new Users controller.
-// It panics if the necessary templates are not parsed.
-func NewUsers(app *app.App, viewEngine *views.Engine) *Users {
- return &Users{
- NewView: viewEngine.NewView(app,
- views.Config{Title: "Join", Layout: "base", HelperFuncs: commonHelpers, AlertInBody: true},
- "users/new",
- ),
- LoginView: viewEngine.NewView(app,
- views.Config{Title: "Sign In", Layout: "base", HelperFuncs: commonHelpers, AlertInBody: true},
- "users/login",
- ),
- PasswordResetView: viewEngine.NewView(app,
- views.Config{Title: "Reset Password", Layout: "base", HelperFuncs: commonHelpers, AlertInBody: true},
- "users/password_reset",
- ),
- PasswordResetConfirmView: viewEngine.NewView(app,
- views.Config{Title: "Reset Password", Layout: "base", HelperFuncs: commonHelpers, AlertInBody: true},
- "users/password_reset_confirm",
- ),
- SettingView: viewEngine.NewView(app,
- views.Config{Layout: "base", HelperFuncs: commonHelpers, HeaderTemplate: "navbar"},
- "users/settings",
- ),
- AboutView: viewEngine.NewView(app,
- views.Config{Title: "About", Layout: "base", HelperFuncs: commonHelpers, HeaderTemplate: "navbar"},
- "users/settings_about",
- ),
- app: app,
- }
-}
-
-// Users is a user controller.
-type Users struct {
- NewView *views.View
- LoginView *views.View
- SettingView *views.View
- AboutView *views.View
- PasswordResetView *views.View
- PasswordResetConfirmView *views.View
- app *app.App
-}
-
-// New renders user registration page
-func (u *Users) New(w http.ResponseWriter, r *http.Request) {
- vd := getDataWithReferrer(r)
- u.NewView.Render(w, r, &vd, http.StatusOK)
-}
-
-// RegistrationForm is the form data for registering
-type RegistrationForm struct {
- Email string `schema:"email"`
- Password string `schema:"password"`
- PasswordConfirmation string `schema:"password_confirmation"`
-}
-
-// Create handles register
-func (u *Users) Create(w http.ResponseWriter, r *http.Request) {
- vd := getDataWithReferrer(r)
-
- var form RegistrationForm
- if err := parseForm(r, &form); err != nil {
- handleHTMLError(w, r, err, "parsing form", u.NewView, vd)
- return
- }
-
- vd.Yield["Email"] = form.Email
-
- user, err := u.app.CreateUser(form.Email, form.Password, form.PasswordConfirmation)
- if err != nil {
- handleHTMLError(w, r, err, "creating user", u.NewView, vd)
- return
- }
-
- session, err := u.app.SignIn(&user)
- if err != nil {
- handleHTMLError(w, r, err, "signing in a user", u.LoginView, vd)
- return
- }
-
- if err := u.app.SendWelcomeEmail(form.Email); err != nil {
- log.ErrorWrap(err, "sending welcome email")
- }
-
- setSessionCookie(w, session.Key, session.ExpiresAt)
-
- dest := getPathOrReferrer("/", r)
- http.Redirect(w, r, dest, http.StatusFound)
-}
-
-// LoginForm is the form data for log in
-type LoginForm struct {
- Email string `schema:"email" json:"email"`
- Password string `schema:"password" json:"password"`
-}
-
-func (u *Users) login(form LoginForm) (*database.Session, error) {
- if form.Email == "" {
- return nil, app.ErrEmailRequired
- }
- if form.Password == "" {
- return nil, app.ErrPasswordRequired
- }
-
- user, err := u.app.Authenticate(form.Email, form.Password)
- if err != nil {
- // If the user is not found, treat it as invalid login
- if err == app.ErrNotFound {
- return nil, app.ErrLoginInvalid
- }
-
- return nil, err
- }
-
- s, err := u.app.SignIn(user)
- if err != nil {
- return nil, err
- }
-
- return s, nil
-}
-
-func getPathOrReferrer(path string, r *http.Request) string {
- q := r.URL.Query()
- referrer := q.Get("referrer")
-
- if referrer == "" {
- return path
- }
-
- return referrer
-}
-
-func getDataWithReferrer(r *http.Request) views.Data {
- vd := views.Data{}
-
- vd.Yield = map[string]interface{}{
- "Referrer": r.URL.Query().Get("referrer"),
- }
-
- return vd
-}
-
-// NewLogin renders user login page
-func (u *Users) NewLogin(w http.ResponseWriter, r *http.Request) {
- vd := getDataWithReferrer(r)
- u.LoginView.Render(w, r, &vd, http.StatusOK)
-}
-
-// Login handles login
-func (u *Users) Login(w http.ResponseWriter, r *http.Request) {
- vd := getDataWithReferrer(r)
-
- var form LoginForm
- if err := parseRequestData(r, &form); err != nil {
- handleHTMLError(w, r, err, "parsing payload", u.LoginView, vd)
- return
- }
-
- session, err := u.login(form)
- if err != nil {
- vd.Yield["Email"] = form.Email
- handleHTMLError(w, r, err, "logging in user", u.LoginView, vd)
- return
- }
-
- setSessionCookie(w, session.Key, session.ExpiresAt)
-
- dest := getPathOrReferrer("/", r)
- http.Redirect(w, r, dest, http.StatusFound)
-}
-
-// V3Login handles login
-func (u *Users) V3Login(w http.ResponseWriter, r *http.Request) {
- var form LoginForm
- if err := parseRequestData(r, &form); err != nil {
- handleJSONError(w, err, "parsing payload")
- return
- }
-
- session, err := u.login(form)
- if err != nil {
- handleJSONError(w, err, "logging in user")
- return
- }
-
- respondWithSession(w, http.StatusOK, session)
-}
-
-func (u *Users) logout(r *http.Request) (bool, error) {
- key, err := GetCredential(r)
- if err != nil {
- return false, pkgErrors.Wrap(err, "getting credentials")
- }
-
- if key == "" {
- return false, nil
- }
-
- if err = u.app.DeleteSession(key); err != nil {
- return false, pkgErrors.Wrap(err, "deleting session")
- }
-
- return true, nil
-}
-
-// Logout handles logout
-func (u *Users) Logout(w http.ResponseWriter, r *http.Request) {
- var vd views.Data
-
- ok, err := u.logout(r)
- if err != nil {
- handleHTMLError(w, r, err, "logging out", u.LoginView, vd)
- return
- }
-
- if ok {
- unsetSessionCookie(w)
- }
-
- http.Redirect(w, r, "/login", http.StatusFound)
-}
-
-// V3Logout handles logout via API
-func (u *Users) V3Logout(w http.ResponseWriter, r *http.Request) {
- ok, err := u.logout(r)
- if err != nil {
- handleJSONError(w, err, "logging out")
- return
- }
-
- if ok {
- unsetSessionCookie(w)
- }
-
- w.WriteHeader(http.StatusNoContent)
-}
-
-type createResetTokenPayload struct {
- Email string `schema:"email" json:"email"`
-}
-
-func (u *Users) CreateResetToken(w http.ResponseWriter, r *http.Request) {
- vd := views.Data{}
-
- var form createResetTokenPayload
- if err := parseForm(r, &form); err != nil {
- handleHTMLError(w, r, err, "parsing form", u.PasswordResetView, vd)
- return
- }
-
- if form.Email == "" {
- handleHTMLError(w, r, app.ErrEmailRequired, "email is not provided", u.PasswordResetView, vd)
- return
- }
-
- var user database.User
- err := u.app.DB.Where("email = ?", form.Email).First(&user).Error
- if errors.Is(err, gorm.ErrRecordNotFound) {
- return
- }
- if err != nil {
- handleHTMLError(w, r, err, "finding user", u.PasswordResetView, vd)
- return
- }
-
- resetToken, err := token.Create(u.app.DB, user.ID, database.TokenTypeResetPassword)
- if err != nil {
- handleHTMLError(w, r, err, "generating token", u.PasswordResetView, vd)
- return
- }
-
- if err := u.app.SendPasswordResetEmail(user.Email.String, resetToken.Value); err != nil {
- handleHTMLError(w, r, err, "sending password reset email", u.PasswordResetView, vd)
- return
- }
-
- alert := views.Alert{
- Level: views.AlertLvlSuccess,
- Message: "Check your email for a link to reset your password.",
- }
- views.RedirectAlert(w, r, "/password-reset", http.StatusFound, alert)
-}
-
-// PasswordResetConfirm renders password reset view
-func (u *Users) PasswordResetConfirm(w http.ResponseWriter, r *http.Request) {
- vd := views.Data{}
-
- vars := mux.Vars(r)
- token := vars["token"]
-
- vd.Yield = map[string]interface{}{
- "Token": token,
- }
-
- u.PasswordResetConfirmView.Render(w, r, &vd, http.StatusOK)
-}
-
-type resetPasswordPayload struct {
- Password string `schema:"password" json:"password"`
- PasswordConfirmation string `schema:"password_confirmation" json:"password_confirmation"`
- Token string `schema:"token" json:"token"`
-}
-
-// PasswordReset renders password reset view
-func (u *Users) PasswordReset(w http.ResponseWriter, r *http.Request) {
- vd := views.Data{}
-
- var params resetPasswordPayload
- if err := parseForm(r, ¶ms); err != nil {
- handleHTMLError(w, r, err, "parsing params", u.NewView, vd)
- return
- }
-
- vd.Yield = map[string]interface{}{
- "Token": params.Token,
- }
-
- if params.Password != params.PasswordConfirmation {
- handleHTMLError(w, r, app.ErrPasswordConfirmationMismatch, "password mismatch", u.PasswordResetConfirmView, vd)
- return
- }
-
- var token database.Token
- err := u.app.DB.Where("value = ? AND type =? AND used_at IS NULL", params.Token, database.TokenTypeResetPassword).First(&token).Error
- if errors.Is(err, gorm.ErrRecordNotFound) {
- handleHTMLError(w, r, app.ErrInvalidToken, "invalid token", u.PasswordResetConfirmView, vd)
- return
- }
- if err != nil {
- handleHTMLError(w, r, err, "finding token", u.PasswordResetConfirmView, vd)
- return
- }
-
- if token.UsedAt != nil {
- handleHTMLError(w, r, app.ErrInvalidToken, "invalid token", u.PasswordResetConfirmView, vd)
- return
- }
-
- // Expire after 10 minutes
- if time.Since(token.CreatedAt).Minutes() > 10 {
- handleHTMLError(w, r, app.ErrPasswordResetTokenExpired, "expired token", u.PasswordResetConfirmView, vd)
- return
- }
-
- var user database.User
- if err := u.app.DB.Where("id = ?", token.UserID).First(&user).Error; err != nil {
- handleHTMLError(w, r, err, "finding user", u.PasswordResetConfirmView, vd)
- return
- }
-
- tx := u.app.DB.Begin()
-
- // Update the password
- if err := app.UpdateUserPassword(tx, &user, params.Password); err != nil {
- tx.Rollback()
- handleHTMLError(w, r, err, "updating password", u.PasswordResetConfirmView, vd)
- return
- }
-
- if err := tx.Model(&token).Update("used_at", time.Now()).Error; err != nil {
- tx.Rollback()
- handleHTMLError(w, r, err, "updating password reset token", u.PasswordResetConfirmView, vd)
- return
- }
-
- if err := u.app.DeleteUserSessions(tx, user.ID); err != nil {
- tx.Rollback()
- handleHTMLError(w, r, err, "deleting user sessions", u.PasswordResetConfirmView, vd)
- return
- }
-
- tx.Commit()
-
- alert := views.Alert{
- Level: views.AlertLvlSuccess,
- Message: "Password reset successful",
- }
- views.RedirectAlert(w, r, "/login", http.StatusFound, alert)
-
- if err := u.app.SendPasswordResetAlertEmail(user.Email.String); err != nil {
- log.ErrorWrap(err, "sending password reset email")
- }
-}
-
-func (u *Users) logoutOptions(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Access-Control-Allow-Methods", "POST")
- w.Header().Set("Access-Control-Allow-Headers", "Authorization, Version")
-}
-
-func (u *Users) Settings(w http.ResponseWriter, r *http.Request) {
- vd := views.Data{}
-
- u.SettingView.Render(w, r, &vd, http.StatusOK)
-}
-
-func (u *Users) About(w http.ResponseWriter, r *http.Request) {
- vd := views.Data{}
-
- vd.Yield = map[string]interface{}{
- "Version": buildinfo.Version,
- }
-
- u.AboutView.Render(w, r, &vd, http.StatusOK)
-}
-
-type updatePasswordForm struct {
- OldPassword string `schema:"old_password"`
- NewPassword string `schema:"new_password"`
- NewPasswordConfirmation string `schema:"new_password_confirmation"`
-}
-
-func (u *Users) PasswordUpdate(w http.ResponseWriter, r *http.Request) {
- vd := views.Data{}
-
- user := context.User(r.Context())
- if user == nil {
- handleHTMLError(w, r, app.ErrLoginRequired, "No authenticated user found", u.SettingView, vd)
- return
- }
-
- var form updatePasswordForm
- if err := parseRequestData(r, &form); err != nil {
- handleHTMLError(w, r, err, "parsing payload", u.LoginView, vd)
- return
- }
-
- if form.OldPassword == "" || form.NewPassword == "" {
- handleHTMLError(w, r, app.ErrInvalidPasswordChangeInput, "invalid params", u.SettingView, vd)
- return
- }
- if form.NewPassword != form.NewPasswordConfirmation {
- handleHTMLError(w, r, app.ErrPasswordConfirmationMismatch, "passwords do not match", u.SettingView, vd)
- return
- }
-
- password := []byte(form.OldPassword)
- if err := bcrypt.CompareHashAndPassword([]byte(user.Password.String), password); err != nil {
- log.WithFields(log.Fields{
- "user_id": user.ID,
- }).Warn("invalid password update attempt")
- handleHTMLError(w, r, app.ErrInvalidPassword, "invalid password", u.SettingView, vd)
- return
- }
-
- if err := app.UpdateUserPassword(u.app.DB, user, form.NewPassword); err != nil {
- handleHTMLError(w, r, err, "updating password", u.SettingView, vd)
- return
- }
-
- alert := views.Alert{
- Level: views.AlertLvlSuccess,
- Message: "Password change successful",
- }
- views.RedirectAlert(w, r, "/", http.StatusFound, alert)
-}
-
-type updateProfileForm struct {
- Email string `schema:"email"`
- Password string `schema:"password"`
-}
-
-func (u *Users) ProfileUpdate(w http.ResponseWriter, r *http.Request) {
- vd := views.Data{}
-
- user := context.User(r.Context())
- if user == nil {
- handleHTMLError(w, r, app.ErrLoginRequired, "No authenticated user found", u.SettingView, vd)
- return
- }
-
- var form updateProfileForm
- if err := parseRequestData(r, &form); err != nil {
- handleHTMLError(w, r, err, "parsing payload", u.SettingView, vd)
- return
- }
-
- password := []byte(form.Password)
- if err := bcrypt.CompareHashAndPassword([]byte(user.Password.String), password); err != nil {
- log.WithFields(log.Fields{
- "user_id": user.ID,
- }).Warn("invalid email update attempt")
- handleHTMLError(w, r, app.ErrInvalidPassword, "Wrong password", u.SettingView, vd)
- return
- }
-
- // Validate
- if len(form.Email) > 60 {
- handleHTMLError(w, r, app.ErrEmailTooLong, "Email is too long", u.SettingView, vd)
- return
- }
-
- user.Email.String = form.Email
-
- if err := u.app.DB.Save(&user).Error; err != nil {
- handleHTMLError(w, r, err, "saving user", u.SettingView, vd)
- return
- }
-
- alert := views.Alert{
- Level: views.AlertLvlSuccess,
- Message: "Email change successful",
- }
- views.RedirectAlert(w, r, "/", http.StatusFound, alert)
-}
-
diff --git a/pkg/server/controllers/users_test.go b/pkg/server/controllers/users_test.go
deleted file mode 100644
index f5ddf5b5..00000000
--- a/pkg/server/controllers/users_test.go
+++ /dev/null
@@ -1,991 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers
-
-import (
- "encoding/json"
- "fmt"
- "net/http"
- "net/http/httptest"
- "net/url"
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/clock"
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/testutils"
- "github.com/pkg/errors"
- "golang.org/x/crypto/bcrypt"
- "gorm.io/gorm"
-)
-
-func assertResponseSessionCookie(t *testing.T, db *gorm.DB, res *http.Response) {
- var sessionCount int64
- var session database.Session
- testutils.MustExec(t, db.Model(&database.Session{}).Count(&sessionCount), "counting session")
- testutils.MustExec(t, db.First(&session), "getting session")
-
- c := testutils.GetCookieByName(res.Cookies(), "id")
- assert.Equal(t, c.Value, session.Key, "session key mismatch")
- assert.Equal(t, c.Path, "/", "session path mismatch")
- assert.Equal(t, c.HttpOnly, true, "session HTTPOnly mismatch")
- assert.Equal(t, c.Expires.Unix(), session.ExpiresAt.Unix(), "session Expires mismatch")
-}
-
-func TestJoin(t *testing.T) {
- testCases := []struct {
- email string
- password string
- passwordConfirmation string
- }{
- {
- email: "alice@example.com",
- password: "pass1234",
- passwordConfirmation: "pass1234",
- },
- {
- email: "bob@example.com",
- password: "Y9EwmjH@Jq6y5a64MSACUoM4w7SAhzvY",
- passwordConfirmation: "Y9EwmjH@Jq6y5a64MSACUoM4w7SAhzvY",
- },
- {
- email: "chuck@example.com",
- password: "e*H@kJi^vXbWEcD9T5^Am!Y@7#Po2@PC",
- passwordConfirmation: "e*H@kJi^vXbWEcD9T5^Am!Y@7#Po2@PC",
- },
- }
-
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("register %s %s", tc.email, tc.password), func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- emailBackend := testutils.MockEmailbackendImplementation{}
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.EmailBackend = &emailBackend
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- dat := url.Values{}
- dat.Set("email", tc.email)
- dat.Set("password", tc.password)
- dat.Set("password_confirmation", tc.passwordConfirmation)
- req := testutils.MakeFormReq(server.URL, "POST", "/join", dat)
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusFound, "")
-
- var user database.User
- testutils.MustExec(t, db.Where("email = ?", tc.email).First(&user), "finding account")
- assert.Equal(t, user.Email.String, tc.email, "Email mismatch")
- assert.NotEqual(t, user.ID, 0, "UserID mismatch")
- passwordErr := bcrypt.CompareHashAndPassword([]byte(user.Password.String), []byte(tc.password))
- assert.Equal(t, passwordErr, nil, "Password mismatch")
-
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&user), "finding user")
- assert.Equal(t, user.MaxUSN, 0, "MaxUSN mismatch")
-
- // welcome email
- assert.Equalf(t, len(emailBackend.Emails), 1, "email queue count mismatch")
- assert.DeepEqual(t, emailBackend.Emails[0].To, []string{tc.email}, "email to mismatch")
-
- // after register, should sign in user
- assertResponseSessionCookie(t, db, res)
- })
- }
-}
-
-func TestJoinError(t *testing.T) {
- t.Run("missing email", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- dat := url.Values{}
- dat.Set("password", "SLMZFM5RmSjA5vfXnG5lPOnrpZSbtmV76cnAcrlr2yU")
- req := testutils.MakeFormReq(server.URL, "POST", "/join", dat)
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status mismatch")
-
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting user")
-
- assert.Equal(t, userCount, int64(0), "userCount mismatch")
- })
-
- t.Run("missing password", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- dat := url.Values{}
- dat.Set("email", "alice@example.com")
- req := testutils.MakeFormReq(server.URL, "POST", "/join", dat)
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status mismatch")
-
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting user")
-
- assert.Equal(t, userCount, int64(0), "userCount mismatch")
- })
-
- t.Run("password confirmation mismatch", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- dat := url.Values{}
- dat.Set("email", "alice@example.com")
- dat.Set("password", "pass1234")
- dat.Set("password_confirmation", "1234pass")
- req := testutils.MakeFormReq(server.URL, "POST", "/join", dat)
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status mismatch")
-
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting user")
-
- assert.Equal(t, userCount, int64(0), "userCount mismatch")
- })
-}
-
-func TestJoinDuplicateEmail(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "somepassword")
-
- dat := url.Values{}
- dat.Set("email", "alice@example.com")
- dat.Set("password", "foobarbaz")
- dat.Set("password_confirmation", "foobarbaz")
- req := testutils.MakeFormReq(server.URL, "POST", "/join", dat)
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusBadRequest, "status code mismatch")
-
- var userCount, verificationTokenCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting user")
- testutils.MustExec(t, db.Model(&database.Token{}).Count(&verificationTokenCount), "counting verification token")
-
- var user database.User
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "finding user")
-
- assert.Equal(t, userCount, int64(1), "user count mismatch")
- assert.Equal(t, verificationTokenCount, int64(0), "verification_token should not have been created")
- assert.Equal(t, user.LastLoginAt, (*time.Time)(nil), "LastLoginAt mismatch")
-}
-
-func TestJoinDisabled(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- a.DisableRegistration = true
- server := MustNewServer(t, &a)
- defer server.Close()
-
- dat := url.Values{}
- dat.Set("email", "alice@example.com")
- dat.Set("password", "foobarbaz")
- req := testutils.MakeFormReq(server.URL, "POST", "/join", dat)
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusNotFound, "status code mismatch")
-
- var userCount int64
- testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting user")
-
- assert.Equal(t, userCount, int64(0), "user count mismatch")
-}
-
-func TestLogin(t *testing.T) {
- testutils.RunForWebAndAPI(t, "success", func(t *testing.T, target testutils.EndpointType) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
-
- _ = testutils.SetupUserData(db, "alice@example.com", "pass1234")
- defer server.Close()
-
- // Execute
- var req *http.Request
- if target == testutils.EndpointWeb {
- dat := url.Values{}
- dat.Set("email", "alice@example.com")
- dat.Set("password", "pass1234")
- req = testutils.MakeFormReq(server.URL, "POST", "/login", dat)
- } else {
- dat := `{"email": "alice@example.com", "password": "pass1234"}`
- req = testutils.MakeReq(server.URL, "POST", "/api/v3/signin", dat)
- }
-
- res := testutils.HTTPDo(t, req)
-
- // Test
- if target == testutils.EndpointWeb {
- assert.StatusCodeEquals(t, res, http.StatusFound, "")
- } else {
- assert.StatusCodeEquals(t, res, http.StatusOK, "")
- }
-
- var user database.User
- testutils.MustExec(t, db.Model(&database.User{}).First(&user), "finding user")
- assert.NotEqual(t, user.LastLoginAt, nil, "LastLoginAt mismatch")
-
- if target == testutils.EndpointWeb {
- assertResponseSessionCookie(t, db, res)
- } else {
- // after register, should sign in user
- var got SessionResponse
- if err := json.NewDecoder(res.Body).Decode(&got); err != nil {
- t.Fatal(errors.Wrap(err, "decoding payload"))
- }
-
- var sessionCount int64
- var session database.Session
- testutils.MustExec(t, db.Model(&database.Session{}).Count(&sessionCount), "counting session")
- testutils.MustExec(t, db.First(&session), "getting session")
-
- assert.Equal(t, sessionCount, int64(1), "sessionCount mismatch")
- assert.Equal(t, got.Key, session.Key, "session Key mismatch")
- assert.Equal(t, got.ExpiresAt, session.ExpiresAt.Unix(), "session ExpiresAt mismatch")
-
- assertResponseSessionCookie(t, db, res)
- }
- })
-
- testutils.RunForWebAndAPI(t, "wrong password", func(t *testing.T, target testutils.EndpointType) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
-
- _ = testutils.SetupUserData(db, "alice@example.com", "pass1234")
- defer server.Close()
-
- var req *http.Request
- if target == testutils.EndpointWeb {
- dat := url.Values{}
- dat.Set("email", "alice@example.com")
- dat.Set("password", "wrongpassword1234")
- req = testutils.MakeFormReq(server.URL, "POST", "/login", dat)
- } else {
- dat := `{"email": "alice@example.com", "password": "wrongpassword1234"}`
- req = testutils.MakeReq(server.URL, "POST", "/api/v3/signin", dat)
- }
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
-
- var user database.User
- testutils.MustExec(t, db.Model(&database.User{}).First(&user), "finding user")
- assert.Equal(t, user.LastLoginAt, (*time.Time)(nil), "LastLoginAt mismatch")
-
- var sessionCount int64
- testutils.MustExec(t, db.Model(&database.Session{}).Count(&sessionCount), "counting session")
- assert.Equal(t, sessionCount, int64(0), "sessionCount mismatch")
- })
-
- testutils.RunForWebAndAPI(t, "wrong email", func(t *testing.T, target testutils.EndpointType) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- _ = testutils.SetupUserData(db, "alice@example.com", "pass1234")
-
- var req *http.Request
- if target == testutils.EndpointWeb {
- dat := url.Values{}
- dat.Set("email", "bob@example.com")
- dat.Set("password", "foobarbaz")
- req = testutils.MakeFormReq(server.URL, "POST", "/login", dat)
- } else {
- dat := `{"email": "bob@example.com", "password": "foobarbaz"}`
- req = testutils.MakeReq(server.URL, "POST", "/api/v3/signin", dat)
- }
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
-
- var user database.User
- testutils.MustExec(t, db.Model(&database.User{}).First(&user), "finding user")
- assert.DeepEqual(t, user.LastLoginAt, (*time.Time)(nil), "LastLoginAt mismatch")
-
- var sessionCount int64
- testutils.MustExec(t, db.Model(&database.Session{}).Count(&sessionCount), "counting session")
- assert.Equal(t, sessionCount, int64(0), "sessionCount mismatch")
- })
-
- testutils.RunForWebAndAPI(t, "nonexistent email", func(t *testing.T, target testutils.EndpointType) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- var req *http.Request
- if target == testutils.EndpointWeb {
- dat := url.Values{}
- dat.Set("email", "nonexistent@example.com")
- dat.Set("password", "pass1234")
- req = testutils.MakeFormReq(server.URL, "POST", "/login", dat)
- } else {
- dat := `{"email": "nonexistent@example.com", "password": "pass1234"}`
- req = testutils.MakeReq(server.URL, "POST", "/api/v3/signin", dat)
- }
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "")
-
- var sessionCount int64
- testutils.MustExec(t, db.Model(&database.Session{}).Count(&sessionCount), "counting session")
- assert.Equal(t, sessionCount, int64(0), "sessionCount mismatch")
- })
-}
-
-func TestLogout(t *testing.T) {
- setupLogoutTest := func(t *testing.T, db *gorm.DB) (*httptest.Server, *database.Session, *database.Session) {
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
-
- aliceUser := testutils.SetupUserData(db, "alice@example.com", "pass1234")
- anotherUser := testutils.SetupUserData(db, "bob@example.com", "password123")
-
- session1ExpiresAt := time.Now().Add(time.Hour * 24)
- session1 := database.Session{
- Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
- UserID: aliceUser.ID,
- ExpiresAt: session1ExpiresAt,
- }
- testutils.MustExec(t, db.Save(&session1), "preparing session1")
- session2 := database.Session{
- Key: "MDCpbvCRg7W2sH6S870wqLqZDZTObYeVd0PzOekfo/A=",
- UserID: anotherUser.ID,
- ExpiresAt: time.Now().Add(time.Hour * 24),
- }
- testutils.MustExec(t, db.Save(&session2), "preparing session2")
-
- return server, &session1, &session2
- }
-
- testutils.RunForWebAndAPI(t, "authenticated", func(t *testing.T, target testutils.EndpointType) {
- db := testutils.InitMemoryDB(t)
-
- server, session1, _ := setupLogoutTest(t, db)
- defer server.Close()
-
- // Execute
- var req *http.Request
- if target == testutils.EndpointWeb {
- dat := url.Values{}
- req = testutils.MakeFormReq(server.URL, "POST", "/logout", dat)
- req.AddCookie(&http.Cookie{Name: "id", Value: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=", Expires: session1.ExpiresAt, Path: "/", HttpOnly: true})
- } else {
- req = testutils.MakeReq(server.URL, "POST", "/api/v3/signout", "")
- req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", session1.Key))
- }
-
- res := testutils.HTTPDo(t, req)
-
- // Test
- if target == testutils.EndpointWeb {
- assert.StatusCodeEquals(t, res, http.StatusFound, "Status mismatch")
- } else {
- assert.StatusCodeEquals(t, res, http.StatusNoContent, "Status mismatch")
- }
-
- var sessionCount int64
- var s2 database.Session
- testutils.MustExec(t, db.Model(&database.Session{}).Count(&sessionCount), "counting session")
- testutils.MustExec(t, db.Where("key = ?", "MDCpbvCRg7W2sH6S870wqLqZDZTObYeVd0PzOekfo/A=").First(&s2), "getting s2")
-
- assert.Equal(t, sessionCount, int64(1), "sessionCount mismatch")
-
- if target == testutils.EndpointWeb {
- c := testutils.GetCookieByName(res.Cookies(), "id")
- assert.Equal(t, c.Value, "", "session key mismatch")
- assert.Equal(t, c.Path, "/", "session path mismatch")
- assert.Equal(t, c.HttpOnly, true, "session HTTPOnly mismatch")
- if c.Expires.After(time.Now()) {
- t.Error("session cookie is not expired")
- }
- }
- })
-
- testutils.RunForWebAndAPI(t, "unauthenticated", func(t *testing.T, target testutils.EndpointType) {
- db := testutils.InitMemoryDB(t)
-
- server, _, _ := setupLogoutTest(t, db)
- defer server.Close()
-
- // Execute
- var req *http.Request
- if target == testutils.EndpointWeb {
- dat := url.Values{}
- req = testutils.MakeFormReq(server.URL, "POST", "/logout", dat)
- } else {
- req = testutils.MakeReq(server.URL, "POST", "/api/v3/signout", "")
- }
-
- res := testutils.HTTPDo(t, req)
-
- // Test
- if target == testutils.EndpointWeb {
- assert.StatusCodeEquals(t, res, http.StatusFound, "Status mismatch")
- } else {
- assert.StatusCodeEquals(t, res, http.StatusNoContent, "Status mismatch")
- }
-
- var sessionCount int64
- var postSession1, postSession2 database.Session
- testutils.MustExec(t, db.Model(&database.Session{}).Count(&sessionCount), "counting session")
- testutils.MustExec(t, db.Where("key = ?", "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=").First(&postSession1), "getting postSession1")
- testutils.MustExec(t, db.Where("key = ?", "MDCpbvCRg7W2sH6S870wqLqZDZTObYeVd0PzOekfo/A=").First(&postSession2), "getting postSession2")
-
- // two existing sessions should remain
- assert.Equal(t, sessionCount, int64(2), "sessionCount mismatch")
-
- c := testutils.GetCookieByName(res.Cookies(), "id")
- assert.Equal(t, c, (*http.Cookie)(nil), "id cookie should have not been set")
- })
-}
-
-func TestResetPassword(t *testing.T) {
- t.Run("success", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "oldpassword")
- tok := database.Token{
- UserID: u.ID,
- Value: "MivFxYiSMMA4An9dP24DNQ==",
- Type: database.TokenTypeResetPassword,
- }
- testutils.MustExec(t, db.Save(&tok), "preparing token")
-
- s1 := database.Session{
- Key: "some-session-key-1",
- UserID: u.ID,
- ExpiresAt: time.Now().Add(time.Hour * 10 * 24),
- }
- testutils.MustExec(t, db.Save(&s1), "preparing user session 1")
-
- s2 := &database.Session{
- Key: "some-session-key-2",
- UserID: u.ID,
- ExpiresAt: time.Now().Add(time.Hour * 10 * 24),
- }
- testutils.MustExec(t, db.Save(&s2), "preparing user session 2")
-
- anotherUser := testutils.SetupUserData(db, "bob@example.com", "password123")
- testutils.MustExec(t, db.Save(&database.Session{
- Key: "some-session-key-3",
- UserID: anotherUser.ID,
- ExpiresAt: time.Now().Add(time.Hour * 10 * 24),
- }), "preparing anotherUser session 1")
-
- // Execute
- dat := url.Values{}
- dat.Set("token", "MivFxYiSMMA4An9dP24DNQ==")
- dat.Set("password", "newpassword")
- dat.Set("password_confirmation", "newpassword")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/password-reset", dat)
-
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusFound, "Status code mismatch")
-
- var resetToken database.Token
- var user database.User
- testutils.MustExec(t, db.Where("value = ?", "MivFxYiSMMA4An9dP24DNQ==").First(&resetToken), "finding reset token")
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "finding account")
-
- assert.NotEqual(t, resetToken.UsedAt, nil, "reset_token UsedAt mismatch")
- passwordErr := bcrypt.CompareHashAndPassword([]byte(user.Password.String), []byte("newpassword"))
- assert.Equal(t, passwordErr, nil, "Password mismatch")
-
- var s1Count, s2Count int64
- testutils.MustExec(t, db.Model(&database.Session{}).Where("id = ?", s1.ID).Count(&s1Count), "counting s1")
- testutils.MustExec(t, db.Model(&database.Session{}).Where("id = ?", s2.ID).Count(&s2Count), "counting s2")
-
- assert.Equal(t, s1Count, int64(0), "s1 should have been deleted")
- assert.Equal(t, s2Count, int64(0), "s2 should have been deleted")
-
- var userSessionCount, anotherUserSessionCount int64
- testutils.MustExec(t, db.Model(&database.Session{}).Where("user_id = ?", u.ID).Count(&userSessionCount), "counting user session")
- testutils.MustExec(t, db.Model(&database.Session{}).Where("user_id = ?", anotherUser.ID).Count(&anotherUserSessionCount), "counting anotherUser session")
-
- assert.Equal(t, userSessionCount, int64(0), "should have deleted a user session")
- assert.Equal(t, anotherUserSessionCount, int64(1), "anotherUser session count mismatch")
- })
-
- t.Run("nonexistent token", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "somepassword")
- tok := database.Token{
- UserID: u.ID,
- Value: "MivFxYiSMMA4An9dP24DNQ==",
- Type: database.TokenTypeResetPassword,
- }
- testutils.MustExec(t, db.Save(&tok), "preparing token")
-
- dat := url.Values{}
- dat.Set("token", "-ApMnyvpg59uOU5b-Kf5uQ==")
- dat.Set("password", "oldpassword")
- dat.Set("password_confirmation", "oldpassword")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/password-reset", dat)
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status code mismatch")
-
- var resetToken database.Token
- var user database.User
- testutils.MustExec(t, db.Where("value = ?", "MivFxYiSMMA4An9dP24DNQ==").First(&resetToken), "finding reset token")
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "finding account")
-
- assert.Equal(t, u.Password, user.Password, "password should not have been updated")
- assert.Equal(t, u.Password, user.Password, "password should not have been updated")
- assert.Equal(t, resetToken.UsedAt, (*time.Time)(nil), "used_at should be nil")
- })
-
- t.Run("expired token", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "somepassword")
- tok := database.Token{
- UserID: u.ID,
- Value: "MivFxYiSMMA4An9dP24DNQ==",
- Type: database.TokenTypeResetPassword,
- }
- testutils.MustExec(t, db.Save(&tok), "preparing token")
- testutils.MustExec(t, db.Model(&tok).Update("created_at", time.Now().Add(time.Minute*-11)), "Failed to prepare reset_token created_at")
-
- dat := url.Values{}
- dat.Set("token", "MivFxYiSMMA4An9dP24DNQ==")
- dat.Set("password", "oldpassword")
- dat.Set("password_confirmation", "oldpassword")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/password-reset", dat)
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusGone, "Status code mismatch")
-
- var resetToken database.Token
- var user database.User
- testutils.MustExec(t, db.Where("value = ?", "MivFxYiSMMA4An9dP24DNQ==").First(&resetToken), "failed to find reset_token")
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "failed to find account")
- assert.Equal(t, u.Password, user.Password, "password should not have been updated")
- assert.Equal(t, resetToken.UsedAt, (*time.Time)(nil), "used_at should be nil")
- })
-
- t.Run("used token", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "somepassword")
-
- usedAt := time.Now().Add(time.Hour * -11).UTC()
- tok := database.Token{
- UserID: u.ID,
- Value: "MivFxYiSMMA4An9dP24DNQ==",
- Type: database.TokenTypeResetPassword,
- UsedAt: &usedAt,
- }
- testutils.MustExec(t, db.Save(&tok), "preparing token")
- testutils.MustExec(t, db.Model(&tok).Update("created_at", time.Now().Add(time.Minute*-11)), "Failed to prepare reset_token created_at")
-
- dat := url.Values{}
- dat.Set("token", "MivFxYiSMMA4An9dP24DNQ==")
- dat.Set("password", "oldpassword")
- dat.Set("password_confirmation", "oldpassword")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/password-reset", dat)
-
- // Execute
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status code mismatch")
-
- var resetToken database.Token
- var user database.User
- testutils.MustExec(t, db.Where("value = ?", "MivFxYiSMMA4An9dP24DNQ==").First(&resetToken), "failed to find reset_token")
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "failed to find account")
- assert.Equal(t, u.Password, user.Password, "password should not have been updated")
-
- resetTokenUsedAtUTC := resetToken.UsedAt.UTC()
- if resetTokenUsedAtUTC.Year() != usedAt.Year() ||
- resetTokenUsedAtUTC.Month() != usedAt.Month() ||
- resetTokenUsedAtUTC.Day() != usedAt.Day() ||
- resetTokenUsedAtUTC.Hour() != usedAt.Hour() ||
- resetTokenUsedAtUTC.Minute() != usedAt.Minute() ||
- resetTokenUsedAtUTC.Second() != usedAt.Second() {
- t.Errorf("used_at should be %+v but got: %+v", usedAt, resetToken.UsedAt)
- }
- })
-
-}
-
-func TestCreateResetToken(t *testing.T) {
- t.Run("success", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "somepassword")
-
- // Execute
- dat := url.Values{}
- dat.Set("email", "alice@example.com")
- req := testutils.MakeFormReq(server.URL, "POST", "/reset-token", dat)
-
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusFound, "Status code mismtach")
-
- var tokenCount int64
- testutils.MustExec(t, db.Model(&database.Token{}).Count(&tokenCount), "counting tokens")
-
- var resetToken database.Token
- testutils.MustExec(t, db.Where("user_id = ? AND type = ?", u.ID, database.TokenTypeResetPassword).First(&resetToken), "finding reset token")
-
- assert.Equal(t, tokenCount, int64(1), "reset_token count mismatch")
- assert.NotEqual(t, resetToken.Value, nil, "reset_token value mismatch")
- assert.Equal(t, resetToken.UsedAt, (*time.Time)(nil), "reset_token UsedAt mismatch")
- })
-
- t.Run("nonexistent email", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- _ = testutils.SetupUserData(db, "alice@example.com", "somepassword")
-
- // Execute
- dat := url.Values{}
- dat.Set("email", "bob@example.com")
- req := testutils.MakeFormReq(server.URL, "POST", "/reset-token", dat)
-
- res := testutils.HTTPDo(t, req)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusOK, "Status code mismtach")
-
- var tokenCount int64
- testutils.MustExec(t, db.Model(&database.Token{}).Count(&tokenCount), "counting tokens")
- assert.Equal(t, tokenCount, int64(0), "reset_token count mismatch")
- })
-}
-
-func TestUpdatePassword(t *testing.T) {
- t.Run("success", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- user := testutils.SetupUserData(db, "alice@example.com", "oldpassword")
-
- // Execute
- dat := url.Values{}
- dat.Set("old_password", "oldpassword")
- dat.Set("new_password", "newpassword")
- dat.Set("new_password_confirmation", "newpassword")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/account/password", dat)
-
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusFound, "Status code mismsatch")
-
- testutils.MustExec(t, db.Where("id = ?", user.ID).First(&user), "finding account")
-
- passwordErr := bcrypt.CompareHashAndPassword([]byte(user.Password.String), []byte("newpassword"))
- assert.Equal(t, passwordErr, nil, "Password mismatch")
- })
-
- t.Run("old password mismatch", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "oldpassword")
-
- // Execute
- dat := url.Values{}
- dat.Set("old_password", "randompassword")
- dat.Set("new_password", "newpassword")
- dat.Set("new_password_confirmation", "newpassword")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/account/password", dat)
-
- res := testutils.HTTPAuthDo(t, db, req, u)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "Status code mismsatch")
-
- var user database.User
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "finding account")
- assert.Equal(t, u.Password.String, user.Password.String, "password should not have been updated")
- })
-
- t.Run("password too short", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "oldpassword")
-
- // Execute
- dat := url.Values{}
- dat.Set("old_password", "oldpassword")
- dat.Set("new_password", "a")
- dat.Set("new_password_confirmation", "a")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/account/password", dat)
-
- res := testutils.HTTPAuthDo(t, db, req, u)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status code mismsatch")
-
- var user database.User
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "finding account")
- assert.Equal(t, u.Password.String, user.Password.String, "password should not have been updated")
- })
-
- t.Run("password confirmation mismatch", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "oldpassword")
-
- // Execute
- dat := url.Values{}
- dat.Set("old_password", "oldpassword")
- dat.Set("new_password", "newpassword1")
- dat.Set("new_password_confirmation", "newpassword2")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/account/password", dat)
-
- res := testutils.HTTPAuthDo(t, db, req, u)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusBadRequest, "Status code mismsatch")
-
- var user database.User
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "finding account")
- assert.Equal(t, u.Password.String, user.Password.String, "password should not have been updated")
- })
-}
-
-func TestUpdateEmail(t *testing.T) {
- t.Run("success", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "pass1234")
-
- // Execute
- dat := url.Values{}
- dat.Set("email", "alice-new@example.com")
- dat.Set("password", "pass1234")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/account/profile", dat)
-
- res := testutils.HTTPAuthDo(t, db, req, u)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusFound, "Status code mismatch")
-
- var user database.User
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "finding user")
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "finding account")
-
- assert.Equal(t, user.Email.String, "alice-new@example.com", "email mismatch")
- })
-
- t.Run("password mismatch", func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- // Setup
- a := app.NewTest()
- a.Clock = clock.NewMock()
- a.DB = db
- server := MustNewServer(t, &a)
- defer server.Close()
-
- u := testutils.SetupUserData(db, "alice@example.com", "pass1234")
-
- // Execute
- dat := url.Values{}
- dat.Set("email", "alice-new@example.com")
- dat.Set("password", "wrongpassword")
- req := testutils.MakeFormReq(server.URL, "PATCH", "/account/profile", dat)
-
- res := testutils.HTTPAuthDo(t, db, req, u)
-
- // Test
- assert.StatusCodeEquals(t, res, http.StatusUnauthorized, "Status code mismsatch")
-
- var user database.User
- testutils.MustExec(t, db.Where("id = ?", u.ID).First(&user), "finding user")
-
- assert.Equal(t, user.Email.String, "alice@example.com", "email mismatch")
- })
-}
-
diff --git a/pkg/server/crypt/crypt.go b/pkg/server/crypt/crypt.go
index fb0edd26..e720daea 100644
--- a/pkg/server/crypt/crypt.go
+++ b/pkg/server/crypt/crypt.go
@@ -1,27 +1,35 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package crypt
import (
"crypto/rand"
+ "crypto/sha256"
"encoding/base64"
"github.com/pkg/errors"
+ "golang.org/x/crypto/pbkdf2"
)
+// ServerKDFIteration is the iteration count for PBKDF on the server
+var ServerKDFIteration = 100000
+
// getRandomBytes generates a cryptographically secure pseudorandom numbers of the
// given size in byte
func getRandomBytes(numBytes int) ([]byte, error) {
@@ -43,3 +51,10 @@ func GetRandomStr(numBytes int) (string, error) {
return base64.StdEncoding.EncodeToString(b), nil
}
+
+// HashAuthKey hashes the authKey provided by a client
+func HashAuthKey(authKey, salt string, iteration int) string {
+ keyHashBits := pbkdf2.Key([]byte(authKey), []byte(salt), iteration, 32, sha256.New)
+
+ return base64.StdEncoding.EncodeToString(keyHashBits)
+}
diff --git a/pkg/server/database/consts.go b/pkg/server/database/consts.go
index 4406ee5c..69f04711 100644
--- a/pkg/server/database/consts.go
+++ b/pkg/server/database/consts.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package database
@@ -18,6 +21,10 @@ package database
const (
// TokenTypeResetPassword is a type of a token for reseting password
TokenTypeResetPassword = "reset_password"
+ // TokenTypeEmailVerification is a type of a token for verifying email
+ TokenTypeEmailVerification = "email_verification"
+ // TokenTypeEmailPreference is a type of a token for updating email preference
+ TokenTypeEmailPreference = "email_preference"
)
const (
diff --git a/pkg/server/database/database.go b/pkg/server/database/database.go
index bd7869bc..30eea6f5 100644
--- a/pkg/server/database/database.go
+++ b/pkg/server/database/database.go
@@ -1,30 +1,30 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package database
import (
- "os"
- "path/filepath"
- "time"
-
- "github.com/dnote/dnote/pkg/server/log"
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
- "gorm.io/driver/sqlite"
- "gorm.io/gorm"
- "gorm.io/gorm/logger"
+
+ // Use postgres
+ _ "github.com/lib/pq"
)
var (
@@ -32,107 +32,32 @@ var (
MigrationTableName = "migrations"
)
-// getDBLogLevel converts application log level to GORM log level
-func getDBLogLevel(level string) logger.LogLevel {
- switch level {
- case log.LevelDebug:
- return logger.Info
- case log.LevelInfo:
- return logger.Silent
- case log.LevelWarn:
- return logger.Warn
- case log.LevelError:
- return logger.Error
- default:
- return logger.Silent
- }
-}
-
// InitSchema migrates database schema to reflect the latest model definition
func InitSchema(db *gorm.DB) {
+ if err := db.Exec(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`).Error; err != nil {
+ panic(err)
+ }
+
if err := db.AutoMigrate(
- &User{},
- &Book{},
- &Note{},
- &Token{},
- &Session{},
- ); err != nil {
+ Note{},
+ Book{},
+ User{},
+ Account{},
+ Notification{},
+ Token{},
+ EmailPreference{},
+ Session{},
+ ).Error; err != nil {
panic(err)
}
}
// Open initializes the database connection
-func Open(dbPath string) *gorm.DB {
- // Create directory if it doesn't exist
- dir := filepath.Dir(dbPath)
- if err := os.MkdirAll(dir, 0755); err != nil {
- panic(errors.Wrapf(err, "creating database directory at %s", dir))
- }
-
- db, err := gorm.Open(sqlite.Open(dbPath), &gorm.Config{
- Logger: logger.Default.LogMode(getDBLogLevel(log.GetLevel())),
- })
+func Open(c config.Config) *gorm.DB {
+ db, err := gorm.Open("postgres", c.DB.GetConnectionStr())
if err != nil {
panic(errors.Wrap(err, "opening database conection"))
}
- // Get underlying *sql.DB to configure connection pool
- sqlDB, err := db.DB()
- if err != nil {
- panic(errors.Wrap(err, "getting underlying database connection"))
- }
-
- // Configure connection pool for SQLite with WAL mode
- sqlDB.SetMaxOpenConns(25)
- sqlDB.SetMaxIdleConns(5)
- sqlDB.SetConnMaxLifetime(0) // Doesn't expire.
-
- // Apply performance PRAGMAs
- pragmas := []string{
- "PRAGMA journal_mode=WAL", // Enable WAL mode for better concurrency
- "PRAGMA synchronous=NORMAL", // Balance between safety and speed
- "PRAGMA cache_size=-64000", // 64MB cache (negative = KB)
- "PRAGMA busy_timeout=5000", // Wait up to 5s for locks
- "PRAGMA foreign_keys=ON", // Enforce foreign key constraints
- "PRAGMA temp_store=MEMORY", // Store temp tables in memory
- }
-
- for _, pragma := range pragmas {
- if err := db.Exec(pragma).Error; err != nil {
- panic(errors.Wrapf(err, "executing pragma: %s", pragma))
- }
- }
-
return db
}
-
-// StartWALCheckpointing starts a background goroutine that periodically
-// checkpoints the WAL file to prevent it from growing unbounded
-func StartWALCheckpointing(db *gorm.DB, interval time.Duration) {
- go func() {
- ticker := time.NewTicker(interval)
- defer ticker.Stop()
-
- for range ticker.C {
- // TRUNCATE mode removes the WAL file after checkpointing
- if err := db.Exec("PRAGMA wal_checkpoint(TRUNCATE)").Error; err != nil {
- log.ErrorWrap(err, "WAL checkpoint failed")
- }
- }
- }()
-}
-
-// StartPeriodicVacuum runs full VACUUM on a schedule to reclaim space and defragment.
-// VACUUM acquires an exclusive lock and blocks all database operations briefly.
-func StartPeriodicVacuum(db *gorm.DB, interval time.Duration) {
- go func() {
- ticker := time.NewTicker(interval)
- defer ticker.Stop()
-
- for range ticker.C {
- if err := db.Exec("VACUUM").Error; err != nil {
- log.ErrorWrap(err, "VACUUM failed")
- }
- }
- }()
-}
diff --git a/pkg/server/database/database_test.go b/pkg/server/database/database_test.go
deleted file mode 100644
index 3d3f5b92..00000000
--- a/pkg/server/database/database_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package database
-
-import (
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/server/log"
- "gorm.io/gorm/logger"
-)
-
-func TestGetDBLogLevel(t *testing.T) {
- testCases := []struct {
- name string
- level string
- expected logger.LogLevel
- }{
- {
- name: "debug level maps to Info",
- level: log.LevelDebug,
- expected: logger.Info,
- },
- {
- name: "info level maps to Silent",
- level: log.LevelInfo,
- expected: logger.Silent,
- },
- {
- name: "warn level maps to Warn",
- level: log.LevelWarn,
- expected: logger.Warn,
- },
- {
- name: "error level maps to Error",
- level: log.LevelError,
- expected: logger.Error,
- },
- {
- name: "unknown level maps to Silent",
- level: "unknown",
- expected: logger.Silent,
- },
- {
- name: "empty string maps to Silent",
- level: "",
- expected: logger.Silent,
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- result := getDBLogLevel(tc.level)
- assert.Equal(t, result, tc.expected, "log level mismatch")
- })
- }
-}
diff --git a/pkg/server/database/errors.go b/pkg/server/database/errors.go
deleted file mode 100644
index ada00a6d..00000000
--- a/pkg/server/database/errors.go
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package database
-
-import (
- "github.com/pkg/errors"
-)
-
-type modelError string
-
-var (
- // ErrNotFound an error that indicates that the given resource is not found
- ErrNotFound error = errors.New("not found")
-)
diff --git a/pkg/server/database/migrate.go b/pkg/server/database/migrate.go
index 59e4c820..f26a1400 100644
--- a/pkg/server/database/migrate.go
+++ b/pkg/server/database/migrate.go
@@ -1,182 +1,46 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package database
import (
- "fmt"
- "io/fs"
- "sort"
- "strings"
+ "log"
- "github.com/dnote/dnote/pkg/server/database/migrations"
- "github.com/dnote/dnote/pkg/server/log"
+ "github.com/gobuffalo/packr/v2"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
- "gorm.io/gorm"
+ "github.com/rubenv/sql-migrate"
)
-type migrationFile struct {
- filename string
- version int
-}
-
-// validateMigrationFilename checks if filename follows format: NNN-description.sql
-func validateMigrationFilename(name string) error {
- // Check .sql extension
- if !strings.HasSuffix(name, ".sql") {
- return errors.Errorf("invalid migration filename: must end with .sql")
- }
-
- name = strings.TrimSuffix(name, ".sql")
- parts := strings.SplitN(name, "-", 2)
- if len(parts) != 2 {
- return errors.Errorf("invalid migration filename: must be NNN-description.sql")
- }
-
- version, description := parts[0], parts[1]
-
- // Validate version is 3 digits
- if len(version) != 3 {
- return errors.Errorf("invalid migration filename: version must be 3 digits, got %s", version)
- }
- for _, c := range version {
- if c < '0' || c > '9' {
- return errors.Errorf("invalid migration filename: version must be numeric, got %s", version)
- }
- }
-
- // Validate description is not empty
- if description == "" {
- return errors.Errorf("invalid migration filename: description is required")
- }
-
- return nil
-}
-
-// Migrate runs the migrations using the embedded migration files
+// Migrate runs the migrations
func Migrate(db *gorm.DB) error {
- return migrate(db, migrations.Files)
-}
+ migrations := &migrate.PackrMigrationSource{
+ Box: packr.New("migrations", "../database/migrations/"),
+ }
-// getMigrationFiles reads, validates, and sorts migration files
-func getMigrationFiles(fsys fs.FS) ([]migrationFile, error) {
- entries, err := fs.ReadDir(fsys, ".")
+ migrate.SetTable(MigrationTableName)
+
+ n, err := migrate.Exec(db.DB(), "postgres", migrations, migrate.Up)
if err != nil {
- return nil, errors.Wrap(err, "reading migration directory")
+ return errors.Wrap(err, "running migrations")
}
- var migrations []migrationFile
- seen := make(map[int]string)
- for _, e := range entries {
- name := e.Name()
-
- if err := validateMigrationFilename(name); err != nil {
- return nil, err
- }
-
- // Parse version
- var v int
- fmt.Sscanf(name, "%d", &v)
-
- // Check for duplicate version numbers
- if existing, found := seen[v]; found {
- return nil, errors.Errorf("duplicate migration version %d: %s and %s", v, existing, name)
- }
- seen[v] = name
-
- migrations = append(migrations, migrationFile{
- filename: name,
- version: v,
- })
- }
-
- // Sort by version
- sort.Slice(migrations, func(i, j int) bool {
- return migrations[i].version < migrations[j].version
- })
-
- return migrations, nil
-}
-
-// migrate runs migrations from the provided filesystem
-func migrate(db *gorm.DB, fsys fs.FS) error {
- if err := db.Exec(`
- CREATE TABLE IF NOT EXISTS schema_migrations (
- version INTEGER PRIMARY KEY,
- applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
- )
- `).Error; err != nil {
- return errors.Wrap(err, "initializing migration table")
- }
-
- // Get current version
- var version int
- if err := db.Raw("SELECT COALESCE(MAX(version), 0) FROM schema_migrations").Scan(&version).Error; err != nil {
- return errors.Wrap(err, "reading current version")
- }
-
- // Read and validate migration files
- migrations, err := getMigrationFiles(fsys)
- if err != nil {
- return err
- }
-
- var filenames []string
- for _, m := range migrations {
- filenames = append(filenames, m.filename)
- }
-
- log.WithFields(log.Fields{
- "version": version,
- }).Info("Database schema version.")
-
- log.WithFields(log.Fields{
- "files": filenames,
- }).Debug("Database migration files.")
-
- // Apply pending migrations
- for _, m := range migrations {
- if m.version <= version {
- continue
- }
-
- log.WithFields(log.Fields{
- "file": m.filename,
- }).Info("Applying migration.")
-
- sql, err := fs.ReadFile(fsys, m.filename)
- if err != nil {
- return errors.Wrapf(err, "reading migration file %s", m.filename)
- }
-
- if len(strings.TrimSpace(string(sql))) == 0 {
- return errors.Errorf("migration file %s is empty", m.filename)
- }
-
- if err := db.Exec(string(sql)).Error; err != nil {
- return fmt.Errorf("migration %s failed: %w", m.filename, err)
- }
-
- if err := db.Exec("INSERT INTO schema_migrations (version) VALUES (?)", m.version).Error; err != nil {
- return errors.Wrapf(err, "recording migration %s", m.filename)
- }
-
- log.WithFields(log.Fields{
- "file": m.filename,
- }).Info("Migrate success.")
- }
+ log.Printf("Performed %d migrations", n)
return nil
}
diff --git a/pkg/server/database/migrate/main.go b/pkg/server/database/migrate/main.go
new file mode 100644
index 00000000..70614185
--- /dev/null
+++ b/pkg/server/database/migrate/main.go
@@ -0,0 +1,67 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package main
+
+import (
+ "flag"
+ "fmt"
+ "os"
+
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/joho/godotenv"
+ "github.com/pkg/errors"
+ "github.com/rubenv/sql-migrate"
+)
+
+var (
+ migrationDir = flag.String("migrationDir", "../migrations", "the path to the directory with migraiton files")
+)
+
+func init() {
+ fmt.Println("Migrating Dnote database...")
+
+ // Load env
+ if os.Getenv("GO_ENV") != "PRODUCTION" {
+ if err := godotenv.Load("../../.env.dev"); err != nil {
+ panic(err)
+ }
+ }
+
+}
+
+func main() {
+ flag.Parse()
+
+ c := config.Load()
+ db := database.Open(c)
+
+ migrations := &migrate.FileMigrationSource{
+ Dir: *migrationDir,
+ }
+
+ migrate.SetTable("migrations")
+
+ n, err := migrate.Exec(db.DB(), "postgres", migrations, migrate.Up)
+ if err != nil {
+ panic(errors.Wrap(err, "executing migrations"))
+ }
+
+ fmt.Printf("Applied %d migrations\n", n)
+}
diff --git a/pkg/server/database/migrate_test.go b/pkg/server/database/migrate_test.go
deleted file mode 100644
index 4ee93627..00000000
--- a/pkg/server/database/migrate_test.go
+++ /dev/null
@@ -1,310 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package database
-
-import (
- "io/fs"
- "testing"
- "testing/fstest"
-
- "gorm.io/driver/sqlite"
- "gorm.io/gorm"
-)
-
-// unsortedFS wraps fstest.MapFS to return entries in reverse order
-type unsortedFS struct {
- fstest.MapFS
-}
-
-func (u unsortedFS) ReadDir(name string) ([]fs.DirEntry, error) {
- entries, err := u.MapFS.ReadDir(name)
- if err != nil {
- return nil, err
- }
- // Reverse the entries to ensure they're not in sorted order
- for i, j := 0, len(entries)-1; i < j; i, j = i+1, j-1 {
- entries[i], entries[j] = entries[j], entries[i]
- }
- return entries, nil
-}
-
-// errorFS returns an error on ReadDir
-type errorFS struct{}
-
-func (e errorFS) Open(name string) (fs.File, error) {
- return nil, fs.ErrNotExist
-}
-
-func (e errorFS) ReadDir(name string) ([]fs.DirEntry, error) {
- return nil, fs.ErrPermission
-}
-
-func TestMigrate_createsSchemaTable(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
-
- migrationsFs := fstest.MapFS{}
- migrate(db, migrationsFs)
-
- // Verify schema_migrations table exists
- var count int64
- if err := db.Raw("SELECT COUNT(*) FROM schema_migrations").Scan(&count).Error; err != nil {
- t.Fatalf("schema_migrations table not found: %v", err)
- }
-}
-
-func TestMigrate_idempotency(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
-
- // Set up table before migration
- if err := db.Exec("CREATE TABLE counter (value INTEGER)").Error; err != nil {
- t.Fatalf("failed to create table: %v", err)
- }
-
- // Create migration that inserts a row
- migrationsFs := fstest.MapFS{
- "001-insert-data.sql": &fstest.MapFile{
- Data: []byte("INSERT INTO counter (value) VALUES (100);"),
- },
- }
-
- // Run migration first time
- if err := migrate(db, migrationsFs); err != nil {
- t.Fatalf("first migration failed: %v", err)
- }
- var count int64
- if err := db.Raw("SELECT COUNT(*) FROM counter").Scan(&count).Error; err != nil {
- t.Fatalf("failed to count rows: %v", err)
- }
- if count != 1 {
- t.Errorf("expected 1 row, got %d", count)
- }
-
- // Run migration second time - it should not run the SQL again
- if err := migrate(db, migrationsFs); err != nil {
- t.Fatalf("second migration failed: %v", err)
- }
- if err := db.Raw("SELECT COUNT(*) FROM counter").Scan(&count).Error; err != nil {
- t.Fatalf("failed to count rows: %v", err)
- }
- if count != 1 {
- t.Errorf("migration ran twice: expected 1 row, got %d", count)
- }
-}
-
-func TestMigrate_ordering(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
-
- // Create table before migrations
- if err := db.Exec("CREATE TABLE log (value INTEGER)").Error; err != nil {
- t.Fatalf("failed to create table: %v", err)
- }
-
- // Create migrations with unsorted filesystem
- migrationsFs := unsortedFS{
- MapFS: fstest.MapFS{
- "010-tenth.sql": &fstest.MapFile{
- Data: []byte("INSERT INTO log (value) VALUES (3);"),
- },
- "001-first.sql": &fstest.MapFile{
- Data: []byte("INSERT INTO log (value) VALUES (1);"),
- },
- "002-second.sql": &fstest.MapFile{
- Data: []byte("INSERT INTO log (value) VALUES (2);"),
- },
- },
- }
-
- // Run migrations
- if err := migrate(db, migrationsFs); err != nil {
- t.Fatalf("migration failed: %v", err)
- }
-
- // Verify migrations ran in correct order (1, 2, 3)
- var values []int
- if err := db.Raw("SELECT value FROM log ORDER BY rowid").Scan(&values).Error; err != nil {
- t.Fatalf("failed to query log: %v", err)
- }
-
- expected := []int{1, 2, 3}
- if len(values) != len(expected) {
- t.Fatalf("expected %d rows, got %d", len(expected), len(values))
- }
-
- for i, v := range values {
- if v != expected[i] {
- t.Errorf("row %d: expected value %d, got %d", i, expected[i], v)
- }
- }
-}
-
-func TestMigrate_duplicateVersion(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
-
- // Create migrations with duplicate version numbers
- migrationsFs := fstest.MapFS{
- "001-first.sql": &fstest.MapFile{
- Data: []byte("SELECT 1;"),
- },
- "001-second.sql": &fstest.MapFile{
- Data: []byte("SELECT 2;"),
- },
- }
-
- // Should return error for duplicate version
- err = migrate(db, migrationsFs)
- if err == nil {
- t.Fatal("expected error for duplicate version numbers, got nil")
- }
-}
-
-func TestMigrate_initTableError(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
-
- // Close the database connection to cause exec to fail
- sqlDB, _ := db.DB()
- sqlDB.Close()
-
- migrationsFs := fstest.MapFS{
- "001-init.sql": &fstest.MapFile{
- Data: []byte("SELECT 1;"),
- },
- }
-
- // Should return error for table initialization failure
- err = migrate(db, migrationsFs)
- if err == nil {
- t.Fatal("expected error for table initialization failure, got nil")
- }
-}
-
-func TestMigrate_readDirError(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
-
- // Use filesystem that fails on ReadDir
- err = migrate(db, errorFS{})
- if err == nil {
- t.Fatal("expected error for ReadDir failure, got nil")
- }
-}
-
-func TestMigrate_sqlError(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
-
- // Create migration with invalid SQL
- migrationsFs := fstest.MapFS{
- "001-bad-sql.sql": &fstest.MapFile{
- Data: []byte("INVALID SQL SYNTAX HERE;"),
- },
- }
-
- // Should return error for SQL execution failure
- err = migrate(db, migrationsFs)
- if err == nil {
- t.Fatal("expected error for invalid SQL, got nil")
- }
-}
-
-func TestMigrate_emptyFile(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
-
- tests := []struct {
- name string
- data string
- wantErr bool
- }{
- {"completely empty", "", true},
- {"only whitespace", " \n\t ", true},
- {"only comments", "-- just a comment", false},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- migrationsFs := fstest.MapFS{
- "001-empty.sql": &fstest.MapFile{
- Data: []byte(tt.data),
- },
- }
-
- err = migrate(db, migrationsFs)
- if (err != nil) != tt.wantErr {
- t.Errorf("error = %v, wantErr %v", err, tt.wantErr)
- }
- })
- }
-}
-
-func TestMigrate_invalidFilename(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open database: %v", err)
- }
-
- tests := []struct {
- name string
- filename string
- wantErr bool
- }{
- {"valid format", "001-init.sql", false},
- {"no leading zeros", "1-init.sql", true},
- {"two digits", "01-init.sql", true},
- {"no dash", "001init.sql", true},
- {"no description", "001-.sql", true},
- {"no extension", "001-init.", true},
- {"wrong extension", "001-init.txt", true},
- {"non-numeric version number", "0a1-init.sql", true},
- {"underscore separator", "001_init.sql", true},
- {"multiple dashes in description", "001-add-feature-v2.sql", false},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- migrationsFs := fstest.MapFS{
- tt.filename: &fstest.MapFile{
- Data: []byte("SELECT 1;"),
- },
- }
-
- err := migrate(db, migrationsFs)
- if (err != nil) != tt.wantErr {
- t.Errorf("error = %v, wantErr %v", err, tt.wantErr)
- }
- })
- }
-}
diff --git a/pkg/server/database/migrations/.gitkeep b/pkg/server/database/migrations/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/pkg/server/database/migrations/100-create-fts-table.sql b/pkg/server/database/migrations/100-create-fts-table.sql
deleted file mode 100644
index 21b43704..00000000
--- a/pkg/server/database/migrations/100-create-fts-table.sql
+++ /dev/null
@@ -1,18 +0,0 @@
--- Create FTS5 virtual table for full-text search on notes
-CREATE VIRTUAL TABLE IF NOT EXISTS notes_fts USING fts5(
- content=notes,
- body,
- tokenize="porter unicode61 categories 'L* N* Co Ps Pe'"
-);
-
--- Create triggers to keep notes_fts in sync with notes
-CREATE TRIGGER IF NOT EXISTS notes_insert AFTER INSERT ON notes BEGIN
- INSERT INTO notes_fts(rowid, body) VALUES (new.rowid, new.body);
-END;
-CREATE TRIGGER IF NOT EXISTS notes_delete AFTER DELETE ON notes BEGIN
- INSERT INTO notes_fts(notes_fts, rowid, body) VALUES ('delete', old.rowid, old.body);
-END;
-CREATE TRIGGER IF NOT EXISTS notes_update AFTER UPDATE ON notes BEGIN
- INSERT INTO notes_fts(notes_fts, rowid, body) VALUES ('delete', old.rowid, old.body);
- INSERT INTO notes_fts(rowid, body) VALUES (new.rowid, new.body);
-END;
\ No newline at end of file
diff --git a/pkg/server/database/migrations/20190819115834-full-text-search.sql b/pkg/server/database/migrations/20190819115834-full-text-search.sql
new file mode 100644
index 00000000..b3d884e9
--- /dev/null
+++ b/pkg/server/database/migrations/20190819115834-full-text-search.sql
@@ -0,0 +1,41 @@
+
+-- +migrate Up
+
+-- Configure full text search
+CREATE TEXT SEARCH DICTIONARY english_nostop (
+ Template = snowball,
+ Language = english
+);
+
+CREATE TEXT SEARCH CONFIGURATION public.english_nostop ( COPY = pg_catalog.english );
+
+ALTER TEXT SEARCH CONFIGURATION public.english_nostop
+ALTER MAPPING FOR asciiword, asciihword, hword_asciipart, hword, hword_part, word WITH english_nostop;
+
+
+-- Create a trigger
+-- +migrate StatementBegin
+CREATE OR REPLACE FUNCTION note_tsv_trigger() RETURNS trigger AS $$
+begin
+ new.tsv := setweight(to_tsvector('english_nostop', new.body), 'A');
+ return new;
+end
+$$ LANGUAGE plpgsql;
+
+DROP TRIGGER IF EXISTS tsvectorupdate ON notes;
+CREATE TRIGGER tsvectorupdate
+BEFORE INSERT OR UPDATE ON notes
+FOR EACH ROW EXECUTE PROCEDURE note_tsv_trigger();
+-- +migrate StatementEnd
+
+-- index tsv
+CREATE INDEX IF NOT EXISTS idx_notes_tsv
+ON notes
+USING gin(tsv);
+
+-- initialize tsv
+UPDATE notes
+SET tsv = setweight(to_tsvector('english_nostop', notes.body), 'A')
+WHERE notes.encrypted = false;
+
+-- +migrate Down
diff --git a/pkg/server/database/migrations/20191028103522-create-weekly-repetition.sql b/pkg/server/database/migrations/20191028103522-create-weekly-repetition.sql
new file mode 100644
index 00000000..22ac6f3a
--- /dev/null
+++ b/pkg/server/database/migrations/20191028103522-create-weekly-repetition.sql
@@ -0,0 +1,8 @@
+-- this migration is noop because repetition_rules have been removed
+
+-- create-weekly-repetition.sql creates the default repetition rules for the users
+-- that used to have the weekly email digest on Friday 20:00 UTC
+
+-- +migrate Up
+
+-- +migrate Down
diff --git a/pkg/server/database/migrations/20191225185502-populate-digest-version.sql b/pkg/server/database/migrations/20191225185502-populate-digest-version.sql
new file mode 100644
index 00000000..73098dbf
--- /dev/null
+++ b/pkg/server/database/migrations/20191225185502-populate-digest-version.sql
@@ -0,0 +1,9 @@
+-- this migration is noop because digests have been removed
+
+-- populate-digest-version.sql populates the `version` column for the digests
+-- by assigining an incremental integer scoped to a repetition rule that each
+-- digest belongs, ordered by created_at timestamp of the digests.
+
+-- +migrate Up
+
+-- +migrate Down
diff --git a/pkg/server/database/migrations/20191226093447-add-digest-id-primary-key.sql b/pkg/server/database/migrations/20191226093447-add-digest-id-primary-key.sql
new file mode 100644
index 00000000..c7d17d2e
--- /dev/null
+++ b/pkg/server/database/migrations/20191226093447-add-digest-id-primary-key.sql
@@ -0,0 +1,5 @@
+-- this migration is noop because digests have been removed
+
+-- +migrate Up
+
+-- +migrate Down
diff --git a/pkg/server/database/migrations/20191226105659-use-id-in-digest-notes-joining-table.sql b/pkg/server/database/migrations/20191226105659-use-id-in-digest-notes-joining-table.sql
new file mode 100644
index 00000000..faec52ff
--- /dev/null
+++ b/pkg/server/database/migrations/20191226105659-use-id-in-digest-notes-joining-table.sql
@@ -0,0 +1,8 @@
+-- this migration is noop because digests have been removed
+
+-- -use-id-in-digest-notes-joining-table.sql replaces uuids with ids
+-- as foreign keys in the digest_notes joining table.
+
+-- +migrate Up
+
+-- +migrate Down
diff --git a/pkg/server/database/migrations/20191226152111-delete-outdated-digests.sql b/pkg/server/database/migrations/20191226152111-delete-outdated-digests.sql
new file mode 100644
index 00000000..84c8ccf3
--- /dev/null
+++ b/pkg/server/database/migrations/20191226152111-delete-outdated-digests.sql
@@ -0,0 +1,8 @@
+-- this migration is noop because digests have been removed
+
+-- delete-outdated-digests.sql deletes digests that do not belong to any repetition rules,
+-- along with digest_notes associations.
+
+-- +migrate Up
+
+-- +migrate Down
diff --git a/pkg/server/database/migrations/20200522170529-remove-billing-columns.sql b/pkg/server/database/migrations/20200522170529-remove-billing-columns.sql
new file mode 100644
index 00000000..a814f26b
--- /dev/null
+++ b/pkg/server/database/migrations/20200522170529-remove-billing-columns.sql
@@ -0,0 +1,9 @@
+-- remove-billing-columns.sql drops billing related columns that are now obsolete.
+
+-- +migrate Up
+
+ALTER TABLE users DROP COLUMN IF EXISTS stripe_customer_id;
+ALTER TABLE users DROP COLUMN IF EXISTS billing_country;
+
+-- +migrate Down
+
diff --git a/pkg/server/database/migrations/embed.go b/pkg/server/database/migrations/embed.go
deleted file mode 100644
index 1c644d57..00000000
--- a/pkg/server/database/migrations/embed.go
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package migrations
-
-import "embed"
-
-//go:embed *.sql
-var Files embed.FS
diff --git a/pkg/server/database/models.go b/pkg/server/database/models.go
index 6ee4d3a7..c7905158 100644
--- a/pkg/server/database/models.go
+++ b/pkg/server/database/models.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package database
@@ -21,49 +24,61 @@ import (
// Model is the base model definition
type Model struct {
- ID int `gorm:"primaryKey" json:"-"`
- CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
- UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
+ ID int `gorm:"primary_key" json:"-"`
+ CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
+ UpdatedAt time.Time `json:"updated_at"`
}
// Book is a model for a book
type Book struct {
Model
- UUID string `json:"uuid" gorm:"uniqueIndex;type:text"`
+ UUID string `json:"uuid" gorm:"index;type:uuid;default:uuid_generate_v4()"`
UserID int `json:"user_id" gorm:"index"`
Label string `json:"label" gorm:"index"`
- Notes []Note `json:"notes" gorm:"foreignKey:BookUUID;references:UUID"`
+ Notes []Note `json:"notes" gorm:"foreignkey:book_uuid"`
AddedOn int64 `json:"added_on"`
EditedOn int64 `json:"edited_on"`
USN int `json:"-" gorm:"index"`
Deleted bool `json:"-" gorm:"default:false"`
+ Encrypted bool `json:"-" gorm:"default:false"`
}
// Note is a model for a note
type Note struct {
Model
- UUID string `json:"uuid" gorm:"index;type:text"`
- Book Book `json:"book" gorm:"foreignKey:BookUUID;references:UUID"`
+ UUID string `json:"uuid" gorm:"index;type:uuid;default:uuid_generate_v4()"`
+ Book Book `json:"book" gorm:"foreignkey:BookUUID"`
User User `json:"user"`
UserID int `json:"user_id" gorm:"index"`
- BookUUID string `json:"book_uuid" gorm:"index;type:text"`
+ BookUUID string `json:"book_uuid" gorm:"index;type:uuid"`
Body string `json:"content"`
AddedOn int64 `json:"added_on"`
EditedOn int64 `json:"edited_on"`
+ TSV string `json:"-" gorm:"type:tsvector"`
+ Public bool `json:"public" gorm:"default:false"`
USN int `json:"-" gorm:"index"`
Deleted bool `json:"-" gorm:"default:false"`
+ Encrypted bool `json:"-" gorm:"default:false"`
Client string `gorm:"index"`
}
// User is a model for a user
type User struct {
Model
- UUID string `json:"uuid" gorm:"type:text;index"`
- Email NullString `gorm:"index"`
- Password NullString `json:"-"`
- LastLoginAt *time.Time `json:"-"`
- MaxUSN int `json:"-" gorm:"default:0"`
- FullSyncBefore int64 `json:"-" gorm:"default:0"`
+ UUID string `json:"uuid" gorm:"type:uuid;index;default:uuid_generate_v4()"`
+ Account Account
+ LastLoginAt *time.Time `json:"-"`
+ MaxUSN int `json:"-" gorm:"default:0"`
+ Cloud bool `json:"-" gorm:"default:false"`
+}
+
+// Account is a model for an account
+type Account struct {
+ Model
+ UserID int `gorm:"index"`
+ Email NullString
+ EmailVerified bool `gorm:"default:false"`
+ Password NullString
}
// Token is a model for a token
@@ -75,6 +90,21 @@ type Token struct {
UsedAt *time.Time
}
+// Notification is the learning notification sent to the user
+type Notification struct {
+ Model
+ Type string
+ UserID int `gorm:"index"`
+}
+
+// EmailPreference is a preference per user for receiving email communication
+type EmailPreference struct {
+ Model
+ UserID int `gorm:"index" json:"-"`
+ InactiveReminder bool `json:"inactive_reminder" gorm:"default:false"`
+ ProductUpdate bool `json:"product_update" gorm:"default:true"`
+}
+
// Session represents a user session
type Session struct {
Model
diff --git a/pkg/server/database/notes.go b/pkg/server/database/notes.go
index b8cb8450..91a850ad 100644
--- a/pkg/server/database/notes.go
+++ b/pkg/server/database/notes.go
@@ -1,22 +1,25 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package database
import (
- "gorm.io/gorm"
+ "github.com/jinzhu/gorm"
)
// PreloadNote preloads the associations for a notes for the given query
diff --git a/pkg/server/database/scripts/create-migration.sh b/pkg/server/database/scripts/create-migration.sh
new file mode 100755
index 00000000..ef168165
--- /dev/null
+++ b/pkg/server/database/scripts/create-migration.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+# create-migration.sh creates a new SQL migration file for the
+# server side Postgres database using the sql-migrate tool.
+set -eux
+
+is_command () {
+ command -v "$1" >/dev/null 2>&1;
+}
+
+if ! is_command sql-migrate; then
+ echo "sql-migrate is not found. Please run install-sql-migrate.sh"
+ exit 1
+fi
+
+if [ "$#" == 0 ]; then
+ echo "filename not provided"
+ exit 1
+fi
+
+filename=$1
+sql-migrate new -config=./sql-migrate.yml "$filename"
diff --git a/pkg/server/database/scripts/install-sql-migrate.sh b/pkg/server/database/scripts/install-sql-migrate.sh
new file mode 100755
index 00000000..334fb817
--- /dev/null
+++ b/pkg/server/database/scripts/install-sql-migrate.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+go get -v github.com/rubenv/sql-migrate/...
diff --git a/pkg/server/database/sql-migrate.yml b/pkg/server/database/sql-migrate.yml
new file mode 100644
index 00000000..f9c90d83
--- /dev/null
+++ b/pkg/server/database/sql-migrate.yml
@@ -0,0 +1,8 @@
+# A configuration for sql-migrate tool for generating migrations
+# using `sql-migrate new`. This file is not actually used for running
+# migrations because we run them programmatically.
+
+development:
+ dialect: postgres
+ datasource: dbname=dnote sslmode=disable
+ dir: ./migrations
diff --git a/pkg/server/database/types.go b/pkg/server/database/types.go
index 60544c29..e230c5ac 100644
--- a/pkg/server/database/types.go
+++ b/pkg/server/database/types.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package database
diff --git a/pkg/server/handlers/auth.go b/pkg/server/handlers/auth.go
new file mode 100644
index 00000000..2917e1b7
--- /dev/null
+++ b/pkg/server/handlers/auth.go
@@ -0,0 +1,168 @@
+package handlers
+
+import (
+ "context"
+ "net/http"
+ "strings"
+ "time"
+
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/helpers"
+ "github.com/dnote/dnote/pkg/server/log"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+)
+
+func authWithToken(db *gorm.DB, r *http.Request, tokenType string, p *AuthParams) (database.User, database.Token, bool, error) {
+ var user database.User
+ var token database.Token
+
+ query := r.URL.Query()
+ tokenValue := query.Get("token")
+ if tokenValue == "" {
+ return user, token, false, nil
+ }
+
+ conn := db.Where("value = ? AND type = ?", tokenValue, tokenType).First(&token)
+ if conn.RecordNotFound() {
+ return user, token, false, nil
+ } else if err := conn.Error; err != nil {
+ return user, token, false, errors.Wrap(err, "finding token")
+ }
+
+ if token.UsedAt != nil && time.Since(*token.UsedAt).Minutes() > 10 {
+ return user, token, false, nil
+ }
+
+ if err := db.Where("id = ?", token.UserID).First(&user).Error; err != nil {
+ return user, token, false, errors.Wrap(err, "finding user")
+ }
+
+ return user, token, true, nil
+}
+
+// Cors allows browser extensions to load resources
+func Cors(next http.HandlerFunc) http.HandlerFunc {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ origin := r.Header.Get("Origin")
+
+ // Allow browser extensions
+ if strings.HasPrefix(origin, "moz-extension://") || strings.HasPrefix(origin, "chrome-extension://") {
+ w.Header().Set("Access-Control-Allow-Origin", origin)
+ }
+
+ next.ServeHTTP(w, r)
+ })
+}
+
+// AuthParams is the params for the authentication middleware
+type AuthParams struct {
+ ProOnly bool
+ RedirectGuestsToLogin bool
+}
+
+// Auth is an authentication middleware
+func Auth(a *app.App, next http.HandlerFunc, p *AuthParams) http.HandlerFunc {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ user, ok, err := AuthWithSession(a.DB, r, p)
+ if !ok {
+ if p != nil && p.RedirectGuestsToLogin {
+ http.Redirect(w, r, "/login", http.StatusFound)
+ return
+ }
+
+ RespondUnauthorized(w)
+ return
+ }
+ if err != nil {
+ DoError(w, "authenticating with session", err, http.StatusInternalServerError)
+ return
+ }
+
+ if p != nil && p.ProOnly {
+ if !user.Cloud {
+ RespondForbidden(w)
+ return
+ }
+ }
+
+ ctx := context.WithValue(r.Context(), helpers.KeyUser, user)
+ next.ServeHTTP(w, r.WithContext(ctx))
+ })
+}
+
+// TokenAuth is an authentication middleware with token
+func TokenAuth(a *app.App, next http.HandlerFunc, tokenType string, p *AuthParams) http.HandlerFunc {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ user, token, ok, err := authWithToken(a.DB, r, tokenType, p)
+ if err != nil {
+ // log the error and continue
+ log.ErrorWrap(err, "authenticating with token")
+ }
+
+ ctx := r.Context()
+
+ if ok {
+ ctx = context.WithValue(ctx, helpers.KeyToken, token)
+ } else {
+ // If token-based auth fails, fall back to session-based auth
+ user, ok, err = AuthWithSession(a.DB, r, p)
+ if err != nil {
+ DoError(w, "authenticating with session", err, http.StatusInternalServerError)
+ return
+ }
+
+ if !ok {
+ RespondUnauthorized(w)
+ return
+ }
+ }
+
+ if p != nil && p.ProOnly {
+ if !user.Cloud {
+ RespondForbidden(w)
+ return
+ }
+ }
+
+ ctx = context.WithValue(ctx, helpers.KeyUser, user)
+ next.ServeHTTP(w, r.WithContext(ctx))
+ })
+}
+
+// AuthWithSession performs user authentication with session
+func AuthWithSession(db *gorm.DB, r *http.Request, p *AuthParams) (database.User, bool, error) {
+ var user database.User
+
+ sessionKey, err := GetCredential(r)
+ if err != nil {
+ return user, false, errors.Wrap(err, "getting credential")
+ }
+ if sessionKey == "" {
+ return user, false, nil
+ }
+
+ var session database.Session
+ conn := db.Where("key = ?", sessionKey).First(&session)
+
+ if conn.RecordNotFound() {
+ return user, false, nil
+ } else if err := conn.Error; err != nil {
+ return user, false, errors.Wrap(err, "finding session")
+ }
+
+ if session.ExpiresAt.Before(time.Now()) {
+ return user, false, nil
+ }
+
+ conn = db.Where("id = ?", session.UserID).First(&user)
+
+ if conn.RecordNotFound() {
+ return user, false, nil
+ } else if err := conn.Error; err != nil {
+ return user, false, errors.Wrap(err, "finding user from token")
+ }
+
+ return user, true, nil
+}
diff --git a/pkg/server/middleware/helpers.go b/pkg/server/handlers/helpers.go
similarity index 84%
rename from pkg/server/middleware/helpers.go
rename to pkg/server/handlers/helpers.go
index 580efa7f..4a274941 100644
--- a/pkg/server/middleware/helpers.go
+++ b/pkg/server/handlers/helpers.go
@@ -1,21 +1,7 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package middleware
+package handlers
import (
+ "encoding/json"
"net/http"
"strings"
"time"
@@ -40,7 +26,7 @@ func RespondForbidden(w http.ResponseWriter) {
// RespondUnauthorized responds with unauthorized
func RespondUnauthorized(w http.ResponseWriter) {
UnsetSessionCookie(w)
- w.Header().Add("WWW-Authenticate", `Bearer realm="Dnote", charset="UTF-8"`)
+ w.Header().Add("WWW-Authenticate", `Bearer realm="Dnote Pro", charset="UTF-8"`)
http.Error(w, "unauthorized", http.StatusUnauthorized)
}
@@ -86,9 +72,20 @@ func DoError(w http.ResponseWriter, msg string, err error, statusCode int) {
http.Error(w, statusText, statusCode)
}
+// RespondJSON encodes the given payload into a JSON format and writes it to the given response writer
+func RespondJSON(w http.ResponseWriter, statusCode int, payload interface{}) {
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(statusCode)
+
+ if err := json.NewEncoder(w).Encode(payload); err != nil {
+ DoError(w, "encoding response", err, http.StatusInternalServerError)
+ }
+}
+
// NotSupported is the handler for the route that is no longer supported
func NotSupported(w http.ResponseWriter, r *http.Request) {
http.Error(w, "API version is not supported. Please upgrade your client.", http.StatusGone)
+ return
}
// getSessionKeyFromCookie reads and returns a session key from the cookie sent by the
diff --git a/pkg/server/handlers/helpers_test.go b/pkg/server/handlers/helpers_test.go
new file mode 100644
index 00000000..9c1121bc
--- /dev/null
+++ b/pkg/server/handlers/helpers_test.go
@@ -0,0 +1,696 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package handlers
+
+import (
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+ "time"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+)
+
+func TestGetSessionKeyFromCookie(t *testing.T) {
+ testCases := []struct {
+ cookie *http.Cookie
+ expected string
+ }{
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: "foo",
+ HttpOnly: true,
+ },
+ expected: "foo",
+ },
+ {
+ cookie: nil,
+ expected: "",
+ },
+ {
+ cookie: &http.Cookie{
+ Name: "foo",
+ Value: "bar",
+ HttpOnly: true,
+ },
+ expected: "",
+ },
+ }
+
+ for _, tc := range testCases {
+ // set up
+ r, err := http.NewRequest("GET", "/", nil)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "constructing request"))
+ }
+
+ if tc.cookie != nil {
+ r.AddCookie(tc.cookie)
+ }
+
+ // execute
+ got, err := getSessionKeyFromCookie(r)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "executing"))
+ }
+
+ assert.Equal(t, got, tc.expected, "result mismatch")
+ }
+}
+
+func TestGetSessionKeyFromAuth(t *testing.T) {
+ testCases := []struct {
+ authHeaderStr string
+ expected string
+ }{
+ {
+ authHeaderStr: "Bearer foo",
+ expected: "foo",
+ },
+ }
+
+ for _, tc := range testCases {
+ // set up
+ r, err := http.NewRequest("GET", "/", nil)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "constructing request"))
+ }
+
+ r.Header.Set("Authorization", tc.authHeaderStr)
+
+ // execute
+ got, err := getSessionKeyFromAuth(r)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "executing"))
+ }
+
+ assert.Equal(t, got, tc.expected, "result mismatch")
+ }
+}
+
+func mustMakeRequest(t *testing.T) *http.Request {
+ r, err := http.NewRequest("GET", "/", nil)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "constructing request"))
+ }
+
+ return r
+}
+
+func TestGetCredential(t *testing.T) {
+ r1 := mustMakeRequest(t)
+ r2 := mustMakeRequest(t)
+ r2.Header.Set("Authorization", "Bearer foo")
+ r3 := mustMakeRequest(t)
+ r3.Header.Set("Authorization", "Bearer bar")
+
+ r4 := mustMakeRequest(t)
+ c4 := http.Cookie{
+ Name: "id",
+ Value: "foo",
+ HttpOnly: true,
+ }
+ r4.AddCookie(&c4)
+
+ r5 := mustMakeRequest(t)
+ c5 := http.Cookie{
+ Name: "id",
+ Value: "foo",
+ HttpOnly: true,
+ }
+ r5.AddCookie(&c5)
+ r5.Header.Set("Authorization", "Bearer foo")
+
+ testCases := []struct {
+ request *http.Request
+ expected string
+ }{
+ {
+ request: r1,
+ expected: "",
+ },
+ {
+ request: r2,
+ expected: "foo",
+ },
+ {
+ request: r3,
+ expected: "bar",
+ },
+ {
+ request: r4,
+ expected: "foo",
+ },
+ {
+ request: r5,
+ expected: "foo",
+ },
+ }
+
+ for _, tc := range testCases {
+ // execute
+ got, err := GetCredential(tc.request)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "executing"))
+ }
+
+ assert.Equal(t, got, tc.expected, "result mismatch")
+ }
+}
+
+func TestAuthMiddleware(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ user := testutils.SetupUserData()
+ session := database.Session{
+ Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
+ UserID: user.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session), "preparing session")
+ session2 := database.Session{
+ Key: "Vvgm3eBXfXGEFWERI7faiRJ3DAzJw+7DdT9J1LEyNfI=",
+ UserID: user.ID,
+ ExpiresAt: time.Now().Add(-time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session2), "preparing session")
+
+ handler := func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ }
+ a := &app.App{DB: testutils.DB}
+ server := httptest.NewServer(Auth(a, handler, nil))
+ defer server.Close()
+
+ t.Run("with header", func(t *testing.T) {
+ testCases := []struct {
+ header string
+ expectedStatus int
+ }{
+ {
+ header: fmt.Sprintf("Bearer %s", session.Key),
+ expectedStatus: http.StatusOK,
+ },
+ {
+ header: fmt.Sprintf("Bearer %s", session2.Key),
+ expectedStatus: http.StatusUnauthorized,
+ },
+ {
+ header: fmt.Sprintf("Bearer someInvalidSessionKey="),
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.header, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+ req.Header.Set("Authorization", tc.header)
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+
+ t.Run("with cookie", func(t *testing.T) {
+ testCases := []struct {
+ cookie *http.Cookie
+ expectedStatus int
+ }{
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: session.Key,
+ HttpOnly: true,
+ },
+ expectedStatus: http.StatusOK,
+ },
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: session2.Key,
+ HttpOnly: true,
+ },
+ expectedStatus: http.StatusUnauthorized,
+ },
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: "someInvalidSessionKey=",
+ HttpOnly: true,
+ },
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.cookie.Value, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+ req.AddCookie(tc.cookie)
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+
+ t.Run("without anything", func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
+ })
+}
+
+func TestAuthMiddleware_ProOnly(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("cloud", false), "preparing session")
+ session := database.Session{
+ Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
+ UserID: user.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session), "preparing session")
+
+ handler := func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ }
+
+ a := &app.App{DB: testutils.DB}
+ server := httptest.NewServer(Auth(a, handler, &AuthParams{
+ ProOnly: true,
+ }))
+
+ defer server.Close()
+
+ t.Run("with header", func(t *testing.T) {
+ testCases := []struct {
+ header string
+ expectedStatus int
+ }{
+ {
+ header: fmt.Sprintf("Bearer %s", session.Key),
+ expectedStatus: http.StatusForbidden,
+ },
+ {
+ header: fmt.Sprintf("Bearer someInvalidSessionKey="),
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.header, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+ req.Header.Set("Authorization", tc.header)
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+
+ t.Run("with cookie", func(t *testing.T) {
+ testCases := []struct {
+ cookie *http.Cookie
+ expectedStatus int
+ }{
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: session.Key,
+ HttpOnly: true,
+ },
+ expectedStatus: http.StatusForbidden,
+ },
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: "someInvalidSessionKey=",
+ HttpOnly: true,
+ },
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.cookie.Value, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+ req.AddCookie(tc.cookie)
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+}
+
+func TestAuthMiddleware_RedirectGuestsToLogin(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ handler := func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ }
+
+ a := &app.App{DB: testutils.DB}
+ server := httptest.NewServer(Auth(a, handler, &AuthParams{
+ RedirectGuestsToLogin: true,
+ }))
+
+ defer server.Close()
+
+ t.Run("guest", func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, http.StatusFound, "status code mismatch")
+ assert.Equal(t, res.Header.Get("Location"), "/login", "location header mismatch")
+ })
+
+ t.Run("logged in user", func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("cloud", false), "preparing session")
+ session := database.Session{
+ Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
+ UserID: user.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session), "preparing session")
+
+ // execute
+ res := testutils.HTTPAuthDo(t, req, user)
+ req.Header.Set("Authorization", session.Key)
+
+ // test
+ assert.Equal(t, res.StatusCode, http.StatusOK, "status code mismatch")
+ assert.Equal(t, res.Header.Get("Location"), "", "location header mismatch")
+ })
+
+}
+
+func TestTokenAuthMiddleWare(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ user := testutils.SetupUserData()
+ tok := database.Token{
+ UserID: user.ID,
+ Type: database.TokenTypeEmailPreference,
+ Value: "xpwFnc0MdllFUePDq9DLeQ==",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+ session := database.Session{
+ Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
+ UserID: user.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session), "preparing session")
+
+ handler := func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ }
+
+ a := &app.App{DB: testutils.DB}
+ server := httptest.NewServer(TokenAuth(a, handler, database.TokenTypeEmailPreference, nil))
+ defer server.Close()
+
+ t.Run("with token", func(t *testing.T) {
+ testCases := []struct {
+ token string
+ expectedStatus int
+ }{
+ {
+ token: "xpwFnc0MdllFUePDq9DLeQ==",
+ expectedStatus: http.StatusOK,
+ },
+ {
+ token: "someRandomToken==",
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.token, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", fmt.Sprintf("/?token=%s", tc.token), "")
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+
+ t.Run("with session header", func(t *testing.T) {
+ testCases := []struct {
+ header string
+ expectedStatus int
+ }{
+ {
+ header: fmt.Sprintf("Bearer %s", session.Key),
+ expectedStatus: http.StatusOK,
+ },
+ {
+ header: fmt.Sprintf("Bearer someInvalidSessionKey="),
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.header, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+ req.Header.Set("Authorization", tc.header)
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+
+ t.Run("with session cookie", func(t *testing.T) {
+ testCases := []struct {
+ cookie *http.Cookie
+ expectedStatus int
+ }{
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: session.Key,
+ HttpOnly: true,
+ },
+ expectedStatus: http.StatusOK,
+ },
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: "someInvalidSessionKey=",
+ HttpOnly: true,
+ },
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.cookie.Value, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+ req.AddCookie(tc.cookie)
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+
+ t.Run("without anything", func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
+ })
+}
+
+func TestTokenAuthMiddleWare_ProOnly(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ user := testutils.SetupUserData()
+ testutils.MustExec(t, testutils.DB.Model(&user).Update("cloud", false), "preparing session")
+ tok := database.Token{
+ UserID: user.ID,
+ Type: database.TokenTypeEmailPreference,
+ Value: "xpwFnc0MdllFUePDq9DLeQ==",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&tok), "preparing token")
+ session := database.Session{
+ Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
+ UserID: user.ID,
+ ExpiresAt: time.Now().Add(time.Hour * 24),
+ }
+ testutils.MustExec(t, testutils.DB.Save(&session), "preparing session")
+
+ handler := func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ }
+
+ a := &app.App{DB: testutils.DB}
+ server := httptest.NewServer(TokenAuth(a, handler, database.TokenTypeEmailPreference, &AuthParams{
+ ProOnly: true,
+ }))
+
+ defer server.Close()
+
+ t.Run("with token", func(t *testing.T) {
+ testCases := []struct {
+ token string
+ expectedStatus int
+ }{
+ {
+ token: "xpwFnc0MdllFUePDq9DLeQ==",
+ expectedStatus: http.StatusForbidden,
+ },
+ {
+ token: "someRandomToken==",
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.token, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", fmt.Sprintf("/?token=%s", tc.token), "")
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+
+ t.Run("with session header", func(t *testing.T) {
+ testCases := []struct {
+ header string
+ expectedStatus int
+ }{
+ {
+ header: fmt.Sprintf("Bearer %s", session.Key),
+ expectedStatus: http.StatusForbidden,
+ },
+ {
+ header: fmt.Sprintf("Bearer someInvalidSessionKey="),
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.header, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+ req.Header.Set("Authorization", tc.header)
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+
+ t.Run("with session cookie", func(t *testing.T) {
+ testCases := []struct {
+ cookie *http.Cookie
+ expectedStatus int
+ }{
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: session.Key,
+ HttpOnly: true,
+ },
+ expectedStatus: http.StatusForbidden,
+ },
+ {
+ cookie: &http.Cookie{
+ Name: "id",
+ Value: "someInvalidSessionKey=",
+ HttpOnly: true,
+ },
+ expectedStatus: http.StatusUnauthorized,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.cookie.Value, func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+ req.AddCookie(tc.cookie)
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, tc.expectedStatus, "status code mismatch")
+ })
+ }
+ })
+
+ t.Run("without anything", func(t *testing.T) {
+ req := testutils.MakeReq(server.URL, "GET", "/", "")
+
+ // execute
+ res := testutils.HTTPDo(t, req)
+
+ // test
+ assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
+ })
+}
diff --git a/pkg/server/handlers/limit.go b/pkg/server/handlers/limit.go
new file mode 100644
index 00000000..91d8685a
--- /dev/null
+++ b/pkg/server/handlers/limit.go
@@ -0,0 +1,124 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package handlers
+
+import (
+ "net/http"
+ "strings"
+ "sync"
+ "time"
+
+ "github.com/dnote/dnote/pkg/server/log"
+ "golang.org/x/time/rate"
+)
+
+type visitor struct {
+ limiter *rate.Limiter
+ lastSeen time.Time
+}
+
+var visitors = make(map[string]*visitor)
+var mtx sync.RWMutex
+
+func init() {
+ go cleanupVisitors()
+}
+
+// addVisitor adds a new visitor to the map and returns a limiter for the visitor
+func addVisitor(identifier string) *rate.Limiter {
+ // initialize a token bucket
+ limiter := rate.NewLimiter(rate.Every(1*time.Second), 60)
+
+ mtx.Lock()
+ visitors[identifier] = &visitor{
+ limiter: limiter,
+ lastSeen: time.Now()}
+ mtx.Unlock()
+
+ return limiter
+}
+
+// getVisitor returns a limiter for a visitor with the given identifier. It
+// adds the visitor to the map if not seen before.
+func getVisitor(identifier string) *rate.Limiter {
+ mtx.RLock()
+ v, exists := visitors[identifier]
+
+ if !exists {
+ mtx.RUnlock()
+ return addVisitor(identifier)
+ }
+
+ v.lastSeen = time.Now()
+ mtx.RUnlock()
+
+ return v.limiter
+}
+
+// cleanupVisitors deletes visitors that has not been seen in a while from the
+// map of visitors
+func cleanupVisitors() {
+ for {
+ time.Sleep(time.Minute)
+ mtx.Lock()
+
+ for identifier, v := range visitors {
+ if time.Now().Sub(v.lastSeen) > 3*time.Minute {
+ delete(visitors, identifier)
+ }
+ }
+
+ mtx.Unlock()
+ }
+}
+
+// lookupIP returns the request's IP
+func lookupIP(r *http.Request) string {
+ realIP := r.Header.Get("X-Real-IP")
+ forwardedFor := r.Header.Get("X-Forwarded-For")
+
+ if forwardedFor != "" {
+ parts := strings.Split(forwardedFor, ",")
+ return parts[0]
+ }
+
+ if realIP != "" {
+ return realIP
+ }
+
+ return r.RemoteAddr
+}
+
+// Limit is a middleware to rate limit the handler
+func Limit(next http.Handler) http.HandlerFunc {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ identifier := lookupIP(r)
+ limiter := getVisitor(identifier)
+
+ if !limiter.Allow() {
+ http.Error(w, "Too many requests", http.StatusTooManyRequests)
+ log.WithFields(log.Fields{
+ "ip": identifier,
+ }).Warn("Too many requests")
+ return
+ }
+
+ next.ServeHTTP(w, r)
+ })
+}
diff --git a/pkg/server/middleware/logging.go b/pkg/server/handlers/logging.go
similarity index 62%
rename from pkg/server/middleware/logging.go
rename to pkg/server/handlers/logging.go
index 13c9a9c9..d809fd1f 100644
--- a/pkg/server/middleware/logging.go
+++ b/pkg/server/handlers/logging.go
@@ -1,19 +1,4 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package middleware
+package handlers
import (
"fmt"
@@ -36,7 +21,7 @@ func (w *logResponseWriter) WriteHeader(code int) {
w.ResponseWriter.WriteHeader(code)
}
-// logging is a logging middleware
+// Logging is a logging middleware
func Logging(inner http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
diff --git a/pkg/server/handlers/main_test.go b/pkg/server/handlers/main_test.go
new file mode 100644
index 00000000..1263b952
--- /dev/null
+++ b/pkg/server/handlers/main_test.go
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package handlers
+
+import (
+ "os"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/server/testutils"
+)
+
+func TestMain(m *testing.M) {
+ testutils.InitTestDB()
+
+ code := m.Run()
+ testutils.ClearData(testutils.DB)
+
+ os.Exit(code)
+}
diff --git a/pkg/server/helpers/const.go b/pkg/server/helpers/const.go
index 3a634d09..e589ccb5 100644
--- a/pkg/server/helpers/const.go
+++ b/pkg/server/helpers/const.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package helpers
diff --git a/pkg/server/helpers/helpers.go b/pkg/server/helpers/helpers.go
new file mode 100644
index 00000000..bf1a88dc
--- /dev/null
+++ b/pkg/server/helpers/helpers.go
@@ -0,0 +1,41 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package helpers
+
+import (
+ "github.com/google/uuid"
+ "github.com/pkg/errors"
+)
+
+// GenUUID generates a new uuid v4
+func GenUUID() (string, error) {
+ id, err := uuid.NewRandom()
+ if err != nil {
+ return "", errors.Wrap(err, "generating uuid")
+ }
+
+ return id.String(), nil
+}
+
+// ValidateUUID validates the given uuid
+func ValidateUUID(u string) bool {
+ _, err := uuid.Parse(u)
+
+ return err == nil
+}
diff --git a/pkg/server/helpers/url.go b/pkg/server/helpers/url.go
deleted file mode 100644
index 0d935754..00000000
--- a/pkg/server/helpers/url.go
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package helpers
-
-import (
- "fmt"
- "net/url"
-)
-
-// GetPath returns a path optionally suffixed by query string
-func GetPath(path string, query *url.Values) string {
- if query == nil {
- return path
- }
-
- q := query.Encode()
- return fmt.Sprintf("%s?%s", path, q)
-}
diff --git a/pkg/server/helpers/url_test.go b/pkg/server/helpers/url_test.go
deleted file mode 100644
index 78142b29..00000000
--- a/pkg/server/helpers/url_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package helpers
-
-import (
- "net/url"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
-)
-
-func TestGetPath(t *testing.T) {
- t.Run("without query", func(t *testing.T) {
- // execute
- got := GetPath("/some-path", nil)
-
- // test
- assert.Equal(t, got, "/some-path", "got mismatch")
- })
-
- t.Run("with query", func(t *testing.T) {
- // execute
- q := url.Values{}
- q.Set("foo", "bar")
- q.Set("baz", "/quz")
- got := GetPath("/some-path", &q)
-
- // test
- assert.Equal(t, got, "/some-path?baz=%2Fquz&foo=bar", "got mismatch")
- })
-}
diff --git a/pkg/server/helpers/uuid.go b/pkg/server/helpers/uuid.go
deleted file mode 100644
index ed1090d4..00000000
--- a/pkg/server/helpers/uuid.go
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package helpers
-
-import (
- "github.com/google/uuid"
- "github.com/pkg/errors"
-)
-
-// GenUUID generates a new uuid v4
-func GenUUID() (string, error) {
- id, err := uuid.NewRandom()
- if err != nil {
- return "", errors.Wrap(err, "generating uuid")
- }
-
- return id.String(), nil
-}
-
-// ValidateUUID validates the given uuid
-func ValidateUUID(u string) bool {
- _, err := uuid.Parse(u)
-
- return err == nil
-}
diff --git a/pkg/server/job/job.go b/pkg/server/job/job.go
new file mode 100644
index 00000000..15450c00
--- /dev/null
+++ b/pkg/server/job/job.go
@@ -0,0 +1,153 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package job
+
+import (
+ slog "log"
+
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/dnote/dnote/pkg/server/job/remind"
+ "github.com/dnote/dnote/pkg/server/log"
+ "github.com/dnote/dnote/pkg/server/mailer"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+ "github.com/robfig/cron"
+)
+
+var (
+ // ErrEmptyDB is an error for missing database connection in the app configuration
+ ErrEmptyDB = errors.New("No database connection was provided")
+ // ErrEmptyClock is an error for missing clock in the app configuration
+ ErrEmptyClock = errors.New("No clock was provided")
+ // ErrEmptyWebURL is an error for missing WebURL content in the app configuration
+ ErrEmptyWebURL = errors.New("No WebURL was provided")
+ // ErrEmptyEmailTemplates is an error for missing EmailTemplates content in the app configuration
+ ErrEmptyEmailTemplates = errors.New("No EmailTemplate store was provided")
+ // ErrEmptyEmailBackend is an error for missing EmailBackend content in the app configuration
+ ErrEmptyEmailBackend = errors.New("No EmailBackend was provided")
+)
+
+// Runner is a configuration for job
+type Runner struct {
+ DB *gorm.DB
+ Clock clock.Clock
+ EmailTmpl mailer.Templates
+ EmailBackend mailer.Backend
+ Config config.Config
+}
+
+// NewRunner returns a new runner
+func NewRunner(db *gorm.DB, c clock.Clock, t mailer.Templates, b mailer.Backend, config config.Config) (Runner, error) {
+ ret := Runner{
+ DB: db,
+ EmailTmpl: t,
+ EmailBackend: b,
+ Clock: c,
+ Config: config,
+ }
+
+ if err := ret.validate(); err != nil {
+ return Runner{}, errors.Wrap(err, "validating runner configuration")
+ }
+
+ return ret, nil
+}
+
+func (r *Runner) validate() error {
+ if r.DB == nil {
+ return ErrEmptyDB
+ }
+ if r.Clock == nil {
+ return ErrEmptyClock
+ }
+ if r.EmailTmpl == nil {
+ return ErrEmptyEmailTemplates
+ }
+ if r.EmailBackend == nil {
+ return ErrEmptyEmailBackend
+ }
+ if r.Config.WebURL == "" {
+ return ErrEmptyWebURL
+ }
+
+ return nil
+}
+
+func scheduleJob(c *cron.Cron, spec string, cmd func()) {
+ s, err := cron.ParseStandard(spec)
+ if err != nil {
+ panic(errors.Wrap(err, "parsing schedule"))
+ }
+
+ c.Schedule(s, cron.FuncJob(cmd))
+}
+
+func (r *Runner) schedule(ch chan error) {
+ // Schedule jobs
+ cr := cron.New()
+ scheduleJob(cr, "0 8 * * *", func() { r.RemindNoRecentNotes() })
+ cr.Start()
+
+ ch <- nil
+
+ // Block forever
+ select {}
+}
+
+// Do starts the background tasks in a separate goroutine that runs forever
+func (r *Runner) Do() error {
+ // validate
+ if err := r.validate(); err != nil {
+ return errors.Wrap(err, "validating job configurations")
+ }
+
+ ch := make(chan error)
+ go r.schedule(ch)
+ if err := <-ch; err != nil {
+ return errors.Wrap(err, "scheduling jobs")
+ }
+
+ slog.Println("Started background tasks")
+
+ return nil
+}
+
+// RemindNoRecentNotes remind users if no notes have been added recently
+func (r *Runner) RemindNoRecentNotes() {
+ c := remind.Context{
+ DB: r.DB,
+ Clock: r.Clock,
+ EmailTmpl: r.EmailTmpl,
+ EmailBackend: r.EmailBackend,
+ Config: r.Config,
+ }
+
+ result, err := remind.DoInactive(c)
+ m := log.WithFields(log.Fields{
+ "success_count": result.SuccessCount,
+ "failed_user_ids": result.FailedUserIDs,
+ })
+
+ if err == nil {
+ m.Info("successfully processed no recent note reminder job")
+ } else {
+ m.ErrorWrap(err, "error processing no recent note reminder job")
+ }
+}
diff --git a/pkg/server/job/job_test.go b/pkg/server/job/job_test.go
new file mode 100644
index 00000000..3ebfa90b
--- /dev/null
+++ b/pkg/server/job/job_test.go
@@ -0,0 +1,104 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package job
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/dnote/dnote/pkg/server/mailer"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+)
+
+func TestNewRunner(t *testing.T) {
+ testCases := []struct {
+ db *gorm.DB
+ clock clock.Clock
+ emailTmpl mailer.Templates
+ emailBackend mailer.Backend
+ webURL string
+ expectedErr error
+ }{
+ {
+ db: &gorm.DB{},
+ clock: clock.NewMock(),
+ emailTmpl: mailer.Templates{},
+ emailBackend: &testutils.MockEmailbackendImplementation{},
+ webURL: "http://mock.url",
+ expectedErr: nil,
+ },
+ {
+ db: nil,
+ clock: clock.NewMock(),
+ emailTmpl: mailer.Templates{},
+ emailBackend: &testutils.MockEmailbackendImplementation{},
+ webURL: "http://mock.url",
+ expectedErr: ErrEmptyDB,
+ },
+ {
+ db: &gorm.DB{},
+ clock: nil,
+ emailTmpl: mailer.Templates{},
+ emailBackend: &testutils.MockEmailbackendImplementation{},
+ webURL: "http://mock.url",
+ expectedErr: ErrEmptyClock,
+ },
+ {
+ db: &gorm.DB{},
+ clock: clock.NewMock(),
+ emailTmpl: nil,
+ emailBackend: &testutils.MockEmailbackendImplementation{},
+ webURL: "http://mock.url",
+ expectedErr: ErrEmptyEmailTemplates,
+ },
+ {
+ db: &gorm.DB{},
+ clock: clock.NewMock(),
+ emailTmpl: mailer.Templates{},
+ emailBackend: nil,
+ webURL: "http://mock.url",
+ expectedErr: ErrEmptyEmailBackend,
+ },
+ {
+ db: &gorm.DB{},
+ clock: clock.NewMock(),
+ emailTmpl: mailer.Templates{},
+ emailBackend: &testutils.MockEmailbackendImplementation{},
+ webURL: "",
+ expectedErr: ErrEmptyWebURL,
+ },
+ }
+
+ for idx, tc := range testCases {
+ t.Run(fmt.Sprintf("test case %d", idx), func(t *testing.T) {
+
+ c := config.Load()
+ c.WebURL = tc.webURL
+
+ _, err := NewRunner(tc.db, tc.clock, tc.emailTmpl, tc.emailBackend, c)
+
+ assert.Equal(t, errors.Cause(err), tc.expectedErr, "error mismatch")
+ })
+ }
+}
diff --git a/pkg/server/job/remind/inactive.go b/pkg/server/job/remind/inactive.go
new file mode 100644
index 00000000..e7fc0f03
--- /dev/null
+++ b/pkg/server/job/remind/inactive.go
@@ -0,0 +1,210 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package remind
+
+import (
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/log"
+ "github.com/dnote/dnote/pkg/server/mailer"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+)
+
+// Context holds data that repetition job needs in order to perform
+type Context struct {
+ DB *gorm.DB
+ Clock clock.Clock
+ EmailTmpl mailer.Templates
+ EmailBackend mailer.Backend
+ Config config.Config
+}
+
+type inactiveUserInfo struct {
+ userID int
+ email string
+ sampleNoteUUID string
+}
+
+func (c *Context) sampleUserNote(userID int) (database.Note, error) {
+ var ret database.Note
+ // FIXME: ordering by random() requires a sequential scan on the whole table and does not scale
+ if err := c.DB.Where("user_id = ?", userID).Order("random() DESC").First(&ret).Error; err != nil {
+ return ret, errors.Wrap(err, "getting a random note")
+ }
+
+ return ret, nil
+}
+
+func (c *Context) getInactiveUserInfo() ([]inactiveUserInfo, error) {
+ ret := []inactiveUserInfo{}
+
+ threshold := c.Clock.Now().AddDate(0, 0, -14).Unix()
+
+ rows, err := c.DB.Raw(`
+SELECT
+ notes.user_id AS user_id,
+ accounts.email,
+ SUM(
+ CASE
+ WHEN notes.created_at > to_timestamp(?) THEN 1
+ ELSE 0
+ END
+ ) AS recent_note_count,
+ COUNT(*) AS total_note_count
+FROM notes
+INNER JOIN accounts ON accounts.user_id = notes.user_id
+WHERE accounts.email IS NOT NULL AND accounts.email_verified IS TRUE
+GROUP BY notes.user_id, accounts.email`, threshold).Rows()
+ if err != nil {
+ return ret, errors.Wrap(err, "executing note count SQL query")
+ }
+ defer rows.Close()
+ for rows.Next() {
+ var userID, recentNoteCount, totalNoteCount int
+ var email string
+ if err := rows.Scan(&userID, &email, &recentNoteCount, &totalNoteCount); err != nil {
+ return nil, errors.Wrap(err, "scanning a row")
+ }
+
+ if recentNoteCount == 0 && totalNoteCount > 0 {
+ note, err := c.sampleUserNote(userID)
+ if err != nil {
+ return nil, errors.Wrap(err, "sampling user note")
+ }
+
+ ret = append(ret, inactiveUserInfo{
+ userID: userID,
+ email: email,
+ sampleNoteUUID: note.UUID,
+ })
+ }
+ }
+
+ return ret, nil
+}
+
+func (c *Context) canNotify(info inactiveUserInfo) (bool, error) {
+ var pref database.EmailPreference
+ if err := c.DB.Where("user_id = ?", info.userID).First(&pref).Error; err != nil {
+ return false, errors.Wrap(err, "getting email preference")
+ }
+
+ if !pref.InactiveReminder {
+ return false, nil
+ }
+
+ var notif database.Notification
+ conn := c.DB.Where("user_id = ? AND type = ?", info.userID, mailer.EmailTypeInactiveReminder).Order("created_at DESC").First(¬if)
+
+ if conn.RecordNotFound() {
+ return true, nil
+ } else if err := conn.Error; err != nil {
+ return false, errors.Wrap(err, "checking cooldown")
+ }
+
+ t := c.Clock.Now().AddDate(0, 0, -14)
+ if notif.CreatedAt.Before(t) {
+ return true, nil
+ }
+
+ return false, nil
+}
+
+func (c *Context) process(info inactiveUserInfo) error {
+ ok, err := c.canNotify(info)
+ if err != nil {
+ return errors.Wrap(err, "checking if user can be notified")
+ }
+ if !ok {
+ return nil
+ }
+
+ sender, err := app.GetSenderEmail(c.Config, "noreply@getdnote.com")
+ if err != nil {
+ return errors.Wrap(err, "getting sender email")
+ }
+
+ tok, err := mailer.GetToken(c.DB, info.userID, database.TokenTypeEmailPreference)
+ if err != nil {
+ return errors.Wrap(err, "getting email token")
+ }
+
+ tmplData := mailer.InactiveReminderTmplData{
+ WebURL: c.Config.WebURL,
+ SampleNoteUUID: info.sampleNoteUUID,
+ Token: tok.Value,
+ }
+ body, err := c.EmailTmpl.Execute(mailer.EmailTypeInactiveReminder, mailer.EmailKindText, tmplData)
+ if err != nil {
+ return errors.Wrap(err, "executing inactive email template")
+ }
+
+ if err := c.EmailBackend.Queue("Your Dnote stopped growing", sender, []string{info.email}, mailer.EmailKindText, body); err != nil {
+ return errors.Wrap(err, "queueing email")
+ }
+
+ if err := c.DB.Create(&database.Notification{
+ Type: mailer.EmailTypeInactiveReminder,
+ UserID: info.userID,
+ }).Error; err != nil {
+ return errors.Wrap(err, "creating notification")
+ }
+
+ return nil
+}
+
+// Result holds the result of the job
+type Result struct {
+ SuccessCount int
+ FailedUserIDs []int
+}
+
+// DoInactive sends reminder for users with no recent notes
+func DoInactive(c Context) (Result, error) {
+ log.Info("performing reminder for no recent notes")
+
+ result := Result{}
+ items, err := c.getInactiveUserInfo()
+ if err != nil {
+ return result, errors.Wrap(err, "getting inactive user information")
+ }
+
+ log.WithFields(log.Fields{
+ "user_count": len(items),
+ }).Info("counted inactive users")
+
+ for _, item := range items {
+ err := c.process(item)
+
+ if err == nil {
+ result.SuccessCount = result.SuccessCount + 1
+ } else {
+ log.WithFields(log.Fields{
+ "user_id": item.userID,
+ }).ErrorWrap(err, "Could not process no recent notes reminder")
+
+ result.FailedUserIDs = append(result.FailedUserIDs, item.userID)
+ }
+ }
+
+ return result, nil
+}
diff --git a/pkg/server/job/remind/inactive_test.go b/pkg/server/job/remind/inactive_test.go
new file mode 100644
index 00000000..2f63cdcf
--- /dev/null
+++ b/pkg/server/job/remind/inactive_test.go
@@ -0,0 +1,194 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package remind
+
+import (
+ "os"
+ "sort"
+ "testing"
+ "time"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/mailer"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+)
+
+func getTestContext(c clock.Clock, be *testutils.MockEmailbackendImplementation) Context {
+ emailTmplDir := os.Getenv("DNOTE_TEST_EMAIL_TEMPLATE_DIR")
+
+ con := Context{
+ DB: testutils.DB,
+ Clock: c,
+ EmailTmpl: mailer.NewTemplates(&emailTmplDir),
+ EmailBackend: be,
+ }
+
+ return con
+}
+
+func TestDoInactive(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ t1 := time.Now()
+
+ // u1 is an active user
+ u1 := testutils.SetupUserData()
+ a1 := testutils.SetupAccountData(u1, "alice@example.com", "pass1234")
+ testutils.MustExec(t, testutils.DB.Model(&a1).Update("email_verified", true), "setting email verified")
+ testutils.MustExec(t, testutils.DB.Save(&database.EmailPreference{UserID: u1.ID, InactiveReminder: true}), "preparing email preference")
+
+ b1 := database.Book{
+ UserID: u1.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+ n1 := database.Note{
+ BookUUID: b1.UUID,
+ UserID: u1.ID,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n1), "preparing n1")
+
+ // u2 is an inactive user
+ u2 := testutils.SetupUserData()
+ a2 := testutils.SetupAccountData(u2, "bob@example.com", "pass1234")
+ testutils.MustExec(t, testutils.DB.Model(&a2).Update("email_verified", true), "setting email verified")
+ testutils.MustExec(t, testutils.DB.Save(&database.EmailPreference{UserID: u2.ID, InactiveReminder: true}), "preparing email preference")
+
+ b2 := database.Book{
+ UserID: u2.ID,
+ Label: "css",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b2), "preparing b2")
+ n2 := database.Note{
+ UserID: u2.ID,
+ BookUUID: b2.UUID,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n2), "preparing n2")
+ testutils.MustExec(t, testutils.DB.Model(&n2).Update("created_at", t1.AddDate(0, 0, -15)), "preparing n2")
+
+ // u3 is an inactive user with inactive alert email preference disabled
+ u3 := testutils.SetupUserData()
+ a3 := testutils.SetupAccountData(u3, "alice@example.com", "pass1234")
+ testutils.MustExec(t, testutils.DB.Model(&a3).Update("email_verified", true), "setting email verified")
+ emailPref3 := database.EmailPreference{UserID: u3.ID}
+ testutils.MustExec(t, testutils.DB.Save(&emailPref3), "preparing email preference")
+ testutils.MustExec(t, testutils.DB.Model(&emailPref3).Update(map[string]interface{}{"inactive_reminder": false}), "updating email preference")
+
+ b3 := database.Book{
+ UserID: u3.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b3), "preparing b3")
+ n3 := database.Note{
+ BookUUID: b3.UUID,
+ UserID: u3.ID,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n3), "preparing n3")
+ testutils.MustExec(t, testutils.DB.Model(&n3).Update("created_at", t1.AddDate(0, 0, -15)), "preparing n3")
+
+ c := clock.NewMock()
+ c.SetNow(t1)
+ be := &testutils.MockEmailbackendImplementation{}
+
+ con := getTestContext(c, be)
+ if _, err := DoInactive(con); err != nil {
+ t.Fatal(errors.Wrap(err, "performing"))
+ }
+
+ assert.Equalf(t, len(be.Emails), 1, "email queue count mismatch")
+ assert.DeepEqual(t, be.Emails[0].To, []string{a2.Email.String}, "email address mismatch")
+}
+
+func TestDoInactive_Cooldown(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ // setup sets up an inactive user
+ setup := func(t *testing.T, now time.Time, email string) database.User {
+ u := testutils.SetupUserData()
+ a := testutils.SetupAccountData(u, email, "pass1234")
+ testutils.MustExec(t, testutils.DB.Model(&a).Update("email_verified", true), "setting email verified")
+ testutils.MustExec(t, testutils.DB.Save(&database.EmailPreference{UserID: u.ID, InactiveReminder: true}), "preparing email preference")
+
+ b := database.Book{
+ UserID: u.ID,
+ Label: "css",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b), "preparing book")
+ n := database.Note{
+ UserID: u.ID,
+ BookUUID: b.UUID,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n), "preparing note")
+ testutils.MustExec(t, testutils.DB.Model(&n).Update("created_at", now.AddDate(0, 0, -15)), "preparing note")
+
+ return u
+ }
+
+ // Set up
+ now := time.Now()
+
+ setup(t, now, "alice@example.com")
+
+ bob := setup(t, now, "bob@example.com")
+ bobNotif := database.Notification{Type: mailer.EmailTypeInactiveReminder, UserID: bob.ID}
+ testutils.MustExec(t, testutils.DB.Create(&bobNotif), "preparing inactive notification for bob")
+ testutils.MustExec(t, testutils.DB.Model(&bobNotif).Update("created_at", now.AddDate(0, 0, -7)), "preparing created_at for inactive notification for bob")
+
+ chuck := setup(t, now, "chuck@example.com")
+ chuckNotif := database.Notification{Type: mailer.EmailTypeInactiveReminder, UserID: chuck.ID}
+ testutils.MustExec(t, testutils.DB.Create(&chuckNotif), "preparing inactive notification for chuck")
+ testutils.MustExec(t, testutils.DB.Model(&chuckNotif).Update("created_at", now.AddDate(0, 0, -15)), "preparing created_at for inactive notification for chuck")
+
+ dan := setup(t, now, "dan@example.com")
+ danNotif1 := database.Notification{Type: mailer.EmailTypeInactiveReminder, UserID: dan.ID}
+ testutils.MustExec(t, testutils.DB.Create(&danNotif1), "preparing inactive notification 1 for dan")
+ testutils.MustExec(t, testutils.DB.Model(&danNotif1).Update("created_at", now.AddDate(0, 0, -10)), "preparing created_at for inactive notification for dan")
+ danNotif2 := database.Notification{Type: mailer.EmailTypeInactiveReminder, UserID: dan.ID}
+ testutils.MustExec(t, testutils.DB.Create(&danNotif2), "preparing inactive notification 2 for dan")
+ testutils.MustExec(t, testutils.DB.Model(&danNotif2).Update("created_at", now.AddDate(0, 0, -15)), "preparing created_at for inactive notification for dan")
+
+ c := clock.NewMock()
+ c.SetNow(now)
+ be := &testutils.MockEmailbackendImplementation{}
+
+ // Execute
+ con := getTestContext(c, be)
+ if _, err := DoInactive(con); err != nil {
+ t.Fatal(errors.Wrap(err, "performing"))
+ }
+
+ // Test
+ assert.Equalf(t, len(be.Emails), 2, "email queue count mismatch")
+
+ var recipients []string
+ for _, email := range be.Emails {
+ recipients = append(recipients, email.To[0])
+ }
+ sort.SliceStable(recipients, func(i, j int) bool {
+ r1 := recipients[i]
+ r2 := recipients[j]
+
+ return r1 < r2
+ })
+
+ assert.DeepEqual(t, recipients, []string{"alice@example.com", "chuck@example.com"}, "email address mismatch")
+}
diff --git a/pkg/server/job/remind/main_test.go b/pkg/server/job/remind/main_test.go
new file mode 100644
index 00000000..c92e1bef
--- /dev/null
+++ b/pkg/server/job/remind/main_test.go
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package remind
+
+import (
+ "os"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/server/testutils"
+)
+
+func TestMain(m *testing.M) {
+ testutils.InitTestDB()
+
+ code := m.Run()
+ testutils.ClearData(testutils.DB)
+
+ os.Exit(code)
+}
diff --git a/pkg/server/log/log.go b/pkg/server/log/log.go
index 172255ba..607ece7c 100644
--- a/pkg/server/log/log.go
+++ b/pkg/server/log/log.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
// Package log provides interfaces to write structured logs
@@ -29,19 +32,9 @@ const (
fieldKeyTimestamp = "ts"
fieldKeyUnixTimestamp = "ts_unix"
- // LevelDebug represents debug log level
- LevelDebug = "debug"
- // LevelInfo represents info log level
- LevelInfo = "info"
- // LevelWarn represents warn log level
- LevelWarn = "warn"
- // LevelError represents error log level
- LevelError = "error"
-)
-
-var (
- // currentLevel is the currently configured log level
- currentLevel = LevelInfo
+ levelInfo = "info"
+ levelWarn = "warn"
+ levelError = "error"
)
// Fields represents a set of information to be included in the log
@@ -65,65 +58,19 @@ func WithFields(fields Fields) Entry {
return newEntry(fields)
}
-// SetLevel sets the global log level
-func SetLevel(level string) {
- currentLevel = level
-}
-
-// GetLevel returns the current global log level
-func GetLevel() string {
- return currentLevel
-}
-
-// shouldLog returns true if the given level should be logged based on currentLevel.
-//
-// Log level behavior (hierarchical):
-// - LevelDebug: shows all messages (debug, info, warn, error)
-// - LevelInfo: shows info, warn, and error messages
-// - LevelWarn: shows warn and error messages
-// - LevelError: shows only error messages
-func shouldLog(level string) bool {
- // Debug level shows everything
- if currentLevel == LevelDebug {
- return true
- }
-
- // Info level shows info + warn + error
- if currentLevel == LevelInfo {
- return level == LevelInfo || level == LevelWarn || level == LevelError
- }
-
- // Warn level shows warn + error
- if currentLevel == LevelWarn {
- return level == LevelWarn || level == LevelError
- }
-
- // Error level shows only error
- if currentLevel == LevelError {
- return level == LevelError
- }
-
- return false
-}
-
-// Debug logs the given entry at a debug level
-func (e Entry) Debug(msg string) {
- e.write(LevelDebug, msg)
-}
-
// Info logs the given entry at an info level
func (e Entry) Info(msg string) {
- e.write(LevelInfo, msg)
+ e.write(levelInfo, msg)
}
// Warn logs the given entry at a warning level
func (e Entry) Warn(msg string) {
- e.write(LevelWarn, msg)
+ e.write(levelWarn, msg)
}
// Error logs the given entry at an error level
func (e Entry) Error(msg string) {
- e.write(LevelError, msg)
+ e.write(levelError, msg)
}
// ErrorWrap logs the given entry with the error message annotated by the given message
@@ -159,10 +106,6 @@ func (e Entry) formatJSON(level, msg string) []byte {
}
func (e Entry) write(level, msg string) {
- if !shouldLog(level) {
- return
- }
-
serialized := e.formatJSON(level, msg)
_, err := fmt.Fprintln(os.Stderr, string(serialized))
@@ -171,11 +114,6 @@ func (e Entry) write(level, msg string) {
}
}
-// Debug logs a debug message without additional fields
-func Debug(msg string) {
- newEntry(Fields{}).Debug(msg)
-}
-
// Info logs an info message without additional fields
func Info(msg string) {
newEntry(Fields{}).Info(msg)
diff --git a/pkg/server/log/log_test.go b/pkg/server/log/log_test.go
deleted file mode 100644
index dd98c685..00000000
--- a/pkg/server/log/log_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package log
-
-import (
- "testing"
-)
-
-func TestSetLevel(t *testing.T) {
- // Reset to default after test
- defer SetLevel(LevelInfo)
-
- SetLevel(LevelDebug)
- if currentLevel != LevelDebug {
- t.Errorf("Expected level %s, got %s", LevelDebug, currentLevel)
- }
-
- SetLevel(LevelError)
- if currentLevel != LevelError {
- t.Errorf("Expected level %s, got %s", LevelError, currentLevel)
- }
-}
-
-func TestShouldLog(t *testing.T) {
- // Reset to default after test
- defer SetLevel(LevelInfo)
-
- testCases := []struct {
- currentLevel string
- logLevel string
- expected bool
- description string
- }{
- // Debug level shows everything
- {LevelDebug, LevelDebug, true, "debug level should show debug"},
- {LevelDebug, LevelInfo, true, "debug level should show info"},
- {LevelDebug, LevelWarn, true, "debug level should show warn"},
- {LevelDebug, LevelError, true, "debug level should show error"},
-
- // Info level shows info + warn + error
- {LevelInfo, LevelDebug, false, "info level should not show debug"},
- {LevelInfo, LevelInfo, true, "info level should show info"},
- {LevelInfo, LevelWarn, true, "info level should show warn"},
- {LevelInfo, LevelError, true, "info level should show error"},
-
- // Warn level shows warn + error
- {LevelWarn, LevelDebug, false, "warn level should not show debug"},
- {LevelWarn, LevelInfo, false, "warn level should not show info"},
- {LevelWarn, LevelWarn, true, "warn level should show warn"},
- {LevelWarn, LevelError, true, "warn level should show error"},
-
- // Error level shows only error
- {LevelError, LevelDebug, false, "error level should not show debug"},
- {LevelError, LevelInfo, false, "error level should not show info"},
- {LevelError, LevelWarn, false, "error level should not show warn"},
- {LevelError, LevelError, true, "error level should show error"},
- }
-
- for _, tc := range testCases {
- SetLevel(tc.currentLevel)
- result := shouldLog(tc.logLevel)
- if result != tc.expected {
- t.Errorf("%s: expected %v, got %v", tc.description, tc.expected, result)
- }
- }
-}
diff --git a/pkg/server/mailer/backend.go b/pkg/server/mailer/backend.go
index a09cf2e6..fddf1e98 100644
--- a/pkg/server/mailer/backend.go
+++ b/pkg/server/mailer/backend.go
@@ -1,25 +1,29 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package mailer
import (
+ "fmt"
+ "log"
"os"
"strconv"
- "github.com/dnote/dnote/pkg/server/log"
"github.com/pkg/errors"
"gopkg.in/gomail.v2"
)
@@ -29,25 +33,12 @@ var ErrSMTPNotConfigured = errors.New("SMTP is not configured")
// Backend is an interface for sending emails.
type Backend interface {
- SendEmail(templateType, from string, to []string, data interface{}) error
+ Queue(subject, from string, to []string, contentType, body string) error
}
-// EmailDialer is an interface for sending email messages
-type EmailDialer interface {
- DialAndSend(m ...*gomail.Message) error
-}
-
-// gomailDialer wraps gomail.Dialer to implement EmailDialer interface
-type gomailDialer struct {
- *gomail.Dialer
-}
-
-// DefaultBackend is an implementation of the Backend
+// SimpleBackendImplementation is an implementation of the Backend
// that sends an email without queueing.
-// This backend is always enabled and will send emails via SMTP.
-type DefaultBackend struct {
- Dialer EmailDialer
- Templates Templates
+type SimpleBackendImplementation struct {
}
type dialerParams struct {
@@ -82,74 +73,31 @@ func getSMTPParams() (*dialerParams, error) {
return p, nil
}
-// NewDefaultBackend creates a default backend
-func NewDefaultBackend() (*DefaultBackend, error) {
- p, err := getSMTPParams()
- if err != nil {
- return nil, err
+// Queue is an implementation of Backend.Queue.
+func (b *SimpleBackendImplementation) Queue(subject, from string, to []string, contentType, body string) error {
+ // If not production, never actually send an email
+ if os.Getenv("GO_ENV") != "PRODUCTION" {
+ log.Println("Not sending email because Dnote is not running in a production environment.")
+ log.Printf("Subject: %s, to: %s, from: %s", subject, to, from)
+ fmt.Println(body)
+ return nil
}
- d := gomail.NewDialer(p.Host, p.Port, p.Username, p.Password)
-
- return &DefaultBackend{
- Dialer: &gomailDialer{Dialer: d},
- Templates: NewTemplates(),
- }, nil
-}
-
-// SendEmail is an implementation of Backend.SendEmail.
-// It renders the template and sends the email immediately via SMTP.
-func (b *DefaultBackend) SendEmail(templateType, from string, to []string, data interface{}) error {
- subject, body, err := b.Templates.Execute(templateType, EmailKindText, data)
- if err != nil {
- return errors.Wrap(err, "executing template")
- }
-
- return b.queue(subject, from, to, EmailKindText, body)
-}
-
-// queue sends the email immediately via SMTP.
-func (b *DefaultBackend) queue(subject, from string, to []string, contentType, body string) error {
m := gomail.NewMessage()
m.SetHeader("From", from)
m.SetHeader("To", to...)
m.SetHeader("Subject", subject)
m.SetBody(contentType, body)
- if err := b.Dialer.DialAndSend(m); err != nil {
+ p, err := getSMTPParams()
+ if err != nil {
+ return errors.Wrap(err, "getting dialer params")
+ }
+
+ d := gomail.NewPlainDialer(p.Host, p.Port, p.Username, p.Password)
+ if err := d.DialAndSend(m); err != nil {
return errors.Wrap(err, "dialing and sending email")
}
return nil
}
-
-// StdoutBackend is an implementation of the Backend
-// that prints emails to stdout instead of sending them.
-// This is useful for development and testing.
-type StdoutBackend struct {
- Templates Templates
-}
-
-// NewStdoutBackend creates a stdout backend
-func NewStdoutBackend() *StdoutBackend {
- return &StdoutBackend{
- Templates: NewTemplates(),
- }
-}
-
-// SendEmail is an implementation of Backend.SendEmail.
-// It renders the template and logs the email to stdout instead of sending it.
-func (b *StdoutBackend) SendEmail(templateType, from string, to []string, data interface{}) error {
- subject, body, err := b.Templates.Execute(templateType, EmailKindText, data)
- if err != nil {
- return errors.Wrap(err, "executing template")
- }
-
- log.WithFields(log.Fields{
- "subject": subject,
- "to": to,
- "from": from,
- "body": body,
- }).Info("Email (not sent, using StdoutBackend)")
- return nil
-}
diff --git a/pkg/server/mailer/backend_test.go b/pkg/server/mailer/backend_test.go
deleted file mode 100644
index 2388c16b..00000000
--- a/pkg/server/mailer/backend_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package mailer
-
-import (
- "testing"
-
- "gopkg.in/gomail.v2"
-)
-
-type mockDialer struct {
- sentMessages []*gomail.Message
- err error
-}
-
-func (m *mockDialer) DialAndSend(msgs ...*gomail.Message) error {
- m.sentMessages = append(m.sentMessages, msgs...)
- return m.err
-}
-
-func TestDefaultBackendSendEmail(t *testing.T) {
- t.Run("sends email", func(t *testing.T) {
- mock := &mockDialer{}
- backend := &DefaultBackend{
- Dialer: mock,
- Templates: NewTemplates(),
- }
-
- data := WelcomeTmplData{
- AccountEmail: "bob@example.com",
- BaseURL: "https://example.com",
- }
-
- err := backend.SendEmail(EmailTypeWelcome, "alice@example.com", []string{"bob@example.com"}, data)
- if err != nil {
- t.Fatalf("SendEmail failed: %v", err)
- }
-
- if len(mock.sentMessages) != 1 {
- t.Errorf("expected 1 message sent, got %d", len(mock.sentMessages))
- }
- })
-}
-
-func TestNewDefaultBackend(t *testing.T) {
- t.Run("with all env vars set", func(t *testing.T) {
- t.Setenv("SmtpHost", "smtp.example.com")
- t.Setenv("SmtpPort", "587")
- t.Setenv("SmtpUsername", "user@example.com")
- t.Setenv("SmtpPassword", "secret")
-
- backend, err := NewDefaultBackend()
- if err != nil {
- t.Fatalf("NewDefaultBackend failed: %v", err)
- }
-
- if backend.Dialer == nil {
- t.Error("expected Dialer to be set")
- }
- })
-
- t.Run("missing SMTP config returns error", func(t *testing.T) {
- t.Setenv("SmtpHost", "")
- t.Setenv("SmtpPort", "")
- t.Setenv("SmtpUsername", "")
- t.Setenv("SmtpPassword", "")
-
- _, err := NewDefaultBackend()
- if err == nil {
- t.Error("expected error when SMTP not configured")
- }
- if err != ErrSMTPNotConfigured {
- t.Errorf("expected ErrSMTPNotConfigured, got %v", err)
- }
- })
-}
-
-func TestStdoutBackendSendEmail(t *testing.T) {
- t.Run("logs email without sending", func(t *testing.T) {
- backend := NewStdoutBackend()
-
- data := WelcomeTmplData{
- AccountEmail: "bob@example.com",
- BaseURL: "https://example.com",
- }
-
- err := backend.SendEmail(EmailTypeWelcome, "alice@example.com", []string{"bob@example.com"}, data)
- if err != nil {
- t.Fatalf("SendEmail failed: %v", err)
- }
-
- // StdoutBackend should never return an error, just log
- })
-}
diff --git a/pkg/server/mailer/mailer.go b/pkg/server/mailer/mailer.go
index 18887cf5..60a95bac 100644
--- a/pkg/server/mailer/mailer.go
+++ b/pkg/server/mailer/mailer.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
// Package mailer provides a functionality to send emails
@@ -19,10 +22,12 @@ package mailer
import (
"bytes"
"fmt"
+ htemplate "html/template"
"io"
ttemplate "text/template"
- "github.com/dnote/dnote/pkg/server/mailer/templates"
+ "github.com/aymerick/douceur/inliner"
+ "github.com/gobuffalo/packr/v2"
"github.com/pkg/errors"
)
@@ -31,28 +36,30 @@ var (
EmailTypeResetPassword = "reset_password"
// EmailTypeResetPasswordAlert represents a password change notification email
EmailTypeResetPasswordAlert = "reset_password_alert"
+ // EmailTypeEmailVerification represents an email verification email
+ EmailTypeEmailVerification = "verify_email"
// EmailTypeWelcome represents an welcome email
EmailTypeWelcome = "welcome"
+ // EmailTypeInactiveReminder represents an inactivity reminder email
+ EmailTypeInactiveReminder = "inactive"
+ // EmailTypeSubscriptionConfirmation represents an inactivity reminder email
+ EmailTypeSubscriptionConfirmation = "subscription_confirmation"
)
var (
+ // EmailKindHTML is the type of html email
+ EmailKindHTML = "text/html"
// EmailKindText is the type of text email
EmailKindText = "text/plain"
)
-// tmpl is the common interface shared between Template from
+// template is the common interface shared between Template from
// html/template and text/template
-type tmpl interface {
+type template interface {
Execute(wr io.Writer, data interface{}) error
}
-// template wraps a template with its subject line
-type template struct {
- tmpl tmpl
- subject string
-}
-
-// Templates holds the parsed email templates with their subjects
+// Templates holds the parsed email templates
type Templates map[string]template
func getTemplateKey(name, kind string) string {
@@ -62,72 +69,134 @@ func getTemplateKey(name, kind string) string {
func (tmpl Templates) get(name, kind string) (template, error) {
key := getTemplateKey(name, kind)
t := tmpl[key]
- if t.tmpl == nil {
- return template{}, errors.Errorf("unsupported template '%s' with type '%s'", name, kind)
+ if t == nil {
+ return nil, errors.Errorf("unsupported template '%s' with type '%s'", name, kind)
}
return t, nil
}
-func (tmpl Templates) set(name, kind string, t tmpl, subject string) {
+func (tmpl Templates) set(name, kind string, t template) {
key := getTemplateKey(name, kind)
- tmpl[key] = template{
- tmpl: t,
- subject: subject,
- }
+ tmpl[key] = t
}
// NewTemplates initializes templates
-func NewTemplates() Templates {
- welcomeText, err := initTextTmpl(EmailTypeWelcome)
+func NewTemplates(srcDir *string) Templates {
+ var box *packr.Box
+
+ if srcDir != nil {
+ box = packr.Folder(*srcDir)
+ } else {
+ box = packr.New("emailTemplates", "./templates/src")
+ }
+
+ welcomeText, err := initTextTmpl(box, EmailTypeWelcome)
if err != nil {
panic(errors.Wrap(err, "initializing welcome template"))
}
- passwordResetText, err := initTextTmpl(EmailTypeResetPassword)
+ verifyEmailText, err := initTextTmpl(box, EmailTypeEmailVerification)
+ if err != nil {
+ panic(errors.Wrap(err, "initializing email verification template"))
+ }
+ passwordResetText, err := initTextTmpl(box, EmailTypeResetPassword)
if err != nil {
panic(errors.Wrap(err, "initializing password reset template"))
}
- passwordResetAlertText, err := initTextTmpl(EmailTypeResetPasswordAlert)
+ passwordResetAlertText, err := initTextTmpl(box, EmailTypeResetPasswordAlert)
+ if err != nil {
+ panic(errors.Wrap(err, "initializing password reset template"))
+ }
+ inactiveReminderText, err := initTextTmpl(box, EmailTypeInactiveReminder)
+ if err != nil {
+ panic(errors.Wrap(err, "initializing password reset template"))
+ }
+ subscriptionConfirmationText, err := initTextTmpl(box, EmailTypeSubscriptionConfirmation)
if err != nil {
panic(errors.Wrap(err, "initializing password reset template"))
}
T := Templates{}
- T.set(EmailTypeResetPassword, EmailKindText, passwordResetText, "Reset your Dnote password")
- T.set(EmailTypeResetPasswordAlert, EmailKindText, passwordResetAlertText, "Your Dnote password was changed")
- T.set(EmailTypeWelcome, EmailKindText, welcomeText, "Welcome to Dnote!")
+ T.set(EmailTypeResetPassword, EmailKindText, passwordResetText)
+ T.set(EmailTypeResetPasswordAlert, EmailKindText, passwordResetAlertText)
+ T.set(EmailTypeEmailVerification, EmailKindText, verifyEmailText)
+ T.set(EmailTypeWelcome, EmailKindText, welcomeText)
+ T.set(EmailTypeInactiveReminder, EmailKindText, inactiveReminderText)
+ T.set(EmailTypeSubscriptionConfirmation, EmailKindText, subscriptionConfirmationText)
return T
}
-// initTextTmpl returns a template instance by parsing the template with the given name
-func initTextTmpl(templateName string) (tmpl, error) {
- filename := fmt.Sprintf("%s.txt", templateName)
+// initHTMLTmpl returns a template instance by parsing the template with the
+// given name along with partials
+func initHTMLTmpl(box *packr.Box, templateName string) (template, error) {
+ filename := fmt.Sprintf("%s.html", templateName)
- content, err := templates.Files.ReadFile(filename)
+ content, err := box.FindString(filename)
if err != nil {
return nil, errors.Wrap(err, "reading template")
}
+ headerContent, err := box.FindString("header.html")
+ if err != nil {
+ return nil, errors.Wrap(err, "reading header template")
+ }
+ footerContent, err := box.FindString("footer.html")
+ if err != nil {
+ return nil, errors.Wrap(err, "reading footer template")
+ }
- t := ttemplate.New(templateName)
- if _, err = t.Parse(string(content)); err != nil {
+ t := htemplate.New(templateName)
+ if _, err = t.Parse(content); err != nil {
+ return nil, errors.Wrap(err, "parsing template")
+ }
+ if _, err = t.Parse(headerContent); err != nil {
+ return nil, errors.Wrap(err, "parsing template")
+ }
+ if _, err = t.Parse(footerContent); err != nil {
return nil, errors.Wrap(err, "parsing template")
}
return t, nil
}
-// Execute executes the template and returns the subject, body, and any error
-func (tmpl Templates) Execute(name, kind string, data any) (subject, body string, err error) {
+// initTextTmpl returns a template instance by parsing the template with the given name
+func initTextTmpl(box *packr.Box, templateName string) (template, error) {
+ filename := fmt.Sprintf("%s.txt", templateName)
+
+ content, err := box.FindString(filename)
+ if err != nil {
+ return nil, errors.Wrap(err, "reading template")
+ }
+
+ t := ttemplate.New(templateName)
+ if _, err = t.Parse(content); err != nil {
+ return nil, errors.Wrap(err, "parsing template")
+ }
+
+ return t, nil
+}
+
+// Execute executes the template with the given name with the givn data
+func (tmpl Templates) Execute(name, kind string, data interface{}) (string, error) {
t, err := tmpl.get(name, kind)
if err != nil {
- return "", "", errors.Wrap(err, "getting template")
+ return "", errors.Wrap(err, "getting template")
}
buf := new(bytes.Buffer)
- if err := t.tmpl.Execute(buf, data); err != nil {
- return "", "", errors.Wrap(err, "executing the template")
+ if err := t.Execute(buf, data); err != nil {
+ return "", errors.Wrap(err, "executing the template")
}
- return t.subject, buf.String(), nil
+ // If HTML email, inline the CSS rules
+ if kind == EmailKindHTML {
+ html, err := inliner.Inline(buf.String())
+ if err != nil {
+ return "", errors.Wrap(err, "inlining the css rules")
+ }
+
+ return html, nil
+ }
+
+ return buf.String(), nil
}
diff --git a/pkg/server/mailer/mailer_test.go b/pkg/server/mailer/mailer_test.go
index 71b48209..79d5d29c 100644
--- a/pkg/server/mailer/mailer_test.go
+++ b/pkg/server/mailer/mailer_test.go
@@ -1,80 +1,63 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package mailer
import (
"fmt"
+ "os"
"strings"
"testing"
"github.com/pkg/errors"
)
-func TestAllTemplatesInitialized(t *testing.T) {
- tmpl := NewTemplates()
-
- emailTypes := []string{
- EmailTypeResetPassword,
- EmailTypeResetPasswordAlert,
- EmailTypeWelcome,
- }
-
- for _, emailType := range emailTypes {
- t.Run(emailType, func(t *testing.T) {
- _, err := tmpl.get(emailType, EmailKindText)
- if err != nil {
- t.Errorf("template %s not initialized: %v", emailType, err)
- }
- })
- }
-}
-
-func TestResetPasswordEmail(t *testing.T) {
+func TestEmailVerificationEmail(t *testing.T) {
testCases := []struct {
- token string
- baseURL string
+ token string
+ webURL string
}{
{
- token: "someRandomToken1",
- baseURL: "http://localhost:3000",
+ token: "someRandomToken1",
+ webURL: "http://localhost:3000",
},
{
- token: "someRandomToken2",
- baseURL: "http://localhost:3001",
+ token: "someRandomToken2",
+ webURL: "http://localhost:3001",
},
}
- tmpl := NewTemplates()
+ tmplPath := os.Getenv("DNOTE_TEST_EMAIL_TEMPLATE_DIR")
+ tmpl := NewTemplates(&tmplPath)
for _, tc := range testCases {
- t.Run(fmt.Sprintf("with BaseURL %s", tc.baseURL), func(t *testing.T) {
- dat := EmailResetPasswordTmplData{
- Token: tc.token,
- BaseURL: tc.baseURL,
+ t.Run(fmt.Sprintf("with WebURL %s", tc.webURL), func(t *testing.T) {
+ dat := EmailVerificationTmplData{
+ Token: tc.token,
+ WebURL: tc.webURL,
}
- subject, body, err := tmpl.Execute(EmailTypeResetPassword, EmailKindText, dat)
+ body, err := tmpl.Execute(EmailTypeEmailVerification, EmailKindText, dat)
if err != nil {
t.Fatal(errors.Wrap(err, "executing"))
}
- if subject != "Reset your Dnote password" {
- t.Errorf("expected subject 'Reset your Dnote password', got '%s'", subject)
- }
- if ok := strings.Contains(body, tc.baseURL); !ok {
- t.Errorf("email body did not contain %s", tc.baseURL)
+ if ok := strings.Contains(body, tc.webURL); !ok {
+ t.Errorf("email body did not contain %s", tc.webURL)
}
if ok := strings.Contains(body, tc.token); !ok {
t.Errorf("email body did not contain %s", tc.token)
@@ -83,83 +66,40 @@ func TestResetPasswordEmail(t *testing.T) {
}
}
-func TestWelcomeEmail(t *testing.T) {
+func TestResetPasswordEmail(t *testing.T) {
testCases := []struct {
- accountEmail string
- baseURL string
+ token string
+ webURL string
}{
{
- accountEmail: "test@example.com",
- baseURL: "http://localhost:3000",
+ token: "someRandomToken1",
+ webURL: "http://localhost:3000",
},
{
- accountEmail: "user@example.org",
- baseURL: "http://localhost:3001",
+ token: "someRandomToken2",
+ webURL: "http://localhost:3001",
},
}
- tmpl := NewTemplates()
+ tmplPath := os.Getenv("DNOTE_TEST_EMAIL_TEMPLATE_DIR")
+ tmpl := NewTemplates(&tmplPath)
for _, tc := range testCases {
- t.Run(fmt.Sprintf("with BaseURL %s and email %s", tc.baseURL, tc.accountEmail), func(t *testing.T) {
- dat := WelcomeTmplData{
- AccountEmail: tc.accountEmail,
- BaseURL: tc.baseURL,
+ t.Run(fmt.Sprintf("with WebURL %s", tc.webURL), func(t *testing.T) {
+ dat := EmailResetPasswordTmplData{
+ Token: tc.token,
+ WebURL: tc.webURL,
}
- subject, body, err := tmpl.Execute(EmailTypeWelcome, EmailKindText, dat)
+ body, err := tmpl.Execute(EmailTypeResetPassword, EmailKindText, dat)
if err != nil {
t.Fatal(errors.Wrap(err, "executing"))
}
- if subject != "Welcome to Dnote!" {
- t.Errorf("expected subject 'Welcome to Dnote!', got '%s'", subject)
+ if ok := strings.Contains(body, tc.webURL); !ok {
+ t.Errorf("email body did not contain %s", tc.webURL)
}
- if ok := strings.Contains(body, tc.baseURL); !ok {
- t.Errorf("email body did not contain %s", tc.baseURL)
- }
- if ok := strings.Contains(body, tc.accountEmail); !ok {
- t.Errorf("email body did not contain %s", tc.accountEmail)
- }
- })
- }
-}
-
-func TestResetPasswordAlertEmail(t *testing.T) {
- testCases := []struct {
- accountEmail string
- baseURL string
- }{
- {
- accountEmail: "test@example.com",
- baseURL: "http://localhost:3000",
- },
- {
- accountEmail: "user@example.org",
- baseURL: "http://localhost:3001",
- },
- }
-
- tmpl := NewTemplates()
-
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("with BaseURL %s and email %s", tc.baseURL, tc.accountEmail), func(t *testing.T) {
- dat := EmailResetPasswordAlertTmplData{
- AccountEmail: tc.accountEmail,
- BaseURL: tc.baseURL,
- }
- subject, body, err := tmpl.Execute(EmailTypeResetPasswordAlert, EmailKindText, dat)
- if err != nil {
- t.Fatal(errors.Wrap(err, "executing"))
- }
-
- if subject != "Your Dnote password was changed" {
- t.Errorf("expected subject 'Your Dnote password was changed', got '%s'", subject)
- }
- if ok := strings.Contains(body, tc.baseURL); !ok {
- t.Errorf("email body did not contain %s", tc.baseURL)
- }
- if ok := strings.Contains(body, tc.accountEmail); !ok {
- t.Errorf("email body did not contain %s", tc.accountEmail)
+ if ok := strings.Contains(body, tc.token); !ok {
+ t.Errorf("email body did not contain %s", tc.token)
}
})
}
diff --git a/pkg/server/mailer/templates/.env.dev b/pkg/server/mailer/templates/.env.dev
new file mode 100644
index 00000000..7808cb4a
--- /dev/null
+++ b/pkg/server/mailer/templates/.env.dev
@@ -0,0 +1,12 @@
+DBHost=localhost
+DBPort=5433
+DBName=dnote
+DBUser=postgres
+DBPassword=
+
+SmtpUsername=mock-SmtpUsername
+SmtpPassword=mock-SmtpPassword
+SmtpHost=mock-SmtpHost
+
+WebURL=http://localhost:3000
+DisableRegistration=false
diff --git a/pkg/server/mailer/templates/.gitignore b/pkg/server/mailer/templates/.gitignore
new file mode 100644
index 00000000..f8a26871
--- /dev/null
+++ b/pkg/server/mailer/templates/.gitignore
@@ -0,0 +1 @@
+templates
diff --git a/pkg/server/mailer/templates/README.md b/pkg/server/mailer/templates/README.md
new file mode 100644
index 00000000..9329442a
--- /dev/null
+++ b/pkg/server/mailer/templates/README.md
@@ -0,0 +1,13 @@
+# templates
+
+Email templates
+
+* `/src` contains templates.
+
+## Development
+
+Run the server to develop templates locally.
+
+```
+./dev.sh
+```
diff --git a/pkg/server/mailer/templates/dev.sh b/pkg/server/mailer/templates/dev.sh
new file mode 100755
index 00000000..035220b1
--- /dev/null
+++ b/pkg/server/mailer/templates/dev.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+set -eux
+
+PID=""
+
+function cleanup {
+ if [ "$PID" != "" ]; then
+ kill "$PID"
+ fi
+}
+trap cleanup EXIT
+
+while true; do
+ go build main.go
+ ./main &
+ PID=$!
+ inotifywait -r -e modify .
+ kill $PID
+done
+
+
diff --git a/pkg/server/mailer/templates/main.go b/pkg/server/mailer/templates/main.go
new file mode 100644
index 00000000..5d3d055e
--- /dev/null
+++ b/pkg/server/mailer/templates/main.go
@@ -0,0 +1,139 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package main
+
+import (
+ "log"
+ "net/http"
+
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/mailer"
+ "github.com/jinzhu/gorm"
+ "github.com/joho/godotenv"
+ _ "github.com/lib/pq"
+)
+
+func (c Context) passwordResetHandler(w http.ResponseWriter, r *http.Request) {
+ data := mailer.EmailResetPasswordTmplData{
+ AccountEmail: "alice@example.com",
+ Token: "testToken",
+ WebURL: "http://localhost:3000",
+ }
+ body, err := c.Tmpl.Execute(mailer.EmailTypeResetPassword, mailer.EmailKindText, data)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.Write([]byte(body))
+}
+
+func (c Context) passwordResetAlertHandler(w http.ResponseWriter, r *http.Request) {
+ data := mailer.EmailResetPasswordAlertTmplData{
+ AccountEmail: "alice@example.com",
+ WebURL: "http://localhost:3000",
+ }
+ body, err := c.Tmpl.Execute(mailer.EmailTypeResetPasswordAlert, mailer.EmailKindText, data)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.Write([]byte(body))
+}
+
+func (c Context) emailVerificationHandler(w http.ResponseWriter, r *http.Request) {
+ data := mailer.EmailVerificationTmplData{
+ Token: "testToken",
+ WebURL: "http://localhost:3000",
+ }
+ body, err := c.Tmpl.Execute(mailer.EmailTypeEmailVerification, mailer.EmailKindText, data)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.Write([]byte(body))
+}
+
+func (c Context) welcomeHandler(w http.ResponseWriter, r *http.Request) {
+ data := mailer.WelcomeTmplData{
+ AccountEmail: "alice@example.com",
+ WebURL: "http://localhost:3000",
+ }
+ body, err := c.Tmpl.Execute(mailer.EmailTypeWelcome, mailer.EmailKindText, data)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.Write([]byte(body))
+}
+
+func (c Context) inactiveHandler(w http.ResponseWriter, r *http.Request) {
+ data := mailer.InactiveReminderTmplData{
+ SampleNoteUUID: "some-uuid",
+ WebURL: "http://localhost:3000",
+ Token: "some-random-token",
+ }
+ body, err := c.Tmpl.Execute(mailer.EmailTypeInactiveReminder, mailer.EmailKindText, data)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.Write([]byte(body))
+}
+
+func (c Context) homeHandler(w http.ResponseWriter, r *http.Request) {
+ w.Write([]byte("Email development server is running."))
+}
+
+func init() {
+ err := godotenv.Load(".env.dev")
+ if err != nil {
+ panic(err)
+ }
+}
+
+// Context is a context holding global information
+type Context struct {
+ DB *gorm.DB
+ Tmpl mailer.Templates
+}
+
+func main() {
+ c := config.Load()
+ db := database.Open(c)
+ defer db.Close()
+
+ log.Println("Email template development server running on http://127.0.0.1:2300")
+
+ tmpl := mailer.NewTemplates(nil)
+ ctx := Context{DB: db, Tmpl: tmpl}
+
+ http.HandleFunc("/", ctx.homeHandler)
+ http.HandleFunc("/email-verification", ctx.emailVerificationHandler)
+ http.HandleFunc("/password-reset", ctx.passwordResetHandler)
+ http.HandleFunc("/password-reset-alert", ctx.passwordResetAlertHandler)
+ http.HandleFunc("/welcome", ctx.welcomeHandler)
+ http.HandleFunc("/inactive-reminder", ctx.inactiveHandler)
+ log.Fatal(http.ListenAndServe(":2300", nil))
+}
diff --git a/pkg/server/mailer/templates/reset_password.txt b/pkg/server/mailer/templates/reset_password.txt
deleted file mode 100644
index 9d31d605..00000000
--- a/pkg/server/mailer/templates/reset_password.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-You are receiving this because you requested to reset the password of the '{{ .AccountEmail }}' Dnote account.
-
-Please click on the following link, or paste this into your browser to complete the process:
-
- {{ .BaseURL }}/password-reset/{{ .Token }}
diff --git a/pkg/server/mailer/templates/reset_password_alert.txt b/pkg/server/mailer/templates/reset_password_alert.txt
deleted file mode 100644
index ea67dce3..00000000
--- a/pkg/server/mailer/templates/reset_password_alert.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Hi,
-
-This email is to notify you that the password for your Dnote account "{{ .AccountEmail }}" has changed.
-
-If you did not initiate this password change, reset your password at {{ .BaseURL }}/password-reset.
-
-Thanks.
-
-- Dnote team
diff --git a/pkg/server/mailer/templates/scripts/run.sh b/pkg/server/mailer/templates/scripts/run.sh
new file mode 100755
index 00000000..fd8e8ac5
--- /dev/null
+++ b/pkg/server/mailer/templates/scripts/run.sh
@@ -0,0 +1 @@
+CompileDaemon -directory=. -command="./templates" -include="*.html"
diff --git a/pkg/server/mailer/templates/src/inactive.txt b/pkg/server/mailer/templates/src/inactive.txt
new file mode 100644
index 00000000..b6f4d508
--- /dev/null
+++ b/pkg/server/mailer/templates/src/inactive.txt
@@ -0,0 +1,9 @@
+Hi, nothing has been added to your Dnote for some time.
+
+What about revisiting one of your previous notes? {{ .WebURL }}/notes/{{ .SampleNoteUUID }}
+
+You can add new notes at {{ .WebURL }}/new or using Dnote apps.
+
+- Dnote team
+
+UNSUBSCRIBE: {{ .WebURL }}/settings/notifications?token={{ .Token }}
diff --git a/pkg/server/mailer/templates/src/reset_password.txt b/pkg/server/mailer/templates/src/reset_password.txt
new file mode 100644
index 00000000..a66c0ba8
--- /dev/null
+++ b/pkg/server/mailer/templates/src/reset_password.txt
@@ -0,0 +1,9 @@
+You are receiving this because you (or someone else) requested to reset the password of the '{{ .AccountEmail }}' Dnote account.
+
+Please click on the following link, or paste this into your browser to complete the process:
+
+ {{ .WebURL }}/password-reset/{{ .Token }}
+
+You can reply to this message, if you have questions.
+
+- Sung (Maker of Dnote)
diff --git a/pkg/server/mailer/templates/src/reset_password_alert.txt b/pkg/server/mailer/templates/src/reset_password_alert.txt
new file mode 100644
index 00000000..f1d7389b
--- /dev/null
+++ b/pkg/server/mailer/templates/src/reset_password_alert.txt
@@ -0,0 +1,9 @@
+Hi,
+
+This email is to notify you that the password for your Dnote account "{{ .AccountEmail }}" has changed.
+
+If you did not initiate this password change, please notify us by replying, and reset your password at {{ .WebURL }}/password-reset
+
+Thanks.
+
+- Sung (Maker of Dnote)
diff --git a/pkg/server/mailer/templates/src/subscription_confirmation.txt b/pkg/server/mailer/templates/src/subscription_confirmation.txt
new file mode 100644
index 00000000..03e98a66
--- /dev/null
+++ b/pkg/server/mailer/templates/src/subscription_confirmation.txt
@@ -0,0 +1,12 @@
+Hi, thanks for signing up for Dnote Pro.
+
+Now you can take your notes with you wherever you go!
+
+* Synchronize data among an unlimited number of machines.
+* Access notes anywhere via the web interface.
+
+Your account is "{{ .AccountEmail }}". Log in at {{ .WebURL }}/login
+
+Thank you for using Dnote. Your support makes it possible to develop it for developers around the world.
+
+- Sung (Maker of Dnote)
diff --git a/pkg/server/mailer/templates/src/verify_email.txt b/pkg/server/mailer/templates/src/verify_email.txt
new file mode 100644
index 00000000..8e40bf89
--- /dev/null
+++ b/pkg/server/mailer/templates/src/verify_email.txt
@@ -0,0 +1,9 @@
+Hi.
+
+Welcome to Dnote! To verify your email so that you can automate spaced reptition, visit the following link:
+
+ {{ .WebURL }}/verify-email/{{ .Token }}
+
+Thanks for using my software.
+
+- Sung (Maker of Dnote)
diff --git a/pkg/server/mailer/templates/src/welcome.txt b/pkg/server/mailer/templates/src/welcome.txt
new file mode 100644
index 00000000..daba304a
--- /dev/null
+++ b/pkg/server/mailer/templates/src/welcome.txt
@@ -0,0 +1,16 @@
+Hi, welcome to Dnote.
+
+Dnote is a simple command-line notebook.
+
+YOUR ACCOUNT
+
+Your {{ .WebURL }} account is "{{ .AccountEmail }}". Log in at {{ .WebURL }}/login
+If you ever forget your password, you can reset it at {{ .WebURL }}/password-reset
+
+SOURCE CODE
+
+Dnote is open source and you can see the source code at https://github.com/dnote/dnote
+
+Feel free to reply anytime. Thanks for using Dnote.
+
+- Sung (Maker of Dnote)
diff --git a/pkg/server/mailer/templates/templates.go b/pkg/server/mailer/templates/templates.go
deleted file mode 100644
index 78fedd07..00000000
--- a/pkg/server/mailer/templates/templates.go
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Package mailer provides a functionality to send emails
-package templates
-
-import "embed"
-
-//go:embed *.txt
-var Files embed.FS
diff --git a/pkg/server/mailer/templates/welcome.txt b/pkg/server/mailer/templates/welcome.txt
deleted file mode 100644
index cced536c..00000000
--- a/pkg/server/mailer/templates/welcome.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Hi, welcome to Dnote.
-
-Dnote is a simple command-line notebook.
-
-YOUR ACCOUNT
-
-Your {{ .BaseURL }} account is "{{ .AccountEmail }}". Log in at {{ .BaseURL }}/login
-If you ever forget your password, you can reset it at {{ .BaseURL }}/password-reset
-
-SOURCE CODE
-
-Dnote is open source and you can see the source code at https://github.com/dnote/dnote
diff --git a/pkg/server/mailer/tokens.go b/pkg/server/mailer/tokens.go
index 669c4820..a2ae431c 100644
--- a/pkg/server/mailer/tokens.go
+++ b/pkg/server/mailer/tokens.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package mailer
@@ -20,14 +23,15 @@ import (
"encoding/base64"
"github.com/dnote/dnote/pkg/server/database"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
- "gorm.io/gorm"
)
func generateRandomToken(bits int) (string, error) {
b := make([]byte, bits)
- if _, err := rand.Read(b); err != nil {
+ _, err := rand.Read(b)
+ if err != nil {
return "", errors.Wrap(err, "generating random bytes")
}
@@ -38,16 +42,16 @@ func generateRandomToken(bits int) (string, error) {
// by first looking up any unused record and creating one if none exists.
func GetToken(db *gorm.DB, userID int, kind string) (database.Token, error) {
var tok database.Token
- err := db.
+ conn := db.
Where("user_id = ? AND type =? AND used_at IS NULL", userID, kind).
- First(&tok).Error
+ First(&tok)
- tokenVal, genErr := generateRandomToken(16)
- if genErr != nil {
- return tok, errors.Wrap(genErr, "generating token value")
+ tokenVal, err := generateRandomToken(16)
+ if err != nil {
+ return tok, errors.Wrap(err, "generating token value")
}
- if errors.Is(err, gorm.ErrRecordNotFound) {
+ if conn.RecordNotFound() {
tok = database.Token{
UserID: userID,
Type: kind,
@@ -58,7 +62,7 @@ func GetToken(db *gorm.DB, userID int, kind string) (database.Token, error) {
}
return tok, nil
- } else if err != nil {
+ } else if err := conn.Error; err != nil {
return tok, errors.Wrap(err, "finding token")
}
diff --git a/pkg/server/mailer/tokens_test.go b/pkg/server/mailer/tokens_test.go
deleted file mode 100644
index 4f4fa73d..00000000
--- a/pkg/server/mailer/tokens_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package mailer
-
-import (
- "testing"
-
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/testutils"
-)
-
-func TestGetToken(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- userID := 1
- tokenType := "email_verification"
-
- t.Run("creates new token", func(t *testing.T) {
- token, err := GetToken(db, userID, tokenType)
- if err != nil {
- t.Fatalf("GetToken failed: %v", err)
- }
-
- if token.UserID != userID {
- t.Errorf("expected UserID %d, got %d", userID, token.UserID)
- }
- if token.Type != tokenType {
- t.Errorf("expected Type %s, got %s", tokenType, token.Type)
- }
- if token.Value == "" {
- t.Error("expected non-empty token Value")
- }
- if token.UsedAt != nil {
- t.Error("expected UsedAt to be nil for new token")
- }
- })
-
- t.Run("reuses unused token", func(t *testing.T) {
- // Get token again - should return the same one
- token2, err := GetToken(db, userID, tokenType)
- if err != nil {
- t.Fatalf("second GetToken failed: %v", err)
- }
-
- // Get first token to compare
- var token1 database.Token
- if err := db.Where("user_id = ? AND type = ?", userID, tokenType).First(&token1).Error; err != nil {
- t.Fatalf("failed to get first token: %v", err)
- }
-
- if token1.ID != token2.ID {
- t.Errorf("expected same token ID %d, got %d", token1.ID, token2.ID)
- }
- if token1.Value != token2.Value {
- t.Errorf("expected same token Value %s, got %s", token1.Value, token2.Value)
- }
-
- // Verify only one token exists in database
- var count int64
- if err := db.Model(&database.Token{}).Where("user_id = ? AND type = ?", userID, tokenType).Count(&count).Error; err != nil {
- t.Fatalf("failed to count tokens: %v", err)
- }
- if count != 1 {
- t.Errorf("expected 1 token in database, got %d", count)
- }
- })
-}
diff --git a/pkg/server/mailer/types.go b/pkg/server/mailer/types.go
index 40468b84..5306fed6 100644
--- a/pkg/server/mailer/types.go
+++ b/pkg/server/mailer/types.go
@@ -1,35 +1,57 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package mailer
+// EmailVerificationTmplData is a template data for email verification emails
+type EmailVerificationTmplData struct {
+ Token string
+ WebURL string
+}
+
// EmailResetPasswordTmplData is a template data for reset password emails
type EmailResetPasswordTmplData struct {
AccountEmail string
Token string
- BaseURL string
+ WebURL string
}
// EmailResetPasswordAlertTmplData is a template data for reset password emails
type EmailResetPasswordAlertTmplData struct {
AccountEmail string
- BaseURL string
+ WebURL string
}
// WelcomeTmplData is a template data for welcome emails
type WelcomeTmplData struct {
AccountEmail string
- BaseURL string
+ WebURL string
+}
+
+// InactiveReminderTmplData is a template data for welcome emails
+type InactiveReminderTmplData struct {
+ SampleNoteUUID string
+ WebURL string
+ Token string
+}
+
+// EmailTypeSubscriptionConfirmationTmplData is a template data for reset password emails
+type EmailTypeSubscriptionConfirmationTmplData struct {
+ AccountEmail string
+ WebURL string
}
diff --git a/pkg/server/main.go b/pkg/server/main.go
index 737cc7a6..a3108760 100644
--- a/pkg/server/main.go
+++ b/pkg/server/main.go
@@ -1,24 +1,179 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package main
import (
- "github.com/dnote/dnote/pkg/server/cmd"
+ "flag"
+ "fmt"
+ "log"
+ "net/http"
+
+ "github.com/dnote/dnote/pkg/clock"
+ "github.com/dnote/dnote/pkg/server/api"
+ "github.com/dnote/dnote/pkg/server/app"
+ "github.com/dnote/dnote/pkg/server/config"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/job"
+ "github.com/dnote/dnote/pkg/server/mailer"
+ "github.com/dnote/dnote/pkg/server/web"
+ "github.com/jinzhu/gorm"
+
+ "github.com/gobuffalo/packr/v2"
+ "github.com/pkg/errors"
)
-func main() {
- cmd.Execute()
+var versionTag = "master"
+var port = flag.String("port", "3000", "port to connect to")
+var rootBox *packr.Box
+
+func init() {
+ rootBox = packr.New("root", "../../web/public")
+}
+
+func mustFind(box *packr.Box, path string) []byte {
+ b, err := rootBox.Find(path)
+ if err != nil {
+ panic(errors.Wrapf(err, "getting file content for %s", path))
+ }
+
+ return b
+}
+
+func initWebContext(db *gorm.DB) web.Context {
+ staticBox := packr.New("static", "../../web/public/static")
+
+ return web.Context{
+ DB: db,
+ IndexHTML: mustFind(rootBox, "index.html"),
+ RobotsTxt: mustFind(rootBox, "robots.txt"),
+ ServiceWorkerJs: mustFind(rootBox, "service-worker.js"),
+ StaticFileSystem: staticBox,
+ }
+}
+
+func initServer(a app.App) (*http.ServeMux, error) {
+ apiRouter, err := api.NewRouter(&api.API{App: &a})
+ if err != nil {
+ return nil, errors.Wrap(err, "initializing router")
+ }
+
+ webCtx := initWebContext(a.DB)
+ webHandlers, err := web.Init(webCtx)
+ if err != nil {
+ return nil, errors.Wrap(err, "initializing web handlers")
+ }
+
+ mux := http.NewServeMux()
+ mux.Handle("/api/", http.StripPrefix("/api", apiRouter))
+ mux.Handle("/static/", webHandlers.GetStatic)
+ mux.HandleFunc("/service-worker.js", webHandlers.GetServiceWorker)
+ mux.HandleFunc("/robots.txt", webHandlers.GetRobots)
+ mux.HandleFunc("/", webHandlers.GetRoot)
+
+ return mux, nil
+}
+
+func initDB(c config.Config) *gorm.DB {
+ db, err := gorm.Open("postgres", c.DB.GetConnectionStr())
+ if err != nil {
+ panic(errors.Wrap(err, "opening database connection"))
+ }
+ database.InitSchema(db)
+
+ return db
+}
+
+func initApp(c config.Config) app.App {
+ db := initDB(c)
+
+ return app.App{
+ DB: db,
+ Clock: clock.New(),
+ EmailTemplates: mailer.NewTemplates(nil),
+ EmailBackend: &mailer.SimpleBackendImplementation{},
+ Config: c,
+ }
+}
+
+func runJob(a app.App) error {
+ runner, err := job.NewRunner(a.DB, a.Clock, a.EmailTemplates, a.EmailBackend, a.Config)
+ if err != nil {
+ return errors.Wrap(err, "getting a job runner")
+ }
+ if err := runner.Do(); err != nil {
+ return errors.Wrap(err, "running job")
+ }
+
+ return nil
+}
+
+func startCmd() {
+ c := config.Load()
+
+ app := initApp(c)
+ defer app.DB.Close()
+
+ if err := database.Migrate(app.DB); err != nil {
+ panic(errors.Wrap(err, "running migrations"))
+ }
+
+ if err := runJob(app); err != nil {
+ panic(errors.Wrap(err, "running job"))
+ }
+
+ srv, err := initServer(app)
+ if err != nil {
+ panic(errors.Wrap(err, "initializing server"))
+ }
+
+ log.Printf("Dnote version %s is running on port %s", versionTag, *port)
+ log.Fatalln(http.ListenAndServe(":"+*port, srv))
+}
+
+func versionCmd() {
+ fmt.Printf("dnote-server-%s\n", versionTag)
+}
+
+func rootCmd() {
+ fmt.Printf(`Dnote Server - A simple personal knowledge base
+
+Usage:
+ dnote-server [command]
+
+Available commands:
+ start: Start the server
+ version: Print the version
+`)
+}
+
+func main() {
+ flag.Parse()
+ cmd := flag.Arg(0)
+
+ switch cmd {
+ case "":
+ rootCmd()
+ case "start":
+ startCmd()
+ case "version":
+ versionCmd()
+ default:
+ fmt.Printf("Unknown command %s", cmd)
+ }
}
diff --git a/pkg/server/middleware/auth.go b/pkg/server/middleware/auth.go
deleted file mode 100644
index 9383d33d..00000000
--- a/pkg/server/middleware/auth.go
+++ /dev/null
@@ -1,175 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package middleware
-
-import (
- "errors"
- "net/http"
- "net/url"
- "time"
-
- "github.com/dnote/dnote/pkg/server/context"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/helpers"
- "github.com/dnote/dnote/pkg/server/log"
- pkgErrors "github.com/pkg/errors"
- "gorm.io/gorm"
-)
-
-func authWithToken(db *gorm.DB, r *http.Request, tokenType string) (database.User, database.Token, bool, error) {
- var user database.User
- var token database.Token
-
- query := r.URL.Query()
- tokenValue := query.Get("token")
- if tokenValue == "" {
- return user, token, false, nil
- }
-
- err := db.Where("value = ? AND type = ?", tokenValue, tokenType).First(&token).Error
- if errors.Is(err, gorm.ErrRecordNotFound) {
- return user, token, false, nil
- } else if err != nil {
- return user, token, false, pkgErrors.Wrap(err, "finding token")
- }
-
- if token.UsedAt != nil && time.Since(*token.UsedAt).Minutes() > 10 {
- return user, token, false, nil
- }
-
- if err := db.Where("id = ?", token.UserID).First(&user).Error; err != nil {
- return user, token, false, pkgErrors.Wrap(err, "finding user")
- }
-
- return user, token, true, nil
-}
-
-// AuthParams is the params for the authentication middleware
-type AuthParams struct {
- RedirectGuestsToLogin bool
-}
-
-// Auth is an authentication middleware
-func Auth(db *gorm.DB, next http.HandlerFunc, p *AuthParams) http.HandlerFunc {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- user, ok, err := AuthWithSession(db, r)
- if !ok {
- if p != nil && p.RedirectGuestsToLogin {
-
- q := url.Values{}
- q.Set("referrer", r.URL.Path)
- path := helpers.GetPath("/login", &q)
-
- http.Redirect(w, r, path, http.StatusFound)
- return
- }
-
- RespondUnauthorized(w)
- return
- }
- if err != nil {
- DoError(w, "authenticating with session", err, http.StatusInternalServerError)
- return
- }
-
- ctx := context.WithUser(r.Context(), &user)
- next.ServeHTTP(w, r.WithContext(ctx))
- })
-}
-
-// TokenAuth is an authentication middleware with token
-func TokenAuth(db *gorm.DB, next http.HandlerFunc, tokenType string, p *AuthParams) http.HandlerFunc {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- user, token, ok, err := authWithToken(db, r, tokenType)
- if err != nil {
- // log the error and continue
- log.ErrorWrap(err, "authenticating with token")
- }
-
- ctx := r.Context()
-
- if ok {
- ctx = context.WithToken(ctx, &token)
- } else {
- // If token-based auth fails, fall back to session-based auth
- user, ok, err = AuthWithSession(db, r)
- if err != nil {
- DoError(w, "authenticating with session", err, http.StatusInternalServerError)
- return
- }
-
- if !ok {
- RespondUnauthorized(w)
- return
- }
- }
-
- ctx = context.WithUser(ctx, &user)
- next.ServeHTTP(w, r.WithContext(ctx))
- })
-}
-
-// AuthWithSession performs user authentication with session
-func AuthWithSession(db *gorm.DB, r *http.Request) (database.User, bool, error) {
- var user database.User
-
- sessionKey, err := GetCredential(r)
- if err != nil {
- return user, false, pkgErrors.Wrap(err, "getting credential")
- }
- if sessionKey == "" {
- return user, false, nil
- }
-
- var session database.Session
- err = db.Where("key = ?", sessionKey).First(&session).Error
-
- if errors.Is(err, gorm.ErrRecordNotFound) {
- return user, false, nil
- } else if err != nil {
- return user, false, pkgErrors.Wrap(err, "finding session")
- }
-
- if session.ExpiresAt.Before(time.Now()) {
- return user, false, nil
- }
-
- err = db.Where("id = ?", session.UserID).First(&user).Error
-
- if errors.Is(err, gorm.ErrRecordNotFound) {
- return user, false, nil
- } else if err != nil {
- return user, false, pkgErrors.Wrap(err, "finding user from token")
- }
-
- return user, true, nil
-}
-
-func GuestOnly(db *gorm.DB, next http.HandlerFunc) http.HandlerFunc {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- _, ok, err := AuthWithSession(db, r)
- if err != nil {
- // log the error and continue
- log.ErrorWrap(err, "authenticating with session")
- }
-
- if ok {
- http.Redirect(w, r, "/", http.StatusFound)
- } else {
- next.ServeHTTP(w, r)
- }
- })
-}
diff --git a/pkg/server/middleware/auth_test.go b/pkg/server/middleware/auth_test.go
deleted file mode 100644
index c6d0ead4..00000000
--- a/pkg/server/middleware/auth_test.go
+++ /dev/null
@@ -1,251 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package middleware
-
-import (
- "net/http"
- "net/http/httptest"
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/testutils"
-)
-
-func TestGuestOnly(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- handler := func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- }
-
- server := httptest.NewServer(GuestOnly(db, handler))
- defer server.Close()
-
- t.Run("guest", func(t *testing.T) {
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusOK, "status code mismatch")
- })
-
- t.Run("logged in", func(t *testing.T) {
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- assert.Equal(t, res.StatusCode, http.StatusFound, "status code mismatch")
- assert.Equal(t, res.Header.Get("Location"), "/", "location mismatch")
- })
-
- t.Run("error getting credential", func(t *testing.T) {
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- req.Header.Set("Authorization", "InvalidFormat")
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusOK, "status code mismatch")
- })
-}
-
-func TestAuth(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
-
- session := database.Session{
- Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
- UserID: user.ID,
- ExpiresAt: time.Now().Add(time.Hour * 24),
- }
- testutils.MustExec(t, db.Save(&session), "preparing session")
- expiredSession := database.Session{
- Key: "Vvgm3eBXfXGEFWERI7faiRJ3DAzJw+7DdT9J1LEyNfI=",
- UserID: user.ID,
- ExpiresAt: time.Now().Add(-time.Hour * 24),
- }
- testutils.MustExec(t, db.Save(&expiredSession), "preparing expired session")
-
- handler := func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- }
-
- t.Run("valid session with header", func(t *testing.T) {
- server := httptest.NewServer(Auth(db, handler, nil))
- defer server.Close()
-
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- req.Header.Set("Authorization", "Bearer "+session.Key)
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusOK, "status code mismatch")
- })
-
- t.Run("expired session with header", func(t *testing.T) {
- server := httptest.NewServer(Auth(db, handler, nil))
- defer server.Close()
-
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- req.Header.Set("Authorization", "Bearer "+expiredSession.Key)
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
- })
-
- t.Run("invalid session with header", func(t *testing.T) {
- server := httptest.NewServer(Auth(db, handler, nil))
- defer server.Close()
-
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- req.Header.Set("Authorization", "Bearer someInvalidSessionKey=")
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
- })
-
- t.Run("valid session with cookie", func(t *testing.T) {
- server := httptest.NewServer(Auth(db, handler, nil))
- defer server.Close()
-
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- req.AddCookie(&http.Cookie{
- Name: "id",
- Value: session.Key,
- HttpOnly: true,
- })
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusOK, "status code mismatch")
- })
-
- t.Run("expired session with cookie", func(t *testing.T) {
- server := httptest.NewServer(Auth(db, handler, nil))
- defer server.Close()
-
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- req.AddCookie(&http.Cookie{
- Name: "id",
- Value: expiredSession.Key,
- HttpOnly: true,
- })
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
- })
-
- t.Run("no auth", func(t *testing.T) {
- server := httptest.NewServer(Auth(db, handler, nil))
- defer server.Close()
-
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
- })
-
- t.Run("redirect guests to login", func(t *testing.T) {
- server := httptest.NewServer(Auth(db, handler, &AuthParams{RedirectGuestsToLogin: true}))
- defer server.Close()
-
- req := testutils.MakeReq(server.URL, "GET", "/settings", "")
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusFound, "status code mismatch")
- assert.Equal(t, res.Header.Get("Location"), "/login?referrer=%2Fsettings", "location mismatch")
- })
-}
-
-func TestTokenAuth(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- tok := database.Token{
- UserID: user.ID,
- Type: database.TokenTypeResetPassword,
- Value: "xpwFnc0MdllFUePDq9DLeQ==",
- }
- testutils.MustExec(t, db.Save(&tok), "preparing token")
- session := database.Session{
- Key: "A9xgggqzTHETy++GDi1NpDNe0iyqosPm9bitdeNGkJU=",
- UserID: user.ID,
- ExpiresAt: time.Now().Add(time.Hour * 24),
- }
- testutils.MustExec(t, db.Save(&session), "preparing session")
-
- handler := func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- }
-
- server := httptest.NewServer(TokenAuth(db, handler, database.TokenTypeResetPassword, nil))
- defer server.Close()
-
- t.Run("with token", func(t *testing.T) {
- req := testutils.MakeReq(server.URL, "GET", "/?token=xpwFnc0MdllFUePDq9DLeQ==", "")
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusOK, "status code mismatch")
- })
-
- t.Run("with invalid token", func(t *testing.T) {
- req := testutils.MakeReq(server.URL, "GET", "/?token=someRandomToken==", "")
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
- })
-
- t.Run("with session header", func(t *testing.T) {
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- req.Header.Set("Authorization", "Bearer "+session.Key)
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusOK, "status code mismatch")
- })
-
- t.Run("with invalid session", func(t *testing.T) {
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- req.Header.Set("Authorization", "Bearer someInvalidSessionKey=")
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
- })
-
- t.Run("without anything", func(t *testing.T) {
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- res := testutils.HTTPDo(t, req)
-
- assert.Equal(t, res.StatusCode, http.StatusUnauthorized, "status code mismatch")
- })
-}
-
-func TestWithAccount(t *testing.T) {
- db := testutils.InitMemoryDB(t)
-
- handler := func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- }
-
- t.Run("authenticated user", func(t *testing.T) {
- user := testutils.SetupUserData(db, "alice@test.com", "pass1234")
-
- server := httptest.NewServer(Auth(db, handler, nil))
- defer server.Close()
-
- req := testutils.MakeReq(server.URL, "GET", "/", "")
- res := testutils.HTTPAuthDo(t, db, req, user)
-
- assert.Equal(t, res.StatusCode, http.StatusOK, "status code mismatch")
- })
-}
diff --git a/pkg/server/middleware/helpers_test.go b/pkg/server/middleware/helpers_test.go
deleted file mode 100644
index 3142326f..00000000
--- a/pkg/server/middleware/helpers_test.go
+++ /dev/null
@@ -1,173 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package middleware
-
-import (
- "net/http"
- "testing"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/pkg/errors"
-)
-
-func TestGetSessionKeyFromCookie(t *testing.T) {
- testCases := []struct {
- cookie *http.Cookie
- expected string
- }{
- {
- cookie: &http.Cookie{
- Name: "id",
- Value: "foo",
- HttpOnly: true,
- },
- expected: "foo",
- },
- {
- cookie: nil,
- expected: "",
- },
- {
- cookie: &http.Cookie{
- Name: "foo",
- Value: "bar",
- HttpOnly: true,
- },
- expected: "",
- },
- }
-
- for _, tc := range testCases {
- // set up
- r, err := http.NewRequest("GET", "/", nil)
- if err != nil {
- t.Fatal(errors.Wrap(err, "constructing request"))
- }
-
- if tc.cookie != nil {
- r.AddCookie(tc.cookie)
- }
-
- // execute
- got, err := getSessionKeyFromCookie(r)
- if err != nil {
- t.Fatal(errors.Wrap(err, "executing"))
- }
-
- assert.Equal(t, got, tc.expected, "result mismatch")
- }
-}
-
-func TestGetSessionKeyFromAuth(t *testing.T) {
- testCases := []struct {
- authHeaderStr string
- expected string
- }{
- {
- authHeaderStr: "Bearer foo",
- expected: "foo",
- },
- }
-
- for _, tc := range testCases {
- // set up
- r, err := http.NewRequest("GET", "/", nil)
- if err != nil {
- t.Fatal(errors.Wrap(err, "constructing request"))
- }
-
- r.Header.Set("Authorization", tc.authHeaderStr)
-
- // execute
- got, err := getSessionKeyFromAuth(r)
- if err != nil {
- t.Fatal(errors.Wrap(err, "executing"))
- }
-
- assert.Equal(t, got, tc.expected, "result mismatch")
- }
-}
-
-func mustMakeRequest(t *testing.T) *http.Request {
- r, err := http.NewRequest("GET", "/", nil)
- if err != nil {
- t.Fatal(errors.Wrap(err, "constructing request"))
- }
-
- return r
-}
-
-func TestGetCredential(t *testing.T) {
- r1 := mustMakeRequest(t)
- r2 := mustMakeRequest(t)
- r2.Header.Set("Authorization", "Bearer foo")
- r3 := mustMakeRequest(t)
- r3.Header.Set("Authorization", "Bearer bar")
-
- r4 := mustMakeRequest(t)
- c4 := http.Cookie{
- Name: "id",
- Value: "foo",
- HttpOnly: true,
- }
- r4.AddCookie(&c4)
-
- r5 := mustMakeRequest(t)
- c5 := http.Cookie{
- Name: "id",
- Value: "foo",
- HttpOnly: true,
- }
- r5.AddCookie(&c5)
- r5.Header.Set("Authorization", "Bearer foo")
-
- testCases := []struct {
- request *http.Request
- expected string
- }{
- {
- request: r1,
- expected: "",
- },
- {
- request: r2,
- expected: "foo",
- },
- {
- request: r3,
- expected: "bar",
- },
- {
- request: r4,
- expected: "foo",
- },
- {
- request: r5,
- expected: "foo",
- },
- }
-
- for _, tc := range testCases {
- // execute
- got, err := GetCredential(tc.request)
- if err != nil {
- t.Fatal(errors.Wrap(err, "executing"))
- }
-
- assert.Equal(t, got, tc.expected, "result mismatch")
- }
-}
-
diff --git a/pkg/server/middleware/limit.go b/pkg/server/middleware/limit.go
deleted file mode 100644
index bc26664f..00000000
--- a/pkg/server/middleware/limit.go
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package middleware
-
-import (
- "net/http"
- "strings"
- "sync"
- "time"
-
- "github.com/dnote/dnote/pkg/server/log"
- "golang.org/x/time/rate"
-)
-
-const (
- // serverRateLimitPerSecond is the max requests per second the server will accept per IP
- serverRateLimitPerSecond = 50
- // serverRateLimitBurst is the burst capacity for rate limiting
- serverRateLimitBurst = 100
-)
-
-type visitor struct {
- limiter *rate.Limiter
- lastSeen time.Time
-}
-
-// RateLimiter holds the rate limiting state for visitors
-type RateLimiter struct {
- visitors map[string]*visitor
- mtx sync.RWMutex
-}
-
-// NewRateLimiter creates a new rate limiter instance
-func NewRateLimiter() *RateLimiter {
- rl := &RateLimiter{
- visitors: make(map[string]*visitor),
- }
- go rl.cleanupVisitors()
- return rl
-}
-
-var defaultLimiter = NewRateLimiter()
-
-// addVisitor adds a new visitor to the map and returns a limiter for the visitor
-func (rl *RateLimiter) addVisitor(identifier string) *rate.Limiter {
- // Calculate interval from rate: 1 second / requests per second
- interval := time.Second / time.Duration(serverRateLimitPerSecond)
- limiter := rate.NewLimiter(rate.Every(interval), serverRateLimitBurst)
-
- rl.mtx.Lock()
- rl.visitors[identifier] = &visitor{
- limiter: limiter,
- lastSeen: time.Now()}
- rl.mtx.Unlock()
-
- return limiter
-}
-
-// getVisitor returns a limiter for a visitor with the given identifier. It
-// adds the visitor to the map if not seen before.
-func (rl *RateLimiter) getVisitor(identifier string) *rate.Limiter {
- rl.mtx.RLock()
- v, exists := rl.visitors[identifier]
-
- if !exists {
- rl.mtx.RUnlock()
- return rl.addVisitor(identifier)
- }
-
- v.lastSeen = time.Now()
- rl.mtx.RUnlock()
-
- return v.limiter
-}
-
-// cleanupVisitors deletes visitors that has not been seen in a while from the
-// map of visitors
-func (rl *RateLimiter) cleanupVisitors() {
- for {
- time.Sleep(time.Minute)
- rl.mtx.Lock()
-
- for identifier, v := range rl.visitors {
- if time.Since(v.lastSeen) > 3*time.Minute {
- delete(rl.visitors, identifier)
- }
- }
-
- rl.mtx.Unlock()
- }
-}
-
-// lookupIP returns the request's IP
-func lookupIP(r *http.Request) string {
- realIP := r.Header.Get("X-Real-IP")
- forwardedFor := r.Header.Get("X-Forwarded-For")
-
- if forwardedFor != "" {
- parts := strings.Split(forwardedFor, ",")
- return parts[0]
- }
-
- if realIP != "" {
- return realIP
- }
-
- return r.RemoteAddr
-}
-
-// Limit is a middleware to rate limit the handler
-func (rl *RateLimiter) Limit(next http.Handler) http.HandlerFunc {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- identifier := lookupIP(r)
- limiter := rl.getVisitor(identifier)
-
- if !limiter.Allow() {
- http.Error(w, "Too many requests", http.StatusTooManyRequests)
- log.WithFields(log.Fields{
- "ip": identifier,
- }).Warn("Too many requests")
- return
- }
-
- next.ServeHTTP(w, r)
- })
-}
-
-// ApplyLimit applies rate limit conditionally using the global limiter
-func ApplyLimit(h http.HandlerFunc, rateLimit bool) http.Handler {
- ret := h
-
- if rateLimit {
- ret = defaultLimiter.Limit(ret)
- }
-
- return ret
-}
diff --git a/pkg/server/middleware/limit_test.go b/pkg/server/middleware/limit_test.go
deleted file mode 100644
index 594d0a94..00000000
--- a/pkg/server/middleware/limit_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package middleware
-
-import (
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestLimit(t *testing.T) {
- handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- })
-
- limiter := NewRateLimiter()
- middleware := limiter.Limit(handler)
-
- // Make burst + 5 requests from same IP
- numRequests := serverRateLimitBurst + 5
- blockedCount := 0
-
- for range numRequests {
- req := httptest.NewRequest("GET", "/test", nil)
- req.RemoteAddr = "192.168.1.1:1234"
- w := httptest.NewRecorder()
-
- middleware.ServeHTTP(w, req)
-
- if w.Code == http.StatusTooManyRequests {
- blockedCount++
- }
- }
-
- // At least some requests after burst should be blocked
- if blockedCount == 0 {
- t.Error("Expected some requests to be rate limited after burst")
- }
-}
-
-func TestLimit_DifferentIPs(t *testing.T) {
- handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- })
-
- limiter := NewRateLimiter()
- middleware := limiter.Limit(handler)
-
- // Exhaust rate limit for first IP
- for range serverRateLimitBurst + 5 {
- req := httptest.NewRequest("GET", "/test", nil)
- req.RemoteAddr = "192.168.1.1:1234"
- w := httptest.NewRecorder()
- middleware.ServeHTTP(w, req)
- }
-
- // Request from different IP should still succeed
- req := httptest.NewRequest("GET", "/test", nil)
- req.RemoteAddr = "192.168.1.2:5678"
- w := httptest.NewRecorder()
- middleware.ServeHTTP(w, req)
-
- if w.Code != http.StatusOK {
- t.Errorf("Request from different IP should succeed, got status %d", w.Code)
- }
-}
diff --git a/pkg/server/middleware/middleware.go b/pkg/server/middleware/middleware.go
deleted file mode 100644
index e509c169..00000000
--- a/pkg/server/middleware/middleware.go
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package middleware
-
-import (
- "net/http"
-
- "github.com/dnote/dnote/pkg/server/app"
-)
-
-// Middleware is a middleware for request handlers
-type Middleware func(h http.Handler, app *app.App, rateLimit bool) http.Handler
-
-// methodOverrideKey is the form key for overriding the method
-var methodOverrideKey = "_method"
-
-// methodOverride overrides the request's method to simulate form actions that
-// are not natively supported by web browsers
-func methodOverride(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.Method == http.MethodPost {
- method := r.PostFormValue(methodOverrideKey)
-
- if method == http.MethodPut || method == http.MethodPatch || method == http.MethodDelete {
- r.Method = method
- }
- }
-
- next.ServeHTTP(w, r)
- })
-}
-
-// WebMw is the middleware for the web
-func WebMw(h http.Handler, app *app.App, rateLimit bool) http.Handler {
- ret := h
-
- ret = ApplyLimit(ret.ServeHTTP, rateLimit)
-
- return ret
-}
-
-// APIMw is the middleware for the API
-func APIMw(h http.Handler, app *app.App, rateLimit bool) http.Handler {
- ret := h
-
- ret = ApplyLimit(ret.ServeHTTP, rateLimit)
-
- return ret
-}
-
-// Global is the middleware for all routes
-func Global(h http.Handler) http.Handler {
- ret := h
-
- ret = Logging(ret)
- ret = methodOverride(ret)
-
- return ret
-}
diff --git a/pkg/server/operations/doc.go b/pkg/server/operations/doc.go
index 7a4fe7c8..9aa0b213 100644
--- a/pkg/server/operations/doc.go
+++ b/pkg/server/operations/doc.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
/*
diff --git a/pkg/server/operations/main_test.go b/pkg/server/operations/main_test.go
new file mode 100644
index 00000000..5421d78f
--- /dev/null
+++ b/pkg/server/operations/main_test.go
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package operations
+
+import (
+ "os"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/server/testutils"
+)
+
+func TestMain(m *testing.M) {
+ testutils.InitTestDB()
+
+ code := m.Run()
+ testutils.ClearData(testutils.DB)
+
+ os.Exit(code)
+}
diff --git a/pkg/server/operations/notes.go b/pkg/server/operations/notes.go
index 74b279e4..977236ba 100644
--- a/pkg/server/operations/notes.go
+++ b/pkg/server/operations/notes.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package operations
@@ -19,27 +22,30 @@ import (
"github.com/dnote/dnote/pkg/server/database"
"github.com/dnote/dnote/pkg/server/helpers"
"github.com/dnote/dnote/pkg/server/permissions"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
- "gorm.io/gorm"
)
// GetNote retrieves a note for the given user
-func GetNote(db *gorm.DB, uuid string, user *database.User) (database.Note, bool, error) {
+func GetNote(db *gorm.DB, uuid string, user database.User) (database.Note, bool, error) {
zeroNote := database.Note{}
if !helpers.ValidateUUID(uuid) {
return zeroNote, false, nil
}
- var note database.Note
- err := database.PreloadNote(db.Where("notes.uuid = ? AND deleted = ?", uuid, false)).Find(¬e).Error
+ conn := db.Where("notes.uuid = ? AND deleted = ?", uuid, false)
+ conn = database.PreloadNote(conn)
- if errors.Is(err, gorm.ErrRecordNotFound) {
+ var note database.Note
+ conn = conn.Find(¬e)
+
+ if conn.RecordNotFound() {
return zeroNote, false, nil
- } else if err != nil {
+ } else if err := conn.Error; err != nil {
return zeroNote, false, errors.Wrap(err, "finding note")
}
- if ok := permissions.ViewNote(user, note); !ok {
+ if ok := permissions.ViewNote(&user, note); !ok {
return zeroNote, false, nil
}
diff --git a/pkg/server/operations/notes_test.go b/pkg/server/operations/notes_test.go
index a09c1c28..a9f1e816 100644
--- a/pkg/server/operations/notes_test.go
+++ b/pkg/server/operations/notes_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package operations
@@ -25,29 +28,38 @@ import (
)
func TestGetNote(t *testing.T) {
- db := testutils.InitMemoryDB(t)
+ user := testutils.SetupUserData()
+ anotherUser := testutils.SetupUserData()
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- anotherUser := testutils.SetupUserData(db, "another@test.com", "password123")
+ defer testutils.ClearData(testutils.DB)
b1 := database.Book{
- UUID: testutils.MustUUID(t),
UserID: user.ID,
Label: "js",
}
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
- note := database.Note{
- UUID: testutils.MustUUID(t),
+ privateNote := database.Note{
UserID: user.ID,
BookUUID: b1.UUID,
- Body: "note content",
+ Body: "privateNote content",
Deleted: false,
+ Public: false,
}
- testutils.MustExec(t, db.Save(¬e), "preparing note")
+ testutils.MustExec(t, testutils.DB.Save(&privateNote), "preparing privateNote")
- var noteRecord database.Note
- testutils.MustExec(t, db.Where("uuid = ?", note.UUID).Preload("Book").Preload("User").First(¬eRecord), "finding note")
+ publicNote := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: "privateNote content",
+ Deleted: false,
+ Public: true,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&publicNote), "preparing privateNote")
+
+ var privateNoteRecord, publicNoteRecord database.Note
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", privateNote.UUID).Preload("Book").Preload("User").First(&privateNoteRecord), "finding privateNote")
+ testutils.MustExec(t, testutils.DB.Where("uuid = ?", publicNote.UUID).Preload("Book").Preload("User").First(&publicNoteRecord), "finding publicNote")
testCases := []struct {
name string
@@ -57,31 +69,45 @@ func TestGetNote(t *testing.T) {
expectedNote database.Note
}{
{
- name: "owner accessing note",
+ name: "owner accessing private note",
user: user,
- note: note,
+ note: privateNote,
expectedOK: true,
- expectedNote: noteRecord,
+ expectedNote: privateNoteRecord,
},
{
- name: "non-owner accessing note",
+ name: "non-owner accessing private note",
user: anotherUser,
- note: note,
+ note: privateNote,
expectedOK: false,
expectedNote: database.Note{},
},
{
- name: "guest accessing note",
+ name: "non-owner accessing public note",
+ user: anotherUser,
+ note: publicNote,
+ expectedOK: true,
+ expectedNote: publicNoteRecord,
+ },
+ {
+ name: "guest accessing private note",
user: database.User{},
- note: note,
+ note: privateNote,
expectedOK: false,
expectedNote: database.Note{},
},
+ {
+ name: "guest accessing public note",
+ user: database.User{},
+ note: publicNote,
+ expectedOK: true,
+ expectedNote: publicNoteRecord,
+ },
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
- note, ok, err := GetNote(db, tc.note.UUID, &tc.user)
+ note, ok, err := GetNote(testutils.DB, tc.note.UUID, tc.user)
if err != nil {
t.Fatal(errors.Wrap(err, "executing"))
}
@@ -93,28 +119,29 @@ func TestGetNote(t *testing.T) {
}
func TestGetNote_nonexistent(t *testing.T) {
- db := testutils.InitMemoryDB(t)
+ user := testutils.SetupUserData()
- user := testutils.SetupUserData(db, "user@test.com", "password123")
+ defer testutils.ClearData(testutils.DB)
b1 := database.Book{
- UUID: testutils.MustUUID(t),
UserID: user.ID,
Label: "js",
}
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+ n1UUID := "4fd19336-671e-4ff3-8f22-662b80e22edc"
n1 := database.Note{
- UUID: "4fd19336-671e-4ff3-8f22-662b80e22edc",
+ UUID: n1UUID,
UserID: user.ID,
BookUUID: b1.UUID,
Body: "n1 content",
Deleted: false,
+ Public: false,
}
- testutils.MustExec(t, db.Save(&n1), "preparing n1")
+ testutils.MustExec(t, testutils.DB.Save(&n1), "preparing n1")
nonexistentUUID := "4fd19336-671e-4ff3-8f22-662b80e22edd"
- note, ok, err := GetNote(db, nonexistentUUID, &user)
+ note, ok, err := GetNote(testutils.DB, nonexistentUUID, user)
if err != nil {
t.Fatal(errors.Wrap(err, "executing"))
}
diff --git a/pkg/server/permissions/permissions.go b/pkg/server/permissions/permissions.go
index 54427acf..e3da80f0 100644
--- a/pkg/server/permissions/permissions.go
+++ b/pkg/server/permissions/permissions.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package permissions
@@ -21,6 +24,9 @@ import (
// ViewNote checks if the given user can view the given note
func ViewNote(user *database.User, note database.Note) bool {
+ if note.Public {
+ return true
+ }
if user == nil {
return false
}
diff --git a/pkg/server/permissions/permissions_test.go b/pkg/server/permissions/permissions_test.go
index 2a5daca1..3508400c 100644
--- a/pkg/server/permissions/permissions_test.go
+++ b/pkg/server/permissions/permissions_test.go
@@ -1,21 +1,25 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package permissions
import (
+ "os"
"testing"
"github.com/dnote/dnote/pkg/assert"
@@ -23,40 +27,72 @@ import (
"github.com/dnote/dnote/pkg/server/testutils"
)
-func TestViewNote(t *testing.T) {
- db := testutils.InitMemoryDB(t)
+func TestMain(m *testing.M) {
+ testutils.InitTestDB()
- user := testutils.SetupUserData(db, "user@test.com", "password123")
- anotherUser := testutils.SetupUserData(db, "another@test.com", "password123")
+ code := m.Run()
+ testutils.ClearData(testutils.DB)
+
+ os.Exit(code)
+}
+
+func TestViewNote(t *testing.T) {
+ user := testutils.SetupUserData()
+ anotherUser := testutils.SetupUserData()
+
+ defer testutils.ClearData(testutils.DB)
b1 := database.Book{
- UUID: testutils.MustUUID(t),
UserID: user.ID,
Label: "js",
}
- testutils.MustExec(t, db.Save(&b1), "preparing b1")
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
- note := database.Note{
- UUID: testutils.MustUUID(t),
+ privateNote := database.Note{
UserID: user.ID,
BookUUID: b1.UUID,
- Body: "note content",
+ Body: "privateNote content",
Deleted: false,
+ Public: false,
}
- testutils.MustExec(t, db.Save(¬e), "preparing note")
+ testutils.MustExec(t, testutils.DB.Save(&privateNote), "preparing privateNote")
- t.Run("owner accessing note", func(t *testing.T) {
- result := ViewNote(&user, note)
+ publicNote := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Body: "privateNote content",
+ Deleted: false,
+ Public: true,
+ }
+ testutils.MustExec(t, testutils.DB.Save(&publicNote), "preparing privateNote")
+
+ t.Run("owner accessing private note", func(t *testing.T) {
+ result := ViewNote(&user, privateNote)
assert.Equal(t, result, true, "result mismatch")
})
- t.Run("non-owner accessing note", func(t *testing.T) {
- result := ViewNote(&anotherUser, note)
+ t.Run("owner accessing public note", func(t *testing.T) {
+ result := ViewNote(&user, publicNote)
+ assert.Equal(t, result, true, "result mismatch")
+ })
+
+ t.Run("non-owner accessing private note", func(t *testing.T) {
+ result := ViewNote(&anotherUser, privateNote)
assert.Equal(t, result, false, "result mismatch")
})
- t.Run("guest accessing note", func(t *testing.T) {
- result := ViewNote(nil, note)
+ t.Run("non-owner accessing public note", func(t *testing.T) {
+ result := ViewNote(&anotherUser, publicNote)
+ assert.Equal(t, result, true, "result mismatch")
+ })
+
+ t.Run("guest accessing private note", func(t *testing.T) {
+ result := ViewNote(nil, privateNote)
assert.Equal(t, result, false, "result mismatch")
})
+
+ t.Run("guest accessing public note", func(t *testing.T) {
+ result := ViewNote(nil, publicNote)
+ assert.Equal(t, result, true, "result mismatch")
+ })
}
diff --git a/pkg/server/presenters/book.go b/pkg/server/presenters/book.go
index 9c117726..edb1d57c 100644
--- a/pkg/server/presenters/book.go
+++ b/pkg/server/presenters/book.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package presenters
diff --git a/pkg/server/presenters/book_test.go b/pkg/server/presenters/book_test.go
deleted file mode 100644
index bf8a1b48..00000000
--- a/pkg/server/presenters/book_test.go
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package presenters
-
-import (
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/server/database"
-)
-
-func TestPresentBook(t *testing.T) {
- createdAt := time.Date(2025, 1, 15, 10, 30, 45, 123456789, time.UTC)
- updatedAt := time.Date(2025, 2, 20, 14, 45, 30, 987654321, time.UTC)
-
- testCases := []struct {
- name string
- input database.Book
- expected Book
- }{
- {
- name: "basic book",
- input: database.Book{
- Model: database.Model{
- ID: 1,
- CreatedAt: createdAt,
- UpdatedAt: updatedAt,
- },
- UUID: "a1b2c3d4-e5f6-4789-a012-3456789abcde",
- UserID: 42,
- Label: "JavaScript",
- USN: 100,
- },
- expected: Book{
- UUID: "a1b2c3d4-e5f6-4789-a012-3456789abcde",
- USN: 100,
- CreatedAt: FormatTS(createdAt),
- UpdatedAt: FormatTS(updatedAt),
- Label: "JavaScript",
- },
- },
- {
- name: "book with special characters in label",
- input: database.Book{
- Model: database.Model{
- ID: 2,
- CreatedAt: createdAt,
- UpdatedAt: updatedAt,
- },
- UUID: "f1e2d3c4-b5a6-4987-b654-321fedcba098",
- UserID: 99,
- Label: "C++",
- USN: 200,
- },
- expected: Book{
- UUID: "f1e2d3c4-b5a6-4987-b654-321fedcba098",
- USN: 200,
- CreatedAt: FormatTS(createdAt),
- UpdatedAt: FormatTS(updatedAt),
- Label: "C++",
- },
- },
- {
- name: "book with empty label",
- input: database.Book{
- Model: database.Model{
- ID: 3,
- CreatedAt: createdAt,
- UpdatedAt: updatedAt,
- },
- UUID: "12345678-90ab-4cde-8901-234567890abc",
- UserID: 1,
- Label: "",
- USN: 0,
- },
- expected: Book{
- UUID: "12345678-90ab-4cde-8901-234567890abc",
- USN: 0,
- CreatedAt: FormatTS(createdAt),
- UpdatedAt: FormatTS(updatedAt),
- Label: "",
- },
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- got := PresentBook(tc.input)
-
- assert.Equal(t, got.UUID, tc.expected.UUID, "UUID mismatch")
- assert.Equal(t, got.USN, tc.expected.USN, "USN mismatch")
- assert.Equal(t, got.Label, tc.expected.Label, "Label mismatch")
- assert.Equal(t, got.CreatedAt, tc.expected.CreatedAt, "CreatedAt mismatch")
- assert.Equal(t, got.UpdatedAt, tc.expected.UpdatedAt, "UpdatedAt mismatch")
- })
- }
-}
-
-func TestPresentBooks(t *testing.T) {
- createdAt1 := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)
- updatedAt1 := time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)
- createdAt2 := time.Date(2025, 2, 1, 0, 0, 0, 0, time.UTC)
- updatedAt2 := time.Date(2025, 2, 2, 0, 0, 0, 0, time.UTC)
-
- testCases := []struct {
- name string
- input []database.Book
- expected []Book
- }{
- {
- name: "empty slice",
- input: []database.Book{},
- expected: []Book{},
- },
- {
- name: "single book",
- input: []database.Book{
- {
- Model: database.Model{
- ID: 1,
- CreatedAt: createdAt1,
- UpdatedAt: updatedAt1,
- },
- UUID: "9a8b7c6d-5e4f-4321-9876-543210fedcba",
- UserID: 1,
- Label: "Go",
- USN: 10,
- },
- },
- expected: []Book{
- {
- UUID: "9a8b7c6d-5e4f-4321-9876-543210fedcba",
- USN: 10,
- CreatedAt: FormatTS(createdAt1),
- UpdatedAt: FormatTS(updatedAt1),
- Label: "Go",
- },
- },
- },
- {
- name: "multiple books",
- input: []database.Book{
- {
- Model: database.Model{
- ID: 1,
- CreatedAt: createdAt1,
- UpdatedAt: updatedAt1,
- },
- UUID: "9a8b7c6d-5e4f-4321-9876-543210fedcba",
- UserID: 1,
- Label: "Go",
- USN: 10,
- },
- {
- Model: database.Model{
- ID: 2,
- CreatedAt: createdAt2,
- UpdatedAt: updatedAt2,
- },
- UUID: "abcdef01-2345-4678-9abc-def012345678",
- UserID: 1,
- Label: "Python",
- USN: 20,
- },
- },
- expected: []Book{
- {
- UUID: "9a8b7c6d-5e4f-4321-9876-543210fedcba",
- USN: 10,
- CreatedAt: FormatTS(createdAt1),
- UpdatedAt: FormatTS(updatedAt1),
- Label: "Go",
- },
- {
- UUID: "abcdef01-2345-4678-9abc-def012345678",
- USN: 20,
- CreatedAt: FormatTS(createdAt2),
- UpdatedAt: FormatTS(updatedAt2),
- Label: "Python",
- },
- },
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- got := PresentBooks(tc.input)
-
- assert.Equal(t, len(got), len(tc.expected), "Length mismatch")
-
- for i := range got {
- assert.Equal(t, got[i].UUID, tc.expected[i].UUID, "UUID mismatch")
- assert.Equal(t, got[i].USN, tc.expected[i].USN, "USN mismatch")
- assert.Equal(t, got[i].Label, tc.expected[i].Label, "Label mismatch")
- assert.Equal(t, got[i].CreatedAt, tc.expected[i].CreatedAt, "CreatedAt mismatch")
- assert.Equal(t, got[i].UpdatedAt, tc.expected[i].UpdatedAt, "UpdatedAt mismatch")
- }
- })
- }
-}
diff --git a/pkg/server/presenters/email_preference.go b/pkg/server/presenters/email_preference.go
new file mode 100644
index 00000000..66569132
--- /dev/null
+++ b/pkg/server/presenters/email_preference.go
@@ -0,0 +1,45 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package presenters
+
+import (
+ "time"
+
+ "github.com/dnote/dnote/pkg/server/database"
+)
+
+// EmailPreference is a presented email digest
+type EmailPreference struct {
+ InactiveReminder bool `json:"inactive_reminder"`
+ ProductUpdate bool `json:"product_update"`
+ CreatedAt time.Time `json:"created_at"`
+ UpdatedAt time.Time `json:"updated_at"`
+}
+
+// PresentEmailPreference presents a digest
+func PresentEmailPreference(p database.EmailPreference) EmailPreference {
+ ret := EmailPreference{
+ InactiveReminder: p.InactiveReminder,
+ ProductUpdate: p.ProductUpdate,
+ CreatedAt: FormatTS(p.CreatedAt),
+ UpdatedAt: FormatTS(p.UpdatedAt),
+ }
+
+ return ret
+}
diff --git a/pkg/server/presenters/helpers.go b/pkg/server/presenters/helpers.go
index 3cce728c..1055ea39 100644
--- a/pkg/server/presenters/helpers.go
+++ b/pkg/server/presenters/helpers.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package presenters
diff --git a/pkg/server/presenters/helpers_test.go b/pkg/server/presenters/helpers_test.go
deleted file mode 100644
index 33b0ed2e..00000000
--- a/pkg/server/presenters/helpers_test.go
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package presenters
-
-import (
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
-)
-
-func TestFormatTS(t *testing.T) {
- input := time.Date(2025, 1, 15, 10, 30, 45, 123456789, time.UTC)
- expected := time.Date(2025, 1, 15, 10, 30, 45, 123457000, time.UTC)
-
- got := FormatTS(input)
-
- assert.Equal(t, got, expected, "FormatTS mismatch")
-}
diff --git a/pkg/server/presenters/note.go b/pkg/server/presenters/note.go
index 267717da..0da9d7a4 100644
--- a/pkg/server/presenters/note.go
+++ b/pkg/server/presenters/note.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package presenters
@@ -28,6 +31,7 @@ type Note struct {
UpdatedAt time.Time `json:"updated_at"`
Body string `json:"content"`
AddedOn int64 `json:"added_on"`
+ Public bool `json:"public"`
USN int `json:"usn"`
Book NoteBook `json:"book"`
User NoteUser `json:"user"`
@@ -53,6 +57,7 @@ func PresentNote(note database.Note) Note {
UpdatedAt: FormatTS(note.UpdatedAt),
Body: note.Body,
AddedOn: note.AddedOn,
+ Public: note.Public,
USN: note.USN,
Book: NoteBook{
UUID: note.Book.UUID,
diff --git a/pkg/server/presenters/note_test.go b/pkg/server/presenters/note_test.go
deleted file mode 100644
index ee2fe78d..00000000
--- a/pkg/server/presenters/note_test.go
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package presenters
-
-import (
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
- "github.com/dnote/dnote/pkg/server/database"
-)
-
-func TestPresentNote(t *testing.T) {
- createdAt := time.Date(2025, 1, 15, 10, 30, 45, 123456789, time.UTC)
- updatedAt := time.Date(2025, 2, 20, 14, 45, 30, 987654321, time.UTC)
-
- input := database.Note{
- Model: database.Model{
- ID: 1,
- CreatedAt: createdAt,
- UpdatedAt: updatedAt,
- },
- UUID: "a1b2c3d4-e5f6-4789-a012-3456789abcde",
- UserID: 42,
- BookUUID: "f1e2d3c4-b5a6-4987-b654-321fedcba098",
- Body: "Test note content",
- AddedOn: 1234567890,
- USN: 100,
- Book: database.Book{
- UUID: "f1e2d3c4-b5a6-4987-b654-321fedcba098",
- Label: "JavaScript",
- },
- User: database.User{
- UUID: "9a8b7c6d-5e4f-4321-9876-543210fedcba",
- },
- }
-
- got := PresentNote(input)
-
- assert.Equal(t, got.UUID, "a1b2c3d4-e5f6-4789-a012-3456789abcde", "UUID mismatch")
- assert.Equal(t, got.Body, "Test note content", "Body mismatch")
- assert.Equal(t, got.AddedOn, int64(1234567890), "AddedOn mismatch")
- assert.Equal(t, got.USN, 100, "USN mismatch")
- assert.Equal(t, got.CreatedAt, FormatTS(createdAt), "CreatedAt mismatch")
- assert.Equal(t, got.UpdatedAt, FormatTS(updatedAt), "UpdatedAt mismatch")
- assert.Equal(t, got.Book.UUID, "f1e2d3c4-b5a6-4987-b654-321fedcba098", "Book UUID mismatch")
- assert.Equal(t, got.Book.Label, "JavaScript", "Book Label mismatch")
- assert.Equal(t, got.User.UUID, "9a8b7c6d-5e4f-4321-9876-543210fedcba", "User UUID mismatch")
-}
-
-func TestPresentNotes(t *testing.T) {
- createdAt1 := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)
- updatedAt1 := time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)
- createdAt2 := time.Date(2025, 2, 1, 0, 0, 0, 0, time.UTC)
- updatedAt2 := time.Date(2025, 2, 2, 0, 0, 0, 0, time.UTC)
-
- input := []database.Note{
- {
- Model: database.Model{
- ID: 1,
- CreatedAt: createdAt1,
- UpdatedAt: updatedAt1,
- },
- UUID: "a1b2c3d4-e5f6-4789-a012-3456789abcde",
- UserID: 1,
- BookUUID: "f1e2d3c4-b5a6-4987-b654-321fedcba098",
- Body: "First note",
- AddedOn: 1000000000,
- USN: 10,
- Book: database.Book{
- UUID: "f1e2d3c4-b5a6-4987-b654-321fedcba098",
- Label: "Go",
- },
- User: database.User{
- UUID: "9a8b7c6d-5e4f-4321-9876-543210fedcba",
- },
- },
- {
- Model: database.Model{
- ID: 2,
- CreatedAt: createdAt2,
- UpdatedAt: updatedAt2,
- },
- UUID: "12345678-90ab-4cde-8901-234567890abc",
- UserID: 1,
- BookUUID: "abcdef01-2345-4678-9abc-def012345678",
- Body: "Second note",
- AddedOn: 2000000000,
- USN: 20,
- Book: database.Book{
- UUID: "abcdef01-2345-4678-9abc-def012345678",
- Label: "Python",
- },
- User: database.User{
- UUID: "9a8b7c6d-5e4f-4321-9876-543210fedcba",
- },
- },
- }
-
- got := PresentNotes(input)
-
- assert.Equal(t, len(got), 2, "Length mismatch")
- assert.Equal(t, got[0].UUID, "a1b2c3d4-e5f6-4789-a012-3456789abcde", "Note 0 UUID mismatch")
- assert.Equal(t, got[0].Body, "First note", "Note 0 Body mismatch")
- assert.Equal(t, got[1].UUID, "12345678-90ab-4cde-8901-234567890abc", "Note 1 UUID mismatch")
- assert.Equal(t, got[1].Body, "Second note", "Note 1 Body mismatch")
-}
diff --git a/pkg/server/session/session.go b/pkg/server/session/session.go
index b9ae62d4..cf0eacd2 100644
--- a/pkg/server/session/session.go
+++ b/pkg/server/session/session.go
@@ -1,18 +1,3 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package session
import (
@@ -21,14 +6,18 @@ import (
// Session represents user session
type Session struct {
- UUID string `json:"uuid"`
- Email string `json:"email"`
+ UUID string `json:"uuid"`
+ Email string `json:"email"`
+ EmailVerified bool `json:"email_verified"`
+ Pro bool `json:"pro"`
}
// New returns a new session for the given user
-func New(user database.User) Session {
+func New(user database.User, account database.Account) Session {
return Session{
- UUID: user.UUID,
- Email: user.Email.String,
+ UUID: user.UUID,
+ Pro: user.Cloud,
+ Email: account.Email.String,
+ EmailVerified: account.EmailVerified,
}
}
diff --git a/pkg/server/session/session_test.go b/pkg/server/session/session_test.go
index 081a82de..bd05f51e 100644
--- a/pkg/server/session/session_test.go
+++ b/pkg/server/session/session_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package session
@@ -24,34 +27,38 @@ import (
)
func TestNew(t *testing.T) {
- u1 := database.User{
- UUID: "0f5f0054-d23f-4be1-b5fb-57673109e9cb",
- Email: database.ToNullString("alice@example.com"),
- }
+ u1 := database.User{UUID: "0f5f0054-d23f-4be1-b5fb-57673109e9cb", Cloud: true}
+ a1 := database.Account{Email: database.ToNullString("alice@example.com"), EmailVerified: false}
- u2 := database.User{
- UUID: "718a1041-bbe6-496e-bbe4-ea7e572c295e",
- Email: database.ToNullString("bob@example.com"),
- }
+ u2 := database.User{UUID: "718a1041-bbe6-496e-bbe4-ea7e572c295e", Cloud: false}
+ a2 := database.Account{Email: database.ToNullString("bob@example.com"), EmailVerified: false}
testCases := []struct {
- user database.User
+ user database.User
+ account database.Account
+ expectedPro bool
}{
{
- user: u1,
+ user: u1,
+ account: a1,
+ expectedPro: true,
},
{
- user: u2,
+ user: u2,
+ account: a2,
+ expectedPro: false,
},
}
- for idx, tc := range testCases {
- t.Run(fmt.Sprintf("user %d", idx), func(t *testing.T) {
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("user pro %t", tc.expectedPro), func(t *testing.T) {
// Execute
- got := New(tc.user)
+ got := New(tc.user, tc.account)
expected := Session{
- UUID: tc.user.UUID,
- Email: tc.user.Email.String,
+ UUID: tc.user.UUID,
+ Pro: tc.expectedPro,
+ Email: tc.account.Email.String,
+ EmailVerified: tc.account.EmailVerified,
}
assert.DeepEqual(t, got, expected, "result mismatch")
diff --git a/pkg/server/testutils/main.go b/pkg/server/testutils/main.go
index 8fce9ebf..ba3cd5ae 100644
--- a/pkg/server/testutils/main.go
+++ b/pkg/server/testutils/main.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
// Package testutils provides utilities used in tests
@@ -22,96 +25,128 @@ import (
"fmt"
"math/rand"
"net/http"
- "net/url"
- "reflect"
"strings"
"sync"
"testing"
"time"
+ "github.com/dnote/dnote/pkg/server/config"
"github.com/dnote/dnote/pkg/server/database"
- "github.com/dnote/dnote/pkg/server/helpers"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
"golang.org/x/crypto/bcrypt"
- "gorm.io/driver/sqlite"
- "gorm.io/gorm"
)
-// InitDB opens a database at the given path and initializes the schema
-func InitDB(dbPath string) *gorm.DB {
- db := database.Open(dbPath)
- database.InitSchema(db)
- database.Migrate(db)
- return db
+func init() {
+ rand.Seed(time.Now().UnixNano())
}
-// InitMemoryDB creates an in-memory SQLite database with the schema initialized
-func InitMemoryDB(t *testing.T) *gorm.DB {
- // Use file-based in-memory database with unique UUID per test to avoid sharing
- uuid, err := helpers.GenUUID()
- if err != nil {
- t.Fatalf("failed to generate UUID for test database: %v", err)
- }
- dbName := fmt.Sprintf("file:%s?mode=memory&cache=shared", uuid)
- db, err := gorm.Open(sqlite.Open(dbName), &gorm.Config{})
- if err != nil {
- t.Fatalf("failed to open in-memory database: %v", err)
- }
+// DB is the database connection to a test database
+var DB *gorm.DB
+
+// InitTestDB establishes connection pool with the test database specified by
+// the environment variable configuration and initalizes a new schema
+func InitTestDB() {
+ c := config.Load()
+ fmt.Println(c.DB.GetConnectionStr())
+ db := database.Open(c)
database.InitSchema(db)
- database.Migrate(db)
- return db
+ DB = db
}
-// MustUUID generates a UUID and fails the test on error
-func MustUUID(t *testing.T) string {
- uuid, err := helpers.GenUUID()
- if err != nil {
- t.Fatal(errors.Wrap(err, "Failed to generate UUID"))
+// ClearData deletes all records from the database
+func ClearData(db *gorm.DB) {
+ if err := db.Delete(&database.Book{}).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to clear books"))
+ }
+ if err := db.Delete(&database.Note{}).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to clear notes"))
+ }
+ if err := db.Delete(&database.Notification{}).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to clear notifications"))
+ }
+ if err := db.Delete(&database.User{}).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to clear users"))
+ }
+ if err := db.Delete(&database.Account{}).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to clear accounts"))
+ }
+ if err := db.Delete(&database.Token{}).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to clear tokens"))
+ }
+ if err := db.Delete(&database.EmailPreference{}).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to clear email preferences"))
+ }
+ if err := db.Delete(&database.Session{}).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to clear sessions"))
}
- return uuid
}
-// SetupUserData creates and returns a new user with email and password for testing purposes
-func SetupUserData(db *gorm.DB, email, password string) database.User {
- uuid, err := helpers.GenUUID()
- if err != nil {
- panic(errors.Wrap(err, "Failed to generate UUID"))
- }
-
- hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
- if err != nil {
- panic(errors.Wrap(err, "Failed to hash password"))
- }
-
+// SetupUserData creates and returns a new user for testing purposes
+func SetupUserData() database.User {
user := database.User{
- UUID: uuid,
- Email: database.ToNullString(email),
- Password: database.ToNullString(string(hashedPassword)),
+ Cloud: true,
}
- if err := db.Save(&user).Error; err != nil {
+ if err := DB.Save(&user).Error; err != nil {
panic(errors.Wrap(err, "Failed to prepare user"))
}
return user
}
+// SetupAccountData creates and returns a new account for the user
+func SetupAccountData(user database.User, email, password string) database.Account {
+ account := database.Account{
+ UserID: user.ID,
+ }
+ if email != "" {
+ account.Email = database.ToNullString(email)
+ }
+
+ hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
+ if err != nil {
+ panic(errors.Wrap(err, "Failed to hash password"))
+ }
+ account.Password = database.ToNullString(string(hashedPassword))
+
+ if err := DB.Save(&account).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to prepare account"))
+ }
+
+ return account
+}
+
// SetupSession creates and returns a new user session
-func SetupSession(db *gorm.DB, user database.User) database.Session {
+func SetupSession(t *testing.T, user database.User) database.Session {
session := database.Session{
Key: "Vvgm3eBXfXGEFWERI7faiRJ3DAzJw+7DdT9J1LEyNfI=",
UserID: user.ID,
ExpiresAt: time.Now().Add(time.Hour * 24),
}
- if err := db.Save(&session).Error; err != nil {
- panic(errors.Wrap(err, "Failed to prepare user"))
+ if err := DB.Save(&session).Error; err != nil {
+ t.Fatal(errors.Wrap(err, "Failed to prepare user"))
}
return session
}
+// SetupEmailPreferenceData creates and returns a new email frequency for a user
+func SetupEmailPreferenceData(user database.User, inactiveReminder bool) database.EmailPreference {
+ frequency := database.EmailPreference{
+ UserID: user.ID,
+ InactiveReminder: inactiveReminder,
+ }
+
+ if err := DB.Save(&frequency).Error; err != nil {
+ panic(errors.Wrap(err, "Failed to prepare email frequency"))
+ }
+
+ return frequency
+}
+
// HTTPDo makes an HTTP request and returns a response
func HTTPDo(t *testing.T, req *http.Request) *http.Response {
hc := http.Client{
@@ -131,8 +166,8 @@ func HTTPDo(t *testing.T, req *http.Request) *http.Response {
return res
}
-// SetReqAuthHeader sets the authorization header in the given request for the given user with a specific DB
-func SetReqAuthHeader(t *testing.T, db *gorm.DB, req *http.Request, user database.User) {
+// SetReqAuthHeader sets the authorization header in the given request for the given user
+func SetReqAuthHeader(t *testing.T, req *http.Request, user database.User) {
b := make([]byte, 32)
if _, err := rand.Read(b); err != nil {
t.Fatal(errors.Wrap(err, "reading random bits"))
@@ -143,18 +178,19 @@ func SetReqAuthHeader(t *testing.T, db *gorm.DB, req *http.Request, user databas
UserID: user.ID,
ExpiresAt: time.Now().Add(time.Hour * 10 * 24),
}
- if err := db.Save(&session).Error; err != nil {
+ if err := DB.Save(&session).Error; err != nil {
t.Fatal(errors.Wrap(err, "Failed to prepare user"))
}
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", session.Key))
}
-// HTTPAuthDo makes an HTTP request with an appropriate authorization header for a user with a specific DB
-func HTTPAuthDo(t *testing.T, db *gorm.DB, req *http.Request, user database.User) *http.Response {
- SetReqAuthHeader(t, db, req, user)
+// HTTPAuthDo makes an HTTP request with an appropriate authorization header for a user
+func HTTPAuthDo(t *testing.T, req *http.Request, user database.User) *http.Response {
+ SetReqAuthHeader(t, req, user)
return HTTPDo(t, req)
+
}
// MakeReq makes an HTTP request and returns a response
@@ -162,7 +198,6 @@ func MakeReq(endpoint string, method, path, data string) *http.Request {
u := fmt.Sprintf("%s%s", endpoint, path)
req, err := http.NewRequest(method, u, strings.NewReader(data))
-
if err != nil {
panic(errors.Wrap(err, "constructing http request"))
}
@@ -170,14 +205,6 @@ func MakeReq(endpoint string, method, path, data string) *http.Request {
return req
}
-// MakeFormReq makes an HTTP request and returns a response
-func MakeFormReq(endpoint, method, path string, data url.Values) *http.Request {
- req := MakeReq(endpoint, method, path, data.Encode())
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
-
- return req
-}
-
// MustExec fails the test if the given database query has error
func MustExec(t *testing.T, db *gorm.DB, message string) {
if err := db.Error; err != nil {
@@ -210,10 +237,10 @@ func MustRespondJSON(t *testing.T, w http.ResponseWriter, i interface{}, message
// MockEmail is a mock email data
type MockEmail struct {
- TemplateType string
- From string
- To []string
- Data interface{}
+ Subject string
+ From string
+ To []string
+ Body string
}
// MockEmailbackendImplementation is an email backend that simply discards the emails
@@ -230,85 +257,17 @@ func (b *MockEmailbackendImplementation) Clear() {
b.Emails = []MockEmail{}
}
-// SendEmail is an implementation of Backend.SendEmail.
-func (b *MockEmailbackendImplementation) SendEmail(templateType, from string, to []string, data interface{}) error {
+// Queue is an implementation of Backend.Queue.
+func (b *MockEmailbackendImplementation) Queue(subject, from string, to []string, contentType, body string) error {
b.mu.Lock()
defer b.mu.Unlock()
b.Emails = append(b.Emails, MockEmail{
- TemplateType: templateType,
- From: from,
- To: to,
- Data: data,
+ Subject: subject,
+ From: from,
+ To: to,
+ Body: body,
})
return nil
}
-
-// EndpointType is the type of endpoint to be tested
-type EndpointType int
-
-const (
- // EndpointWeb represents a web endpoint returning HTML
- EndpointWeb EndpointType = iota
- // EndpointAPI represents an API endpoint returning JSON
- EndpointAPI
-)
-
-type endpointTest func(t *testing.T, target EndpointType)
-
-// RunForWebAndAPI runs the given test function for web and API
-func RunForWebAndAPI(t *testing.T, name string, runTest endpointTest) {
- t.Run(fmt.Sprintf("%s-web", name), func(t *testing.T) {
- runTest(t, EndpointWeb)
- })
-
- t.Run(fmt.Sprintf("%s-api", name), func(t *testing.T) {
- runTest(t, EndpointAPI)
- })
-}
-
-// PayloadWrapper is a wrapper for a payload that can be converted to
-// either URL form values or JSON
-type PayloadWrapper struct {
- Data interface{}
-}
-
-func (p PayloadWrapper) ToURLValues() url.Values {
- values := url.Values{}
-
- el := reflect.ValueOf(p.Data)
- if el.Kind() == reflect.Ptr {
- el = el.Elem()
- }
- iVal := el
- typ := iVal.Type()
- for i := 0; i < iVal.NumField(); i++ {
- fi := typ.Field(i)
- name := fi.Tag.Get("schema")
- if name == "" {
- name = fi.Name
- }
-
- if !iVal.Field(i).IsNil() {
- values.Set(name, fmt.Sprint(iVal.Field(i).Elem()))
- }
- }
-
- return values
-}
-
-func (p PayloadWrapper) ToJSON(t *testing.T) string {
- b, err := json.Marshal(p.Data)
- if err != nil {
- t.Fatal(err)
- }
-
- return string(b)
-}
-
-// TrueVal is a true value
-var TrueVal = true
-
-// FalseVal is a false value
-var FalseVal = false
diff --git a/pkg/server/tmpl/app.go b/pkg/server/tmpl/app.go
new file mode 100644
index 00000000..a5483165
--- /dev/null
+++ b/pkg/server/tmpl/app.go
@@ -0,0 +1,103 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package tmpl
+
+import (
+ "bytes"
+ "html/template"
+ "net/http"
+ "regexp"
+
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+)
+
+// routes
+var notesPathRegex = regexp.MustCompile("^/notes/([^/]+)$")
+
+// template names
+var templateIndex = "index"
+var templateNoteMetaTags = "note_metatags"
+
+// AppShell represents the application in HTML
+type AppShell struct {
+ DB *gorm.DB
+ T *template.Template
+}
+
+// ErrNotFound is an error indicating that a resource was not found
+var ErrNotFound = errors.New("not found")
+
+// NewAppShell parses the templates for the application
+func NewAppShell(db *gorm.DB, content []byte) (AppShell, error) {
+ t, err := template.New(templateIndex).Parse(string(content))
+ if err != nil {
+ return AppShell{}, errors.Wrap(err, "parsing the index template")
+ }
+
+ _, err = t.New(templateNoteMetaTags).Parse(noteMetaTags)
+ if err != nil {
+ return AppShell{}, errors.Wrap(err, "parsing the note meta tags template")
+ }
+
+ return AppShell{DB: db, T: t}, nil
+}
+
+// Execute executes the index template
+func (a AppShell) Execute(r *http.Request) ([]byte, error) {
+ data, err := a.getData(r)
+ if err != nil {
+ return nil, errors.Wrap(err, "getting data")
+ }
+
+ var buf bytes.Buffer
+ if err := a.T.ExecuteTemplate(&buf, templateIndex, data); err != nil {
+ return nil, errors.Wrap(err, "executing template")
+ }
+
+ return buf.Bytes(), nil
+}
+
+func (a AppShell) getData(r *http.Request) (tmplData, error) {
+ path := r.URL.Path
+
+ if ok, params := matchPath(path, notesPathRegex); ok {
+ p, err := a.newNotePage(r, params[0])
+ if err != nil {
+ return tmplData{}, errors.Wrap(err, "instantiating note page")
+ }
+
+ return p.getData()
+ }
+
+ p := defaultPage{}
+ return p.getData(), nil
+}
+
+// matchPath checks if the given path matches the given regular expressions
+// and returns a boolean as well as any parameters from regex capture groups.
+func matchPath(p string, reg *regexp.Regexp) (bool, []string) {
+ match := notesPathRegex.FindStringSubmatch(p)
+
+ if len(match) > 0 {
+ return true, match[1:]
+ }
+
+ return false, nil
+}
diff --git a/pkg/server/tmpl/app_test.go b/pkg/server/tmpl/app_test.go
new file mode 100644
index 00000000..6a1f08f5
--- /dev/null
+++ b/pkg/server/tmpl/app_test.go
@@ -0,0 +1,87 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package tmpl
+
+import (
+ "fmt"
+ "net/http"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+)
+
+func TestAppShellExecute(t *testing.T) {
+ t.Run("home", func(t *testing.T) {
+ a, err := NewAppShell(testutils.DB, []byte("{{ .Title }} {{ .MetaTags }}"))
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "preparing app shell"))
+ }
+
+ r, err := http.NewRequest("GET", "http://mock.url/", nil)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "preparing request"))
+ }
+
+ b, err := a.Execute(r)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "executing"))
+ }
+
+ assert.Equal(t, string(b), "Dnote ", "result mismatch")
+ })
+
+ t.Run("note", func(t *testing.T) {
+ defer testutils.ClearData(testutils.DB)
+
+ user := testutils.SetupUserData()
+ b1 := database.Book{
+ UserID: user.ID,
+ Label: "js",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&b1), "preparing b1")
+ n1 := database.Note{
+ UserID: user.ID,
+ BookUUID: b1.UUID,
+ Public: true,
+ Body: "n1 content",
+ }
+ testutils.MustExec(t, testutils.DB.Save(&n1), "preparing note")
+
+ a, err := NewAppShell(testutils.DB, []byte("{{ .MetaTags }}"))
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "preparing app shell"))
+ }
+
+ endpoint := fmt.Sprintf("http://mock.url/notes/%s", n1.UUID)
+ r, err := http.NewRequest("GET", endpoint, nil)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "preparing request"))
+ }
+
+ b, err := a.Execute(r)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "executing"))
+ }
+
+ assert.NotEqual(t, string(b), "", "result should not be empty")
+ })
+}
diff --git a/pkg/server/tmpl/data.go b/pkg/server/tmpl/data.go
new file mode 100644
index 00000000..16c42e81
--- /dev/null
+++ b/pkg/server/tmpl/data.go
@@ -0,0 +1,141 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package tmpl
+
+import (
+ "bytes"
+ "fmt"
+ "html/template"
+ "net/http"
+ "regexp"
+ "strings"
+ "time"
+
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/dnote/dnote/pkg/server/operations"
+ "github.com/pkg/errors"
+)
+
+var newlineRegexp = regexp.MustCompile(`\r?\n`)
+
+// tmplData is the data to be passed to the app shell template
+type tmplData struct {
+ Title string
+ MetaTags template.HTML
+}
+
+type noteMetaTagsData struct {
+ Title string
+ Description string
+}
+
+type notePage struct {
+ Note database.Note
+ T *template.Template
+}
+
+func (a AppShell) newNotePage(r *http.Request, noteUUID string) (notePage, error) {
+ user, _, err := handlers.AuthWithSession(a.DB, r, nil)
+ if err != nil {
+ return notePage{}, errors.Wrap(err, "authenticating with session")
+ }
+
+ note, ok, err := operations.GetNote(a.DB, noteUUID, user)
+
+ if !ok {
+ return notePage{}, ErrNotFound
+ }
+ if err != nil {
+ return notePage{}, errors.Wrap(err, "getting note")
+ }
+
+ return notePage{note, a.T}, nil
+}
+
+func (p notePage) getTitle() string {
+ note := p.Note
+ date := time.Unix(0, note.AddedOn).Format("Jan 2 2006")
+
+ return fmt.Sprintf("Note: %s (%s)", note.Book.Label, date)
+}
+
+func excerpt(s string, maxLen int) string {
+ if len(s) > maxLen {
+
+ var lastIdx int
+ if maxLen > 3 {
+ lastIdx = maxLen - 3
+ } else {
+ lastIdx = maxLen
+ }
+
+ return s[:lastIdx] + "..."
+ }
+
+ return s
+}
+
+func formatMetaDescContent(s string) string {
+ desc := excerpt(s, 200)
+ desc = strings.Trim(desc, " ")
+
+ return newlineRegexp.ReplaceAllString(desc, " ")
+}
+
+func (p notePage) getMetaTags() (template.HTML, error) {
+ title := p.getTitle()
+ desc := formatMetaDescContent(p.Note.Body)
+
+ data := noteMetaTagsData{
+ Title: title,
+ Description: desc,
+ }
+
+ var buf bytes.Buffer
+ if err := p.T.ExecuteTemplate(&buf, templateNoteMetaTags, data); err != nil {
+ return "", errors.Wrap(err, "executing template")
+ }
+
+ return template.HTML(buf.String()), nil
+}
+
+func (p notePage) getData() (tmplData, error) {
+ mt, err := p.getMetaTags()
+ if err != nil {
+ return tmplData{}, errors.Wrap(err, "getting meta tags")
+ }
+
+ dat := tmplData{
+ Title: p.getTitle(),
+ MetaTags: mt,
+ }
+
+ return dat, nil
+}
+
+type defaultPage struct {
+}
+
+func (p defaultPage) getData() tmplData {
+ return tmplData{
+ Title: "Dnote",
+ MetaTags: "",
+ }
+}
diff --git a/pkg/server/tmpl/data_test.go b/pkg/server/tmpl/data_test.go
new file mode 100644
index 00000000..768baf80
--- /dev/null
+++ b/pkg/server/tmpl/data_test.go
@@ -0,0 +1,64 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package tmpl
+
+import (
+ "html/template"
+ "testing"
+ "time"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/server/database"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+)
+
+func TestDefaultPageGetData(t *testing.T) {
+ p := defaultPage{}
+
+ result := p.getData()
+
+ assert.Equal(t, result.MetaTags, template.HTML(""), "MetaTags mismatch")
+ assert.Equal(t, result.Title, "Dnote", "Title mismatch")
+}
+
+func TestNotePageGetData(t *testing.T) {
+ a, err := NewAppShell(testutils.DB, nil)
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "preparing app shell"))
+ }
+
+ p := notePage{
+ Note: database.Note{
+ Book: database.Book{
+ Label: "vocabulary",
+ },
+ AddedOn: time.Date(2019, time.January, 2, 0, 0, 0, 0, time.UTC).UnixNano(),
+ },
+ T: a.T,
+ }
+
+ result, err := p.getData()
+ if err != nil {
+ t.Fatal(errors.Wrap(err, "executing"))
+ }
+
+ assert.NotEqual(t, result.MetaTags, template.HTML(""), "MetaTags should not be empty")
+ assert.Equal(t, result.Title, "Note: vocabulary (Jan 2 2019)", "Title mismatch")
+}
diff --git a/pkg/server/tmpl/main_test.go b/pkg/server/tmpl/main_test.go
new file mode 100644
index 00000000..25a9741c
--- /dev/null
+++ b/pkg/server/tmpl/main_test.go
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package tmpl
+
+import (
+ "os"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/server/testutils"
+)
+
+func TestMain(m *testing.M) {
+ testutils.InitTestDB()
+
+ code := m.Run()
+ testutils.ClearData(testutils.DB)
+
+ os.Exit(code)
+}
diff --git a/pkg/server/tmpl/tmpl.go b/pkg/server/tmpl/tmpl.go
new file mode 100644
index 00000000..2b86009a
--- /dev/null
+++ b/pkg/server/tmpl/tmpl.go
@@ -0,0 +1,29 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package tmpl
+
+var noteMetaTags = `
+
+
+
+
+
+
+
+ `
diff --git a/pkg/server/token/main_test.go b/pkg/server/token/main_test.go
new file mode 100644
index 00000000..b9cfb697
--- /dev/null
+++ b/pkg/server/token/main_test.go
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package token
+
+import (
+ "os"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/server/testutils"
+)
+
+func TestMain(m *testing.M) {
+ testutils.InitTestDB()
+
+ code := m.Run()
+ testutils.ClearData(testutils.DB)
+
+ os.Exit(code)
+}
diff --git a/pkg/server/token/token.go b/pkg/server/token/token.go
index af1feda5..44cad090 100644
--- a/pkg/server/token/token.go
+++ b/pkg/server/token/token.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package token
@@ -20,7 +23,7 @@ import (
"encoding/base64"
"github.com/dnote/dnote/pkg/server/database"
- "gorm.io/gorm"
+ "github.com/jinzhu/gorm"
"github.com/pkg/errors"
)
diff --git a/pkg/server/token/token_test.go b/pkg/server/token/token_test.go
index 5daed181..79c643da 100644
--- a/pkg/server/token/token_test.go
+++ b/pkg/server/token/token_test.go
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
package token
@@ -30,30 +33,30 @@ func TestCreate(t *testing.T) {
kind string
}{
{
- kind: database.TokenTypeResetPassword,
+ kind: database.TokenTypeEmailPreference,
},
}
for _, tc := range testCases {
t.Run(fmt.Sprintf("token type %s", tc.kind), func(t *testing.T) {
- db := testutils.InitMemoryDB(t)
+ defer testutils.ClearData(testutils.DB)
// Set up
- u := testutils.SetupUserData(db, "user@test.com", "password123")
+ u := testutils.SetupUserData()
// Execute
- tok, err := Create(db, u.ID, tc.kind)
+ tok, err := Create(testutils.DB, u.ID, tc.kind)
if err != nil {
t.Fatal(errors.Wrap(err, "performing"))
}
// Test
- var count int64
- testutils.MustExec(t, db.Model(&database.Token{}).Count(&count), "counting token")
- assert.Equalf(t, count, int64(1), "error mismatch")
+ var count int
+ testutils.MustExec(t, testutils.DB.Model(&database.Token{}).Count(&count), "counting token")
+ assert.Equalf(t, count, 1, "error mismatch")
var tokenRecord database.Token
- testutils.MustExec(t, db.First(&tokenRecord), "finding token")
+ testutils.MustExec(t, testutils.DB.First(&tokenRecord), "finding token")
assert.Equalf(t, tokenRecord.UserID, tok.UserID, "UserID mismatch")
assert.Equalf(t, tokenRecord.Value, tok.Value, "Value mismatch")
assert.Equalf(t, tokenRecord.Type, tok.Type, "Type mismatch")
diff --git a/pkg/server/views/data.go b/pkg/server/views/data.go
deleted file mode 100644
index 87fd2a90..00000000
--- a/pkg/server/views/data.go
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package views
-
-import (
- "net/http"
- "time"
-
- "github.com/dnote/dnote/pkg/server/database"
- "github.com/pkg/errors"
-)
-
-const (
- // AlertLvlError is an alert level for error
- AlertLvlError = "danger"
- // AlertLvlWarning is an alert level for warning
- AlertLvlWarning = "warning"
- // AlertLvlInfo is an alert level for info
- AlertLvlInfo = "info"
- // AlertLvlSuccess is an alert level for success
- AlertLvlSuccess = "success"
-
- // AlertMsgGeneric is a generic message for a server error
- AlertMsgGeneric = "Something went wrong. Please try again."
-)
-
-// Alert is used to render Bootstrap Alert messages in templates
-type Alert struct {
- Level string
- Message string
-}
-
-// Data is the top level structure that views expect data to come in.
-type Data struct {
- Alert *Alert
- // CSRF template.HTML
- User *database.User
- Yield map[string]interface{}
-}
-
-func getErrMessage(err error) string {
- if pErr, ok := err.(PublicError); ok {
- return pErr.Public()
- }
-
- return AlertMsgGeneric
-}
-
-// PutAlert puts an alert in the given data.
-func (d *Data) PutAlert(alert Alert, alertInYield bool) {
- if alertInYield {
- if d.Yield == nil {
- d.Yield = map[string]interface{}{}
- }
- d.Yield["Alert"] = &alert
- } else {
- d.Alert = &alert
- }
-}
-
-// SetAlert sets alert in the given data for given error.
-func (d *Data) SetAlert(err error, alertInYield bool) {
- errC := errors.Cause(err)
-
- var alert Alert
- if pErr, ok := errC.(PublicError); ok {
- alert = Alert{
- Level: AlertLvlError,
- Message: pErr.Public(),
- }
- } else {
- alert = Alert{
- Level: AlertLvlError,
- Message: AlertMsgGeneric,
- }
- }
-
- d.PutAlert(alert, alertInYield)
-}
-
-// AlertError returns a new error alert using the given message.
-func (d *Data) AlertError(msg string) {
- d.Alert = &Alert{
- Level: AlertLvlError,
- Message: msg,
- }
-}
-
-func persistAlert(w http.ResponseWriter, alert Alert) {
- expiresAt := time.Now().Add(5 * time.Minute)
- lvl := http.Cookie{
- Name: "alert_level",
- Value: alert.Level,
- Expires: expiresAt,
- Path: "/",
- HttpOnly: true,
- }
- msg := http.Cookie{
- Name: "alert_message",
- Value: alert.Message,
- Expires: expiresAt,
- Path: "/",
- HttpOnly: true,
- }
- http.SetCookie(w, &lvl)
- http.SetCookie(w, &msg)
-}
-
-func clearAlert(w http.ResponseWriter) {
- lvl := http.Cookie{
- Name: "alert_level",
- Value: "",
- Expires: time.Now(),
- HttpOnly: true,
- }
- msg := http.Cookie{
- Name: "alert_message",
- Value: "",
- Expires: time.Now(),
- HttpOnly: true,
- }
- http.SetCookie(w, &lvl)
- http.SetCookie(w, &msg)
-}
-
-func getAlert(r *http.Request) *Alert {
- lvl, err := r.Cookie("alert_level")
- if err != nil {
- return nil
- }
- msg, err := r.Cookie("alert_message")
- if err != nil {
- return nil
- }
- alert := Alert{
- Level: lvl.Value,
- Message: msg.Value,
- }
- return &alert
-}
-
-// RedirectAlert redirects to a URL after persisting the provided alert data
-// into a cookie so that it can be displayed when the page is rendered.
-func RedirectAlert(w http.ResponseWriter, r *http.Request, urlStr string, code int, alert Alert) {
- persistAlert(w, alert)
- http.Redirect(w, r, urlStr, code)
-}
-
-// PublicError is an error meant to be displayed to the public
-type PublicError interface {
- error
- Public() string
-}
diff --git a/pkg/server/views/embed.go b/pkg/server/views/embed.go
deleted file mode 100644
index 1fcb7d19..00000000
--- a/pkg/server/views/embed.go
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package views
-
-import (
- "embed"
-)
-
-//go:embed templates
-var TemplateFs embed.FS
diff --git a/pkg/server/views/engine.go b/pkg/server/views/engine.go
deleted file mode 100644
index fbad7979..00000000
--- a/pkg/server/views/engine.go
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package views
-
-import (
- "fmt"
- "html/template"
- "io/fs"
-
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/pkg/errors"
-)
-
-// Engine is responsible for instantiating a new View
-type Engine struct {
- filePatterns []string
- fileSystem fs.FS
-}
-
-// NewEngine returns a new Engine
-func NewEngine(filePatterns []string, fileSystem fs.FS) *Engine {
- return &Engine{
- filePatterns: filePatterns,
- fileSystem: fileSystem,
- }
-}
-
-// NewDefaultEngine returns a new default Engine
-func NewDefaultEngine() *Engine {
- patterns := []string{}
-
- patterns = append(patterns, iconFiles())
- patterns = append(patterns, layoutFiles())
- patterns = append(patterns, partialFiles())
-
- return NewEngine(patterns, TemplateFs)
-}
-
-// getTargetFiles returns an array of files needed for rendering
-func (e Engine) getTargetFiles(files []string) []string {
- addTemplatePath(files)
- addTemplateExt(files)
-
- return append(files, e.filePatterns...)
-}
-
-// NewView returns a new view by parsing the given layout and files
-func (e Engine) NewView(app *app.App, viewConfig Config, files ...string) *View {
- viewHelpers := initHelpers(viewConfig, app)
- t := template.New(viewConfig.Title).Funcs(viewHelpers)
-
- targetFiles := e.getTargetFiles(files)
-
- t, err := t.ParseFS(e.fileSystem, targetFiles...)
- if err != nil {
- panic(errors.Wrap(err, "instantiating view"))
- }
-
- return &View{
- Template: t,
- Layout: viewConfig.getLayout(),
- AlertInBody: viewConfig.AlertInBody,
- App: app,
- }
-}
-
-// layoutFiles returns a slice of strings representing
-// the layout files used in our application.
-func layoutFiles() string {
- return fmt.Sprintf("templates/layouts/*%s", TemplateExt)
-}
-
-// iconFiles returns a slice of strings representing
-// the icon files used in our application.
-func iconFiles() string {
- return fmt.Sprintf("templates/icons/*%s", TemplateExt)
-}
-
-func partialFiles() string {
- return fmt.Sprintf("templates/partials/*%s", TemplateExt)
-}
-
-// addTemplatePath takes in a slice of strings
-// representing file paths for templates.
-func addTemplatePath(files []string) {
- for i, f := range files {
- files[i] = fmt.Sprintf("templates/%s", f)
- }
-}
-
-// addTemplateExt takes in a slice of strings
-// representing file paths for templates and it appends
-// the templateExt extension to each string in the slice
-//
-// Eg the input {"home"} would result in the output
-// {"home.gohtml"} if templateExt == ".gohtml"
-func addTemplateExt(files []string) {
- for i, f := range files {
- files[i] = f + TemplateExt
- }
-}
diff --git a/pkg/server/views/helpers.go b/pkg/server/views/helpers.go
deleted file mode 100644
index 3e8f1d56..00000000
--- a/pkg/server/views/helpers.go
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package views
-
-import (
- "fmt"
- "strconv"
- "strings"
- "time"
-
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/buildinfo"
- "github.com/pkg/errors"
- "html/template"
-)
-
-func initHelpers(c Config, a *app.App) template.FuncMap {
- ctx := newViewCtx(c)
-
- ret := template.FuncMap{
- "csrfField": ctx.csrfField,
- "css": ctx.css,
- "js": ctx.js,
- "title": ctx.title,
- "headerTemplate": ctx.headerTemplate,
- "rootURL": ctx.rootURL,
- "getFullMonthName": ctx.getFullMonthName,
- "toDateTime": ctx.toDateTime,
- "excerpt": ctx.excerpt,
- "timeAgo": ctx.timeAgo,
- "timeFormat": ctx.timeFormat,
- "toISOString": ctx.toISOString,
- "dict": ctx.dict,
- "defaultValue": ctx.defaultValue,
- "add": ctx.add,
- "assetBaseURL": func() string {
- return a.AssetBaseURL
- },
- }
-
- // extend with helpers that are defined specific to a view
- if c.HelperFuncs != nil {
- for k, v := range c.HelperFuncs {
- ret[k] = v
- }
- }
-
- return ret
-}
-
-func (v viewCtx) csrfField() (template.HTML, error) {
- return "", errors.New("csrfField is not implemented")
-}
-
-func (v viewCtx) css() []string {
- return strings.Split(buildinfo.CSSFiles, ",")
-}
-
-func (v viewCtx) js() []string {
- return strings.Split(buildinfo.JSFiles, ",")
-}
-
-func (v viewCtx) title() string {
- if v.Config.Title != "" {
- return fmt.Sprintf("%s | %s", v.Config.Title, siteTitle)
- }
-
- return siteTitle
-}
-
-func (v viewCtx) headerTemplate() string {
- return v.Config.HeaderTemplate
-}
-
-func (v viewCtx) toDateTime(year, month int) string {
- sb := strings.Builder{}
-
- sb.WriteString(strconv.Itoa(year))
- sb.WriteString("-")
-
- if month < 10 {
- sb.WriteString("0")
- sb.WriteString(strconv.Itoa(month))
- } else {
- sb.WriteString(strconv.Itoa(month))
- }
-
- return sb.String()
-}
-
-func (v viewCtx) getFullMonthName(month int) string {
- return time.Month(month).String()
-}
-
-func (v viewCtx) rootURL() string {
- return buildinfo.RootURL
-}
-
-func min(a, b int) int {
- if a < b {
- return a
- }
-
- return b
-}
-
-func max(a, b int) int {
- if a > b {
- return a
- }
-
- return b
-}
-
-// excerpt trims the given string up to the last word that makes the string
-// exceed the maxLength, and attaches ellipses at the end. If the string is
-// shorter than the given maxLength, it returns the original string.
-func (v viewCtx) excerpt(s string, maxLength int) string {
- if len(s) < maxLength {
- return s
- }
-
- ret := s[0:maxLength]
- ret = s[0:min(len(ret), max(0, strings.LastIndex(ret, " ")))]
- ret += "..."
-
- return ret
-}
-
-func (v viewCtx) timeFormat(t time.Time, format string) string {
- return t.Format(format)
-}
-
-func (v viewCtx) timeAgo(t time.Time) string {
- now := v.Clock.Now()
- diff := relativeTimeDiff(now, t)
-
- if diff.tense == "past" {
- return fmt.Sprintf("%s ago", diff.text)
- }
-
- if diff.tense == "future" {
- return fmt.Sprintf("in %s", diff.text)
- }
-
- return diff.text
-}
-
-func (v viewCtx) toISOString(t time.Time) string {
- return t.Format(time.RFC3339)
-}
-
-func (v viewCtx) dict(values ...interface{}) (map[string]interface{}, error) {
- if len(values)%2 != 0 {
- return nil, errors.New("invalid dict call")
- }
- dict := make(map[string]interface{}, len(values)/2)
- for i := 0; i < len(values); i += 2 {
- key, ok := values[i].(string)
- if !ok {
- return nil, errors.New("dict keys must be strings")
- }
- dict[key] = values[i+1]
- }
- return dict, nil
-}
-
-func (v viewCtx) defaultValue(value, fallback interface{}) interface{} {
- if value == nil {
- return fallback
- }
-
- return value
-}
-
-func (v viewCtx) add(a, b int) interface{} {
- return a + b
-}
diff --git a/pkg/server/views/helpers_test.go b/pkg/server/views/helpers_test.go
deleted file mode 100644
index af39b48c..00000000
--- a/pkg/server/views/helpers_test.go
+++ /dev/null
@@ -1,198 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package views
-
-import (
- "fmt"
- "testing"
- "time"
-
- "github.com/dnote/dnote/pkg/assert"
-)
-
-func TestToDateTime(t *testing.T) {
- testCases := []struct {
- year int
- month int
- expected string
- }{
- {
- year: 2010,
- month: 10,
- expected: "2010-10",
- },
- {
- year: 2010,
- month: 8,
- expected: "2010-08",
- },
- }
-
- ctx := viewCtx{}
-
- for _, tc := range testCases {
- got := ctx.toDateTime(tc.year, tc.month)
-
- assert.Equal(t, got, tc.expected, "result mismatch")
- }
-}
-
-func TestGetFullMonthName(t *testing.T) {
- testCases := []struct {
- input int
- expected string
- }{
- {
- input: 1,
- expected: "January",
- },
- {
- input: 12,
- expected: "December",
- },
- }
-
- ctx := viewCtx{}
-
- for _, tc := range testCases {
- got := ctx.getFullMonthName(tc.input)
-
- assert.Equal(t, got, tc.expected, "result mismatch")
- }
-}
-
-func TestExcerpt(t *testing.T) {
- testCases := []struct {
- str string
- maxLength int
- expected string
- }{
- {
- str: "hello world",
- maxLength: 5,
- expected: "...",
- },
- {
- str: "hello world",
- maxLength: 1,
- expected: "...",
- },
- {
- str: "hello world",
- maxLength: 7,
- expected: "hello...",
- },
- {
- str: "foo bar baz",
- maxLength: 9,
- expected: "foo bar...",
- },
- {
- str: "foo",
- maxLength: 4,
- expected: "foo",
- },
- }
-
- ctx := viewCtx{}
-
- for idx, tc := range testCases {
- got := ctx.excerpt(tc.str, tc.maxLength)
- assert.Equal(t, got, tc.expected, fmt.Sprintf("result mismatch for case %d", idx))
- }
-}
-
-func TestTimeAgo(t *testing.T) {
- now := time.Now()
-
- testCases := []struct {
- input time.Time
- expected string
- }{
- {
- input: now.Add(-2 * time.Hour),
- expected: "2 hours ago",
- },
- {
- input: now.Add(-2*time.Hour - 59*time.Minute),
- expected: "2 hours ago",
- },
- {
- input: now.Add(-23 * time.Hour),
- expected: "23 hours ago",
- },
- {
- input: now.Add(-23*time.Hour - 59*time.Minute),
- expected: "23 hours ago",
- },
- {
- input: now.Add(-24 * time.Hour),
- expected: "1 day ago",
- },
- {
- input: now.Add(-47 * time.Hour),
- expected: "1 day ago",
- },
- {
- input: now.Add(-48 * time.Hour),
- expected: "2 days ago",
- },
-
- {
- input: now.Add(-24 * time.Hour * 7),
- expected: "1 week ago",
- },
- {
- input: now.Add(-24 * time.Hour * 7 * 2),
- expected: "2 weeks ago",
- },
-
- {
- input: now.Add(-24 * time.Hour * 7 * 4),
- expected: "1 month ago",
- },
- {
- input: now.Add(-24 * time.Hour * 7 * 7),
- expected: "1 month ago",
- },
- {
- input: now.Add(-24 * time.Hour * 7 * 8),
- expected: "2 months ago",
- },
-
- {
- input: now.Add(-24 * time.Hour * 7 * 52),
- expected: "1 year ago",
- },
- {
- input: now.Add(-24 * time.Hour * 7 * 55),
- expected: "1 year ago",
- },
- {
- input: now.Add(-24 * time.Hour * 7 * 52 * 2),
- expected: "2 years ago",
- },
- }
-
- ctx := newViewCtx(Config{})
-
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("input %s", tc.input.String()), func(t *testing.T) {
- got := ctx.timeAgo(tc.input)
- assert.Equal(t, got, tc.expected, "result mismatch")
- })
- }
-}
diff --git a/pkg/server/views/templates/icons/lock.gohtml b/pkg/server/views/templates/icons/lock.gohtml
deleted file mode 100644
index f43c202a..00000000
--- a/pkg/server/views/templates/icons/lock.gohtml
+++ /dev/null
@@ -1,10 +0,0 @@
-{{define "lockIcon"}}
-
-
-
-{{end}}
diff --git a/pkg/server/views/templates/icons/logo.gohtml b/pkg/server/views/templates/icons/logo.gohtml
deleted file mode 100644
index fac485e5..00000000
--- a/pkg/server/views/templates/icons/logo.gohtml
+++ /dev/null
@@ -1,14 +0,0 @@
-{{define "logo"}}
-
-
-
-{{end}}
diff --git a/pkg/server/views/templates/icons/logo_with_text.gohtml b/pkg/server/views/templates/icons/logo_with_text.gohtml
deleted file mode 100644
index 7f9d7c66..00000000
--- a/pkg/server/views/templates/icons/logo_with_text.gohtml
+++ /dev/null
@@ -1,26 +0,0 @@
-{{define "logoWithText"}}
-
- Dnote logo
- Dnote logo
-
-
-
-
-
-
-
-
-
-
-{{end}}
diff --git a/pkg/server/views/templates/layouts/alert.gohtml b/pkg/server/views/templates/layouts/alert.gohtml
deleted file mode 100644
index 661753f9..00000000
--- a/pkg/server/views/templates/layouts/alert.gohtml
+++ /dev/null
@@ -1,9 +0,0 @@
-{{define "alert"}}
-{{if .}}
-
-{{end}}
-{{end}}
diff --git a/pkg/server/views/templates/layouts/base.gohtml b/pkg/server/views/templates/layouts/base.gohtml
deleted file mode 100644
index fe6ace0b..00000000
--- a/pkg/server/views/templates/layouts/base.gohtml
+++ /dev/null
@@ -1,40 +0,0 @@
-{{define "base"}}
-
-
-
-
-
- {{ title }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{template "css" .}}
-
-
-
- {{template "header" .}}
-
- {{template "alert" .Alert}}
-
-
- {{template "yield" .Yield}}
-
-
- {{template "js" .}}
-
-
-{{end}}
diff --git a/pkg/server/views/templates/layouts/css.gohtml b/pkg/server/views/templates/layouts/css.gohtml
deleted file mode 100644
index 4d248a56..00000000
--- a/pkg/server/views/templates/layouts/css.gohtml
+++ /dev/null
@@ -1,5 +0,0 @@
-{{define "css"}}
- {{range css}}
-
- {{end}}
-{{end}}
diff --git a/pkg/server/views/templates/layouts/header.gohtml b/pkg/server/views/templates/layouts/header.gohtml
deleted file mode 100644
index 6d8451e7..00000000
--- a/pkg/server/views/templates/layouts/header.gohtml
+++ /dev/null
@@ -1,7 +0,0 @@
-{{define "header"}}
-
-{{if eq headerTemplate "navbar"}}
- {{ template "navbar" . }}
-{{end}}
-
-{{end}}
diff --git a/pkg/server/views/templates/layouts/js.gohtml b/pkg/server/views/templates/layouts/js.gohtml
deleted file mode 100644
index 50b23673..00000000
--- a/pkg/server/views/templates/layouts/js.gohtml
+++ /dev/null
@@ -1,5 +0,0 @@
-{{define "js"}}
- {{range js}}
-
- {{end}}
-{{end}}
diff --git a/pkg/server/views/templates/layouts/navbar.gohtml b/pkg/server/views/templates/layouts/navbar.gohtml
deleted file mode 100644
index b39a1e4e..00000000
--- a/pkg/server/views/templates/layouts/navbar.gohtml
+++ /dev/null
@@ -1,68 +0,0 @@
-{{define "navbar"}}
-
-{{end}}
-
-{{define "accountDropdown"}}
-
-
-
-
-
-
-
-
- Settings
-
-
- {{template "logoutForm"}}
-
-
-
-
-{{end}}
-
-{{define "logoutForm"}}
-
- {{csrfField}}
-
-
-{{end}}
diff --git a/pkg/server/views/templates/partials/settings_sidebar.gohtml b/pkg/server/views/templates/partials/settings_sidebar.gohtml
deleted file mode 100644
index 0d3e5edf..00000000
--- a/pkg/server/views/templates/partials/settings_sidebar.gohtml
+++ /dev/null
@@ -1,23 +0,0 @@
-{{define "settingsSidebar"}}
-
-{{end}}
diff --git a/pkg/server/views/templates/static/not_found.gohtml b/pkg/server/views/templates/static/not_found.gohtml
deleted file mode 100644
index baef1f4a..00000000
--- a/pkg/server/views/templates/static/not_found.gohtml
+++ /dev/null
@@ -1,3 +0,0 @@
-{{define "yield"}}
-Page not found
-{{end}}
diff --git a/pkg/server/views/templates/users/login.gohtml b/pkg/server/views/templates/users/login.gohtml
deleted file mode 100644
index b560f7b6..00000000
--- a/pkg/server/views/templates/users/login.gohtml
+++ /dev/null
@@ -1,76 +0,0 @@
-{{define "yield"}}
-
-
-
- {{template "logo" .}}
-
-
-
Sign in to Dnote
-
-
- {{if .Referrer}}
-
- Please sign in to continue to that page.
-
- {{end}}
-
-
- {{if .Alert}}
-
- {{.Alert.Message}}
-
- {{end}}
-
- {{template "loginForm" .}}
-
-
-
-
-
-
-{{end}}
-
-{{define "loginForm"}}
-
- {{csrfField}}
-
-
-
- Email
-
-
-
-
-
-
- Sign In
-
-{{end}}
diff --git a/pkg/server/views/templates/users/new.gohtml b/pkg/server/views/templates/users/new.gohtml
deleted file mode 100644
index e2d703bb..00000000
--- a/pkg/server/views/templates/users/new.gohtml
+++ /dev/null
@@ -1,86 +0,0 @@
-{{define "yield"}}
-
-
-
- {{template "logo" .}}
-
-
-
Join Dnote
-
-
- {{if .Referrer}}
-
- Please join to continue.
-
- {{end}}
-
-
- {{if .Alert}}
-
- {{.Alert.Message}}
-
- {{end}}
-
- {{template "signupForm" .}}
-
-
-
-
-
-
-{{end}}
-
-{{define "signupForm"}}
-
- {{csrfField}}
-
-
-
-{{end}}
diff --git a/pkg/server/views/templates/users/password_reset.gohtml b/pkg/server/views/templates/users/password_reset.gohtml
deleted file mode 100644
index 6d7201d5..00000000
--- a/pkg/server/views/templates/users/password_reset.gohtml
+++ /dev/null
@@ -1,52 +0,0 @@
-{{define "yield"}}
-
-
-
- {{template "logo" .}}
-
-
Reset Password
-
-
-
- {{if .Alert}}
-
- {{.Alert.Message}}
-
- {{end}}
-
- {{template "passwordResetForm" .}}
-
-
-
-
-
-
-{{end}}
-
-{{define "passwordResetForm"}}
-
- {{csrfField}}
-
-
-
- Enter your email and we will send you a link to reset your password
-
-
-
-
-
- Send password reset email
-
-
-{{end}}
diff --git a/pkg/server/views/templates/users/password_reset_confirm.gohtml b/pkg/server/views/templates/users/password_reset_confirm.gohtml
deleted file mode 100644
index ddbb2ac7..00000000
--- a/pkg/server/views/templates/users/password_reset_confirm.gohtml
+++ /dev/null
@@ -1,66 +0,0 @@
-{{define "yield"}}
-
-
-
- {{template "logo" .}}
-
-
Reset Password
-
-
-
-
- Password must be at least 8 characters long.
-
-
-
- {{if .Alert}}
-
- {{.Alert.Message}}
-
- {{end}}
-
- {{template "passwordResetConfirmForm" .}}
-
-
-
-
-{{end}}
-
-{{define "passwordResetConfirmForm"}}
-
- {{csrfField}}
-
-
-
-
-
-
- Password
-
-
-
-
-
-
- Password confirmation
-
-
-
-
-
- Reset password
-
-
-{{end}}
diff --git a/pkg/server/views/templates/users/settings.gohtml b/pkg/server/views/templates/users/settings.gohtml
deleted file mode 100644
index 9f747b3e..00000000
--- a/pkg/server/views/templates/users/settings.gohtml
+++ /dev/null
@@ -1,180 +0,0 @@
-{{define "yield"}}
-
-
-
-
-
-
- {{template "settingsSidebar" .}}
-
-
-
-
- {{template "emailSection" .}}
- {{template "passwordSection" .}}
-
-
-
-
-
-{{end}}
-
-{{define "emailForm"}}
-
- {{/* prevent browsers from automatically filling the input fields */}}
-
-
-
-
-
- New email
-
-
-
-
-
-
-
- Current password
-
-
-
-
-
-
-
- Update email
-
-
-
-{{end}}
-
-{{define "passwordChangeForm"}}
-
- {{/* prevent browsers from automatically filling the input fields */}}
-
-
-
-
-
- Current password
-
-
-
-
-
-
- New Password
-
-
-
-
-
-
- New Password Confirmation
-
-
-
-
-
-
- Update password
-
-
-
-{{end}}
-
-{{define "emailSection"}}
-
- Email
-
-
-
-
-
Current Email
-
-
-
- {{.Email}}
-
-
-
-
-
-
-
-
- {{template "emailForm" .}}
-
-
-
-{{end}}
-
-{{define "passwordSection"}}
-
- Password
-
-
-
-
-
Change Password
-
- Set a unique password to protect your data.
-
-
-
-
-
- {{template "passwordChangeForm" .}}
-
-
-
-{{end}}
\ No newline at end of file
diff --git a/pkg/server/views/templates/users/settings_about.gohtml b/pkg/server/views/templates/users/settings_about.gohtml
deleted file mode 100644
index 3252b9de..00000000
--- a/pkg/server/views/templates/users/settings_about.gohtml
+++ /dev/null
@@ -1,36 +0,0 @@
-{{define "yield"}}
-
-
-
-
-
-
- {{template "settingsSidebar" .}}
-
-
-
-
-
- Software
-
-
-
-
-
Version
-
-
-
- {{.Version}}
-
-
-
-
-
-
-
-
-
-
-{{end}}
diff --git a/pkg/server/views/time.go b/pkg/server/views/time.go
deleted file mode 100644
index 88c71169..00000000
--- a/pkg/server/views/time.go
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package views
-
-import (
- "fmt"
- "time"
-)
-
-type timeDiff struct {
- text string
- tense string
-}
-
-func pluralize(singular string, count int) string {
- var noun string
- if count == 1 {
- noun = singular
- } else {
- noun = singular + "s"
- }
-
- return noun
-}
-
-func abs(num int64) int64 {
- if num < 0 {
- return -num
- }
-
- return num
-}
-
-var (
- DAY = 24 * time.Hour.Milliseconds()
- WEEK = 7 * DAY
-)
-
-func getTimeDiffText(interval int64, noun string) string {
- return fmt.Sprintf("%d %s", interval, pluralize(noun, int(interval)))
-}
-
-func relativeTimeDiff(t1, t2 time.Time) timeDiff {
- diff := t1.Sub(t2)
- ts := abs(diff.Milliseconds())
-
- var tense string
- if diff > 0 {
- tense = "past"
- } else {
- tense = "future"
- }
-
- interval := ts / (52 * WEEK)
- if interval >= 1 {
- return timeDiff{
- text: getTimeDiffText(interval, "year"),
- tense: tense,
- }
- }
-
- interval = ts / (4 * WEEK)
- if interval >= 1 {
- return timeDiff{
- text: getTimeDiffText(interval, "month"),
- tense: tense,
- }
- }
-
- interval = ts / WEEK
- if interval >= 1 {
- return timeDiff{
- text: getTimeDiffText(interval, "week"),
- tense: tense,
- }
- }
-
- interval = ts / DAY
- if interval >= 1 {
- return timeDiff{
- text: getTimeDiffText(interval, "day"),
- tense: tense,
- }
- }
-
- interval = ts / time.Hour.Milliseconds()
- if interval >= 1 {
- return timeDiff{
- text: getTimeDiffText(interval, "hour"),
- tense: tense,
- }
- }
-
- interval = ts / time.Minute.Milliseconds()
- if interval >= 1 {
- return timeDiff{
- text: getTimeDiffText(interval, "minute"),
- tense: tense,
- }
- }
-
- return timeDiff{
- text: "Just now",
- }
-}
diff --git a/pkg/server/views/view.go b/pkg/server/views/view.go
deleted file mode 100644
index 53315334..00000000
--- a/pkg/server/views/view.go
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright 2025 Dnote Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package views
-
-import (
- "bytes"
- "fmt"
- "html/template"
- "io"
- "net/http"
-
- "github.com/dnote/dnote/pkg/clock"
- "github.com/dnote/dnote/pkg/server/app"
- "github.com/dnote/dnote/pkg/server/buildinfo"
- "github.com/dnote/dnote/pkg/server/context"
- "github.com/dnote/dnote/pkg/server/log"
- "github.com/gorilla/csrf"
-)
-
-const (
- // TemplateExt is the template extension
- TemplateExt string = ".gohtml"
-)
-
-const (
- siteTitle = "Dnote"
-)
-
-// Config is a view config
-type Config struct {
- Title string
- Layout string
- HeaderTemplate string
- HelperFuncs map[string]interface{}
- AlertInBody bool
- Clock clock.Clock
-}
-
-type viewCtx struct {
- Clock clock.Clock
- Config Config
-}
-
-func newViewCtx(c Config) viewCtx {
- return viewCtx{
- Clock: c.getClock(),
- Config: c,
- }
-}
-
-func (c Config) getLayout() string {
- if c.Layout == "" {
- return "base"
- }
-
- return c.Layout
-}
-
-func (c Config) getClock() clock.Clock {
- if c.Clock != nil {
- return c.Clock
- }
-
- return clock.New()
-}
-
-// View holds the information about a view
-type View struct {
- Template *template.Template
- Layout string
- // AlertInBody specifies if alert should be set in the body instead of the header
- AlertInBody bool
- App *app.App
-}
-
-func (v *View) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- v.Render(w, r, nil, http.StatusOK)
-}
-
-// Render is used to render the view with the predefined layout
-func (v *View) Render(w http.ResponseWriter, r *http.Request, data *Data, statusCode int) {
- w.Header().Set("Content-Type", "text/html")
-
- var vd Data
- if data != nil {
- vd = *data
- }
-
- if alert := getAlert(r); alert != nil {
- vd.PutAlert(*alert, v.AlertInBody)
- clearAlert(w)
- }
-
- vd.User = context.User(r.Context())
-
- // Put user data in Yield
- if vd.Yield == nil {
- vd.Yield = map[string]interface{}{}
- }
- if vd.User != nil {
- vd.Yield["Email"] = vd.User.Email.String
- }
- vd.Yield["CurrentPath"] = r.URL.Path
- vd.Yield["Standalone"] = buildinfo.Standalone
-
- var buf bytes.Buffer
- csrfField := csrf.TemplateField(r)
- tpl := v.Template.Funcs(template.FuncMap{
- "csrfField": func() template.HTML {
- return csrfField
- },
- })
-
- if err := tpl.ExecuteTemplate(&buf, v.Layout, vd); err != nil {
- log.ErrorWrap(err, fmt.Sprintf("executing template for URI '%s'", r.RequestURI))
- w.WriteHeader(http.StatusInternalServerError)
- w.Write(v.App.HTTP500Page)
- return
- }
-
- w.WriteHeader(statusCode)
- io.Copy(w, &buf)
-}
diff --git a/pkg/server/web/handlers.go b/pkg/server/web/handlers.go
new file mode 100644
index 00000000..870408a8
--- /dev/null
+++ b/pkg/server/web/handlers.go
@@ -0,0 +1,141 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// Package web provides handlers for the web application
+package web
+
+import (
+ "net/http"
+
+ "github.com/dnote/dnote/pkg/server/handlers"
+ "github.com/dnote/dnote/pkg/server/tmpl"
+ "github.com/jinzhu/gorm"
+ "github.com/pkg/errors"
+)
+
+var (
+ // ErrEmptyDatabase is an error for missing db in the context
+ ErrEmptyDatabase = errors.New("No DB was provided")
+ // ErrEmptyIndexHTML is an error for missing index.html content in the context
+ ErrEmptyIndexHTML = errors.New("No index.html content was provided")
+ // ErrEmptyRobotsTxt is an error for missing robots.txt content in the context
+ ErrEmptyRobotsTxt = errors.New("No robots.txt content was provided")
+ // ErrEmptyServiceWorkerJS is an error for missing service worker content in the context
+ ErrEmptyServiceWorkerJS = errors.New("No service-worker.js content was provided")
+ // ErrEmptyStaticFileSystem is an error for missing static filesystem in the context
+ ErrEmptyStaticFileSystem = errors.New("No static filesystem was provided")
+)
+
+// Context contains contents of web assets
+type Context struct {
+ DB *gorm.DB
+ IndexHTML []byte
+ RobotsTxt []byte
+ ServiceWorkerJs []byte
+ StaticFileSystem http.FileSystem
+}
+
+// Handlers are a group of web handlers
+type Handlers struct {
+ GetRoot http.HandlerFunc
+ GetRobots http.HandlerFunc
+ GetServiceWorker http.HandlerFunc
+ GetStatic http.Handler
+}
+
+func validateContext(c Context) error {
+ if c.DB == nil {
+ return ErrEmptyDatabase
+ }
+ if c.IndexHTML == nil {
+ return ErrEmptyIndexHTML
+ }
+ if c.RobotsTxt == nil {
+ return ErrEmptyRobotsTxt
+ }
+ if c.ServiceWorkerJs == nil {
+ return ErrEmptyServiceWorkerJS
+ }
+ if c.StaticFileSystem == nil {
+ return ErrEmptyStaticFileSystem
+ }
+
+ return nil
+}
+
+// Init initializes the handlers
+func Init(c Context) (Handlers, error) {
+ if err := validateContext(c); err != nil {
+ return Handlers{}, errors.Wrap(err, "validating context")
+ }
+
+ return Handlers{
+ GetRoot: getRootHandler(c),
+ GetRobots: getRobotsHandler(c),
+ GetServiceWorker: getSWHandler(c),
+ GetStatic: getStaticHandler(c),
+ }, nil
+}
+
+// getRootHandler returns an HTTP handler that serves the app shell
+func getRootHandler(c Context) http.HandlerFunc {
+ appShell, err := tmpl.NewAppShell(c.DB, c.IndexHTML)
+ if err != nil {
+ panic(errors.Wrap(err, "initializing app shell"))
+ }
+
+ return func(w http.ResponseWriter, r *http.Request) {
+ // index.html must not be cached
+ w.Header().Set("Cache-Control", "no-cache")
+
+ buf, err := appShell.Execute(r)
+ if err != nil {
+ if errors.Cause(err) == tmpl.ErrNotFound {
+ handlers.RespondNotFound(w)
+ } else {
+ handlers.DoError(w, "executing app shell", err, http.StatusInternalServerError)
+ }
+ return
+ }
+
+ w.Write(buf)
+ }
+}
+
+// getRobotsHandler returns an HTTP handler that serves robots.txt
+func getRobotsHandler(c Context) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Cache-Control", "no-cache")
+ w.Write(c.RobotsTxt)
+ }
+}
+
+// getSWHandler returns an HTTP handler that serves service worker
+func getSWHandler(c Context) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Cache-Control", "no-cache")
+ w.Header().Set("Content-Type", "application/javascript")
+ w.Write(c.ServiceWorkerJs)
+ }
+}
+
+// getStaticHandler returns an HTTP handler that serves static files from a filesystem
+func getStaticHandler(c Context) http.Handler {
+ root := c.StaticFileSystem
+ return http.StripPrefix("/static/", http.FileServer(root))
+}
diff --git a/pkg/server/web/handlers_test.go b/pkg/server/web/handlers_test.go
new file mode 100644
index 00000000..897d97b2
--- /dev/null
+++ b/pkg/server/web/handlers_test.go
@@ -0,0 +1,110 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package web
+
+import (
+ "fmt"
+ "net/http"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/assert"
+ "github.com/dnote/dnote/pkg/server/testutils"
+ "github.com/pkg/errors"
+)
+
+func TestInit(t *testing.T) {
+ mockIndexHTML := []byte("")
+ mockRobotsTxt := []byte("Allow: *")
+ mockServiceWorkerJs := []byte("function() {}")
+ mockStaticFileSystem := http.Dir(".")
+
+ testCases := []struct {
+ ctx Context
+ expectedErr error
+ }{
+ {
+ ctx: Context{
+ DB: testutils.DB,
+ IndexHTML: mockIndexHTML,
+ RobotsTxt: mockRobotsTxt,
+ ServiceWorkerJs: mockServiceWorkerJs,
+ StaticFileSystem: mockStaticFileSystem,
+ },
+ expectedErr: nil,
+ },
+ {
+ ctx: Context{
+ DB: nil,
+ IndexHTML: mockIndexHTML,
+ RobotsTxt: mockRobotsTxt,
+ ServiceWorkerJs: mockServiceWorkerJs,
+ StaticFileSystem: mockStaticFileSystem,
+ },
+ expectedErr: ErrEmptyDatabase,
+ },
+ {
+ ctx: Context{
+ DB: testutils.DB,
+ IndexHTML: nil,
+ RobotsTxt: mockRobotsTxt,
+ ServiceWorkerJs: mockServiceWorkerJs,
+ StaticFileSystem: mockStaticFileSystem,
+ },
+ expectedErr: ErrEmptyIndexHTML,
+ },
+ {
+ ctx: Context{
+ DB: testutils.DB,
+ IndexHTML: mockIndexHTML,
+ RobotsTxt: nil,
+ ServiceWorkerJs: mockServiceWorkerJs,
+ StaticFileSystem: mockStaticFileSystem,
+ },
+ expectedErr: ErrEmptyRobotsTxt,
+ },
+ {
+ ctx: Context{
+ DB: testutils.DB,
+ IndexHTML: mockIndexHTML,
+ RobotsTxt: mockRobotsTxt,
+ ServiceWorkerJs: nil,
+ StaticFileSystem: mockStaticFileSystem,
+ },
+ expectedErr: ErrEmptyServiceWorkerJS,
+ },
+ {
+ ctx: Context{
+ DB: testutils.DB,
+ IndexHTML: mockIndexHTML,
+ RobotsTxt: mockRobotsTxt,
+ ServiceWorkerJs: mockServiceWorkerJs,
+ StaticFileSystem: nil,
+ },
+ expectedErr: ErrEmptyStaticFileSystem,
+ },
+ }
+
+ for idx, tc := range testCases {
+ t.Run(fmt.Sprintf("test case %d", idx), func(t *testing.T) {
+ _, err := Init(tc.ctx)
+
+ assert.Equal(t, errors.Cause(err), tc.expectedErr, "error mismatch")
+ })
+ }
+}
diff --git a/pkg/server/web/main_test.go b/pkg/server/web/main_test.go
new file mode 100644
index 00000000..b398db05
--- /dev/null
+++ b/pkg/server/web/main_test.go
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+package web
+
+import (
+ "os"
+ "testing"
+
+ "github.com/dnote/dnote/pkg/server/testutils"
+)
+
+func TestMain(m *testing.M) {
+ testutils.InitTestDB()
+
+ code := m.Run()
+ testutils.ClearData(testutils.DB)
+
+ os.Exit(code)
+}
diff --git a/pkg/watcher/main.go b/pkg/watcher/main.go
index 7509fb90..c03c1073 100644
--- a/pkg/watcher/main.go
+++ b/pkg/watcher/main.go
@@ -1,28 +1,29 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dnote. If not, see .
*/
package main
import (
- "encoding/csv"
"flag"
"log"
"os"
"os/exec"
"os/signal"
- "regexp"
"strings"
"syscall"
"time"
@@ -31,25 +32,7 @@ import (
"github.com/radovskyb/watcher"
)
-// splitCommandParts splits the given commad string at space, except
-// when inside a double quotation mark.
-func splitCommandParts(cmd string) []string {
- re := regexp.MustCompile(`\r?\n`)
- s := re.ReplaceAllString(cmd, " ")
-
- r := csv.NewReader(strings.NewReader(s))
- r.Comma = ' '
-
- fields, err := r.Read()
- if err != nil {
- panic(err)
- }
-
- return fields
-}
-
func command(binary string, args []string, entryPoint string) *exec.Cmd {
- log.Printf("executing command: %s %s", binary, args)
cmd := exec.Command(binary, args...)
// Notice this change.
@@ -69,7 +52,7 @@ func command(binary string, args []string, entryPoint string) *exec.Cmd {
}
func execCmd(task string, watchDir string) *exec.Cmd {
- parts := splitCommandParts(task)
+ parts := strings.Fields(task)
return command(parts[0], parts[1:], watchDir)
}
diff --git a/scripts/cli/build.sh b/scripts/cli/build.sh
index d17cb477..ee010751 100755
--- a/scripts/cli/build.sh
+++ b/scripts/cli/build.sh
@@ -19,6 +19,11 @@ projectDir="$dir/../.."
basedir="$projectDir/pkg/cli"
outputDir="$projectDir/build/cli"
+# xgo has issues when using modules
+# https://github.com/karalabe/xgo/issues/176
+# bypass it by copying the project inside a GOPATH
+goPathBasedir="$GOPATH/src/github.com/dnote/dnote"
+
command_exists () {
command -v "$1" >/dev/null 2>&1;
}
@@ -36,7 +41,7 @@ if [[ $1 == v* ]]; then
exit 1
fi
-goVersion=go-1.25.x
+goVersion=1.13.x
get_binary_name() {
platform=$1
@@ -57,11 +62,9 @@ build() {
# build binary
destDir="$outputDir/$platform-$arch"
- ldflags="-X main.apiEndpoint=https://localhost:3001/api -X main.versionTag=$version"
+ ldflags="-X main.apiEndpoint=https://api.getdnote.com -X main.versionTag=$version"
tags="fts5"
- pushd "$projectDir"
-
mkdir -p "$destDir"
if [ "$native" == true ]; then
@@ -72,33 +75,25 @@ build() {
-o="$destDir/cli-$platform-$arch" \
"$basedir"
else
- flags=()
- if [ "$platform" == "windows" ]; then
- flags+=("-buildmode=exe")
- fi
-
xgo \
-go "$goVersion" \
- -targets="$platform/$arch" \
+ --targets="$platform/$arch" \
-ldflags "$ldflags" \
- -dest="$destDir" \
- -out="cli" \
- "${flags[@]}" \
- -tags "$tags" \
- -pkg pkg/cli \
- .
+ --tags "$tags" \
+ --dest="$destDir" \
+ -x \
+ -v \
+ "$goPathBasedir/pkg/cli"
fi
- popd
-
binaryName=$(get_binary_name "$platform")
- mv "$destDir/cli-"* "$destDir/$binaryName"
+ mv "$destDir/cli-${platform}-"* "$destDir/$binaryName"
# build tarball
tarballName="dnote_${version}_${platform}_${arch}.tar.gz"
tarballPath="$outputDir/$tarballName"
- cp "$projectDir/LICENSE" "$destDir"
+ cp "$projectDir/licenses/GPLv3.txt" "$destDir"
cp "$basedir/README.md" "$destDir"
tar -C "$destDir" -zcvf "$tarballPath" "."
rm -rf "$destDir"
@@ -110,23 +105,16 @@ build() {
}
if [ -z "$GOOS" ] && [ -z "$GOARCH" ]; then
- # install the tool
- go install src.techknowlogick.com/xgo@latest
+ # fetch tool
+ go get -u github.com/dnote/xgo
+
+ rm -rf "$GOPATH/src/github.com/dnote/dnote"
+ cp -R "$projectDir" "$goPathBasedir"
- # Linux
build linux amd64
build linux arm64
- build linux arm
-
- # macOS
build darwin amd64
- build darwin arm64
-
- # Windows
build windows amd64
-
- # FreeBSD
- build freebsd amd64
else
build "$GOOS" "$GOARCH" true
fi
diff --git a/scripts/cli/dev.sh b/scripts/cli/dev.sh
index d4a23e76..ce173496 100755
--- a/scripts/cli/dev.sh
+++ b/scripts/cli/dev.sh
@@ -6,6 +6,6 @@ dir=$(dirname "${BASH_SOURCE[0]}")
sudo rm -rf "$(which dnote)" "$GOPATH/bin/cli"
# change tags to darwin if on macos
-go install -ldflags "-X main.apiEndpoint=http://127.0.0.1:3001/api" --tags "linux fts5" "$dir/../../pkg/cli"
+go install -ldflags "-X main.apiEndpoint=http://127.0.0.1:3000/api" --tags "linux fts5" "$dir/../../pkg/cli"
sudo ln -s "$GOPATH/bin/cli" /usr/local/bin/dnote
diff --git a/scripts/cli/test.sh b/scripts/cli/test.sh
index 42e0ad86..e66db37a 100755
--- a/scripts/cli/test.sh
+++ b/scripts/cli/test.sh
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
-# test.sh runs tests for CLI packages
+# test.sh runs test files sequentially
+# https://stackoverflow.com/questions/23715302/go-how-to-run-tests-for-multiple-packages
set -eux
dir=$(dirname "${BASH_SOURCE[0]}")
@@ -7,5 +8,7 @@ pushd "$dir/../../pkg/cli"
# clear tmp dir in case not properly torn down
rm -rf "./tmp"
-go test ./... --tags "fts5"
+go test -a ./... \
+ -p 1\
+ --tags "fts5"
popd
diff --git a/scripts/e2e/test.sh b/scripts/e2e/test.sh
deleted file mode 100755
index 8713bb89..00000000
--- a/scripts/e2e/test.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-set -eux
-
-dir=$(dirname "${BASH_SOURCE[0]}")
-basePath=$(realpath "$dir/../../")
-
-pushd "$basePath"/pkg/e2e
-go test --tags "fts5" ./... -v -timeout 5m
-popd
diff --git a/scripts/generate-changelog.sh b/scripts/generate-changelog.sh
deleted file mode 100755
index 8f24a8ec..00000000
--- a/scripts/generate-changelog.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-set -e
-
-# Usage: ./generate-changelog.sh
-# Example: ./generate-changelog.sh cli cli-v0.15.2 cli-v0.15.1
-
-COMPONENT=$1
-CURRENT_TAG=$2
-PREV_TAG=$3
-
-if [ -z "$COMPONENT" ] || [ -z "$CURRENT_TAG" ]; then
- echo "Usage: $0 [previous-tag]"
- echo "Example: $0 cli cli-v0.15.2 cli-v0.15.1"
- exit 1
-fi
-
-# Validate that tags match the component
-if [[ ! "$CURRENT_TAG" =~ ^${COMPONENT}- ]]; then
- echo "Error: Current tag '$CURRENT_TAG' doesn't match component '$COMPONENT'"
- echo "Expected tag to start with '${COMPONENT}-'"
- exit 1
-fi
-
-if [ -n "$PREV_TAG" ] && [[ ! "$PREV_TAG" =~ ^${COMPONENT}- ]]; then
- echo "Error: Previous tag '$PREV_TAG' doesn't match component '$COMPONENT'"
- echo "Expected tag to start with '${COMPONENT}-'"
- exit 1
-fi
-
-# Define paths for each component
-# Shared paths that apply to both components
-SHARED_PATHS="pkg/dirs/"
-
-if [ "$COMPONENT" == "cli" ]; then
- FILTER_PATHS="pkg/cli/ cmd/cli/ $SHARED_PATHS"
-elif [ "$COMPONENT" == "server" ]; then
- FILTER_PATHS="pkg/server/ host/ $SHARED_PATHS"
-else
- echo "Unknown component: $COMPONENT"
- echo "Valid components: cli, server"
- exit 1
-fi
-
-# Determine commit range
-if [ -z "$PREV_TAG" ]; then
- echo "Error: No previous tag specified"
- exit 1
-fi
-
-RANGE="$PREV_TAG..$CURRENT_TAG"
-
-# Get all commits that touched the relevant paths
-# Warnings go to stderr (visible in logs), commits go to stdout (captured for file)
-COMMITS=$(
- for path in $FILTER_PATHS; do
- git log --oneline --no-merges --pretty=format:"- %s%n" "$RANGE" -- "$path" 2>&2
- done | sort -u | grep -v "^$"
-)
-
-echo "## What's Changed"
-echo ""
-echo "$COMMITS"
diff --git a/scripts/license.sh b/scripts/license.sh
index 4f7788e4..784270a6 100755
--- a/scripts/license.sh
+++ b/scripts/license.sh
@@ -1,46 +1,78 @@
#!/usr/bin/env bash
set -eux
-function has_license {
- # Check if file already has a copyright notice
- grep -q "Copyright.*Dnote Authors" "$1"
+function remove_notice {
+ sed -i -e '/\/\* Copyright/,/\*\//d' "$1"
+
+ # remove leading newline
+ sed -i '/./,$!d' "$1"
}
function add_notice {
ed "$1" < .
+ */"
+
+agpl="/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/"
dir=$(dirname "${BASH_SOURCE[0]}")
basedir="$dir/.."
pkgPath="$basedir/pkg"
+serverPath="$basedir/pkg/server"
+browserPath="$basedir/browser"
-# Apply license to all source files
-allFiles=$(find "$pkgPath" -type f \( -name "*.go" -o -name "*.js" -o -name "*.ts" -o -name "*.tsx" -o -name "*.scss" -o -name "*.css" \) ! -path "**/vendor/*" ! -path "**/node_modules/*" ! -path "**/dist/*")
+gplFiles=$(find "$pkgPath" "$browserPath" -type f \( -name "*.go" -o -name "*.js" -o -name "*.ts" -o -name "*.tsx" -o -name "*.scss" -o -name "*.css" \) ! -path "**/vendor/*" ! -path "**/node_modules/*" ! -path "$serverPath/*")
-for file in $allFiles; do
- if ! has_license "$file"; then
- add_notice "$file" "$license"
- fi
+for file in $gplFiles; do
+ remove_notice "$file"
+ add_notice "$file" "$gpl"
+done
+
+webPath="$basedir/web"
+jslibPath="$basedir/jslib/src"
+agplFiles=$(find "$serverPath" "$webPath" "$jslibPath" -type f \( -name "*.go" -o -name "*.js" -o -name "*.ts" -o -name "*.tsx" -o -name "*.scss" -o -name "*.css" \) ! -path "**/vendor/*" ! -path "**/node_modules/*" ! -path "**/dist/*")
+
+for file in $agplFiles; do
+ remove_notice "$file"
+ add_notice "$file" "$agpl"
done
diff --git a/scripts/release.sh b/scripts/release.sh
new file mode 100755
index 00000000..c4a7d638
--- /dev/null
+++ b/scripts/release.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+#
+# release.sh releases the tarballs and checksum in the build directory
+# to GitHub and brew. A prerequisite is to build those files using build.sh.
+# use: ./scripts/release.sh cli v0.4.8 path/to/assets
+
+set -euxo pipefail
+
+project=$1
+version=$2
+assetPath=$3
+
+if [ "$project" != "cli" ] && [ "$project" != "server" ]; then
+ echo "unrecognized project '$project'"
+ exit 1
+fi
+if [ -z "$version" ]; then
+ echo "no version specified."
+ exit 1
+fi
+if [[ $version == v* ]]; then
+ echo "do not prefix version with v"
+ exit 1
+fi
+
+# 1. push tag
+version_tag="$project-v$version"
+
+echo "* tagging and pushing the tag"
+git tag -a "$version_tag" -m "Release $version_tag"
+git push --tags
+
+# 2. release on GitHub
+files=("$assetPath"/*)
+file_flags=()
+for file in "${files[@]}"; do
+ file_flags+=("--attach=$file")
+done
+
+# mark as prerelease if version is not in a form of major.minor.patch
+# e.g. 1.0.1-beta.1
+flags=()
+if [[ ! "$version" =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
+ flags+=("--prerelease")
+fi
+
+echo "* creating release"
+set -x
+
+# first message is the title and the following are body in markdown
+hub release create \
+ "${file_flags[@]}" \
+ "${flags[@]}" \
+ --message="$version_tag"\
+ --message="Please see the [CHANGELOG](https://github.com/dnote/dnote/blob/master/CHANGELOG.md)" \
+ "$version_tag"
diff --git a/scripts/server/build.sh b/scripts/server/build.sh
index 09bc16e3..f6a6282e 100755
--- a/scripts/server/build.sh
+++ b/scripts/server/build.sh
@@ -29,35 +29,29 @@ build() {
platform=$1
arch=$2
+ pushd "$basedir"
+
destDir="$outputDir/$platform-$arch"
mkdir -p "$destDir"
# build binary
- moduleName="github.com/dnote/dnote"
- ldflags="-X '$moduleName/pkg/server/buildinfo.CSSFiles=main.css' -X '$moduleName/pkg/server/buildinfo.JSFiles=main.js' -X '$moduleName/pkg/server/buildinfo.Version=$version' -X '$moduleName/pkg/server/buildinfo.Standalone=true'"
- tags="fts5"
+ packr2
- pushd "$projectDir"
+ GOOS="$platform" \
+ GOARCH="$arch" go build \
+ -o "$destDir/dnote-server" \
+ -ldflags "-X main.versionTag=$version" \
+ "$basedir"/*.go
- xgo \
- -go go-1.25.x \
- -targets="$platform/$arch" \
- -ldflags "$ldflags" \
- -dest="$destDir" \
- -out="server" \
- -tags "$tags" \
- -pkg pkg/server \
- .
+ packr2 clean
popd
- mv "$destDir/server-${platform}"* "$destDir/dnote-server"
-
# build tarball
tarballName="dnote_server_${version}_${platform}_${arch}.tar.gz"
tarballPath="$outputDir/$tarballName"
- cp "$projectDir/LICENSE" "$destDir"
+ cp "$projectDir/licenses/AGPLv3.txt" "$destDir"
cp "$basedir/README.md" "$destDir"
tar -C "$destDir" -zcvf "$tarballPath" "."
rm -rf "$destDir"
@@ -69,11 +63,5 @@ build() {
}
-# install the tool
-go install src.techknowlogick.com/xgo@latest
-
build linux amd64
build linux arm64
-build linux arm
-build linux 386
-build freebsd amd64
diff --git a/scripts/server/dev.sh b/scripts/server/dev.sh
deleted file mode 100755
index 3786f270..00000000
--- a/scripts/server/dev.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-# shellcheck disable=SC1090
-# dev.sh builds and starts development environment
-set -eux -o pipefail
-
-dir=$(dirname "${BASH_SOURCE[0]}")
-basePath="$dir/../.."
-serverPath="$basePath/pkg/server"
-
-# Set env
-DBPath=../../dev-server.db
-
-# copy assets
-mkdir -p "$basePath/pkg/server/static"
-cp "$basePath"/pkg/server/assets/static/* "$basePath/pkg/server/static"
-# run asset pipeline in the background
-(cd "$basePath/pkg/server/assets/" && "$basePath/pkg/server/assets/styles/build.sh" true ) &
-(cd "$basePath/pkg/server/assets/" && "$basePath/pkg/server/assets/js/build.sh" true ) &
-
-# run server
-moduleName="github.com/dnote/dnote"
-ldflags="-X '$moduleName/pkg/server/buildinfo.CSSFiles=main.css' -X '$moduleName/pkg/server/buildinfo.JSFiles=main.js' -X '$moduleName/pkg/server/buildinfo.Version=dev' -X '$moduleName/pkg/server/buildinfo.Standalone=true'"
-task="go run -ldflags \"$ldflags\" --tags fts5 main.go start -port 3001"
-
-(
- cd "$basePath/pkg/watcher" && \
- go run main.go \
- --task="$task" \
- --context="$serverPath" \
- "$serverPath"
-)
diff --git a/scripts/server/test-local.sh b/scripts/server/test-local.sh
index 504ef444..9f99e08a 100755
--- a/scripts/server/test-local.sh
+++ b/scripts/server/test-local.sh
@@ -1,8 +1,12 @@
#!/usr/bin/env bash
# shellcheck disable=SC1090
# test-local.sh runs api tests using local setting
-set -ex
+set -eux
dir=$(dirname "${BASH_SOURCE[0]}")
-"$dir/test.sh" "$1"
+set -a
+source "$dir/../../pkg/server/.env.test"
+set +a
+
+"$dir/test.sh"
diff --git a/scripts/server/test.sh b/scripts/server/test.sh
index 10207010..89d51a79 100755
--- a/scripts/server/test.sh
+++ b/scripts/server/test.sh
@@ -1,17 +1,16 @@
#!/usr/bin/env bash
# test.sh runs server tests. It is to be invoked by other scripts that set
# appropriate env vars.
-set -ex
+set -eux
dir=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
pushd "$dir/../../pkg/server"
+emailTemplateDir=$(realpath "$dir/../../pkg/server/mailer/templates/src")
+export DNOTE_TEST_EMAIL_TEMPLATE_DIR="$emailTemplateDir"
+
function run_test {
- if [ -z "$1" ]; then
- go test -tags "fts5" ./... -cover
- else
- go test -tags "fts5" -run "$1" -cover
- fi
+ go test ./... -cover -p 1
}
if [ "${WATCH-false}" == true ]; then
@@ -19,7 +18,7 @@ if [ "${WATCH-false}" == true ]; then
while inotifywait --exclude .swp -e modify -r .; do run_test; done;
set -e
else
- run_test "$1"
+ run_test
fi
popd
diff --git a/scripts/vagrant/bootstrap.sh b/scripts/vagrant/bootstrap.sh
new file mode 100755
index 00000000..a3285254
--- /dev/null
+++ b/scripts/vagrant/bootstrap.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+set -ex
+
+echo "export DNOTE=/go/src/github.com/dnote/dnote" >> /home/vagrant/.bash_profile
+echo "cd /go/src/github.com/dnote/dnote" >> /home/vagrant/.bash_profile
+
+# install dependencies
+(cd /go/src/github.com/dnote/dnote && make install)
+
+# set up database
+sudo -u postgres createdb dnote
+sudo -u postgres createdb dnote_test
+# allow connection from host and allow to connect without password
+sudo sed -i "/port*/a listen_addresses = '*'" /etc/postgresql/11/main/postgresql.conf
+sudo sed -i 's/host.*all.*.all.*md5/# &/' /etc/postgresql/11/main/pg_hba.conf
+sudo sed -i "$ a host all all all trust" /etc/postgresql/11/main/pg_hba.conf
+sudo service postgresql restart
diff --git a/scripts/vagrant/install_go.sh b/scripts/vagrant/install_go.sh
new file mode 100755
index 00000000..8d2fd6f8
--- /dev/null
+++ b/scripts/vagrant/install_go.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# shellcheck disable=SC1091
+set -eux
+
+VERSION=1.13.4
+OS=linux
+ARCH=amd64
+
+tarball=go$VERSION.$OS-$ARCH.tar.gz
+
+wget -q https://dl.google.com/go/"$tarball"
+sudo tar -C /usr/local -xzf "$tarball"
+sudo tar -xf "$tarball"
+
+sudo mkdir -p /go/src
+sudo mkdir -p /go/bin
+sudo mkdir -p /go/pkg
+sudo chown -R vagrant:vagrant /go
+
+GOPATH=/go
+echo "export GOPATH=$GOPATH" >> /home/vagrant/.bash_profile
+echo "export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin" >> /home/vagrant/.bash_profile
+source /home/vagrant/.bash_profile
+
+go version
+go env
diff --git a/scripts/vagrant/install_node.sh b/scripts/vagrant/install_node.sh
new file mode 100755
index 00000000..1233d449
--- /dev/null
+++ b/scripts/vagrant/install_node.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# shellcheck disable=SC1090,SC1091
+set -eux
+
+VERSION=12.16.2
+NVM_VERSION=v0.35.0
+
+# Install nvm
+wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/"$NVM_VERSION"/install.sh | bash
+cat >> /home/vagrant/.bash_profile<< EOF
+export NVM_DIR="\$([ -z "\${XDG_CONFIG_HOME-}" ] && printf %s "\${HOME}/.nvm" || printf %s "\${XDG_CONFIG_HOME}/nvm")"
+[ -s "\$NVM_DIR/nvm.sh" ] && \. "\$NVM_DIR/nvm.sh" # This loads nvm
+EOF
+source /home/vagrant/.bash_profile
+
+# Install a node and alias
+nvm install --no-progress "$VERSION" 1>/dev/null
+nvm alias default "$VERSION"
+nvm use default
diff --git a/scripts/vagrant/install_postgres.sh b/scripts/vagrant/install_postgres.sh
new file mode 100755
index 00000000..bb8d8cfc
--- /dev/null
+++ b/scripts/vagrant/install_postgres.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+set -ex
+
+sudo apt-get install wget ca-certificates
+wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
+
+sudo apt-get update
+sudo apt-get install -y postgresql-11
diff --git a/scripts/vagrant/install_utils.sh b/scripts/vagrant/install_utils.sh
new file mode 100755
index 00000000..1c06d413
--- /dev/null
+++ b/scripts/vagrant/install_utils.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+set -eux
+
+sudo apt-get update
+sudo apt-get install -y htop git wget build-essential inotify-tools
+
+# Install Chrome
+wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add
+echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
+sudo apt-get -y update
+sudo apt-get install -y google-chrome-stable
diff --git a/scripts/web/build-prod.sh b/scripts/web/build-prod.sh
new file mode 100755
index 00000000..7680ed35
--- /dev/null
+++ b/scripts/web/build-prod.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# build.sh builds a production bundle
+set -eux
+
+dir=$(dirname "${BASH_SOURCE[0]}")
+
+basePath="$dir/../.."
+publicPath="$basePath/web/public"
+compiledPath="$basePath/web/compiled"
+
+bundleBaseUrl="/static"
+assetBaseUrl="/static"
+rootUrl=""
+
+BUNDLE_BASE_URL="$bundleBaseUrl" \
+ASSET_BASE_URL="$assetBaseUrl" \
+ROOT_URL="$rootUrl" \
+PUBLIC_PATH="$publicPath" \
+COMPILED_PATH="$compiledPath" \
+STANDALONE=true \
+VERSION="$VERSION" \
+ "$dir/build.sh"
diff --git a/scripts/web/build.sh b/scripts/web/build.sh
new file mode 100755
index 00000000..2c1f24ff
--- /dev/null
+++ b/scripts/web/build.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+# build.sh builds a bundle
+set -ex
+
+dir=$(dirname "${BASH_SOURCE[0]}")
+basePath="$dir/../.."
+standalone=${STANDALONE:-true}
+
+set -u
+rm -rf "$basePath/web/public"
+mkdir -p "$basePath/web/public/static"
+
+pushd "$basePath/web"
+ PUBLIC_PATH="$PUBLIC_PATH" \
+ COMPILED_PATH="$COMPILED_PATH" \
+ ASSET_BASE_URL="$ASSET_BASE_URL" \
+ "$dir/setup.sh"
+
+ OUTPUT_PATH="$COMPILED_PATH" \
+ ROOT_URL="$ROOT_URL" \
+ VERSION="$VERSION" \
+ "$basePath"/web/node_modules/.bin/webpack\
+ --colors\
+ --display-error-details\
+ --env.standalone="$standalone"\
+ --config "$(realpath "$basePath/web/webpack/prod.config.js")"
+
+ NODE_ENV=PRODUCTION \
+ BUNDLE_BASE_URL=$BUNDLE_BASE_URL \
+ ASSET_BASE_URL=$ASSET_BASE_URL \
+ PUBLIC_PATH=$PUBLIC_PATH \
+ COMPILED_PATH=$COMPILED_PATH \
+ node "$dir/placeholder.js"
+
+ cp "$COMPILED_PATH"/*.js "$COMPILED_PATH"/*.css "$PUBLIC_PATH"/static
+
+ # clean up compiled
+ rm -rf "$basePath"/web/compiled/*
+popd
diff --git a/scripts/web/dev.sh b/scripts/web/dev.sh
new file mode 100755
index 00000000..96cfc6f7
--- /dev/null
+++ b/scripts/web/dev.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+# shellcheck disable=SC1090
+# dev.sh builds and starts development environment
+set -eux -o pipefail
+
+# clean up background processes
+function cleanup {
+ kill "$devServerPID"
+}
+trap cleanup EXIT
+
+dir=$(dirname "${BASH_SOURCE[0]}")
+basePath="$dir/../.."
+appPath="$basePath/web"
+serverPath="$basePath/pkg/server"
+serverPort=3000
+
+# load env
+set -a
+dotenvPath="$serverPath/.env.dev"
+source "$dotenvPath"
+set +a
+
+# run webpack-dev-server for js in the background
+(
+ BUNDLE_BASE_URL=http://localhost:8080 \
+ ASSET_BASE_URL=http://localhost:3000/static \
+ ROOT_URL=http://localhost:$serverPort \
+ COMPILED_PATH="$appPath"/compiled \
+ PUBLIC_PATH="$appPath"/public \
+ COMPILED_PATH="$basePath/web/compiled" \
+ STANDALONE=true \
+ VERSION="$VERSION" \
+ WEBPACK_HOST="0.0.0.0" \
+ "$dir/webpack-dev.sh"
+) &
+devServerPID=$!
+
+# run server
+(cd "$basePath/pkg/watcher" && go run main.go --task="go run main.go start -port 3000" --context="$serverPath" "$serverPath")
diff --git a/scripts/web/placeholder.js b/scripts/web/placeholder.js
new file mode 100644
index 00000000..a55ee849
--- /dev/null
+++ b/scripts/web/placeholder.js
@@ -0,0 +1,102 @@
+/* Copyright (C) 2019 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// placeholder.js replaces the placeholders in index.html with real values
+// It is needed to load assets whose paths are not fixed because they change
+// every time they are generated.
+
+const fs = require('fs');
+const path = require('path');
+
+// bundleBaseURL is the base URL from which the application javascript bundle
+// In production, it should be the same as assetBaseURL. It is used for development
+// environment, in which it is configured to be the webpack development server.
+const bundleBaseURL = process.env.BUNDLE_BASE_URL;
+// assetBaseURL is the base URL from which all assets excluding the application
+// bundle is served.
+const assetBaseURL = process.env.ASSET_BASE_URL;
+const publicPath = process.env.PUBLIC_PATH;
+const compiledPath = process.env.COMPILED_PATH;
+
+if (bundleBaseURL === undefined) {
+ throw new Error('No BUNDLE_BASE_URL environment variable found');
+}
+if (assetBaseURL === undefined) {
+ throw new Error('No ASSET_BASE_URL environment variable found');
+}
+if (publicPath === undefined) {
+ throw new Error('No PUBLIC_PATH environment variable found');
+}
+if (compiledPath === undefined) {
+ throw new Error('No COMPILED_PATH environment variable found');
+}
+
+const isProduction = process.env.NODE_ENV === 'PRODUCTION';
+const indexHtmlPath = `${publicPath}/index.html`;
+const assetManifestPath = path.resolve(compiledPath, 'webpack-manifest.json');
+
+let manifest;
+try {
+ // eslint-disable-next-line import/no-dynamic-require,global-require
+ manifest = require(assetManifestPath);
+ // eslint-disable-next-line no-empty
+} catch (e) {
+ if (isProduction) {
+ throw new Error('asset manifest not found');
+ }
+}
+
+function getJSBundleTag() {
+ let jsFilename;
+ if (isProduction) {
+ jsFilename = manifest['app.js'];
+ } else {
+ jsFilename = '/app.js';
+ }
+
+ const jsBundleUrl = `${bundleBaseURL}${jsFilename}`;
+ return ``;
+}
+
+// Replace the placeholders with real values
+fs.readFile(indexHtmlPath, 'utf8', (err, data) => {
+ if (err) {
+ console.log('Error while reading index.html');
+ console.log(err);
+ process.exit(1);
+ }
+
+ const jsBundleTag = getJSBundleTag();
+ let result = data.replace(//g, jsBundleTag);
+ result = result.replace(//g, assetBaseURL);
+
+ if (isProduction) {
+ const cssBundleUrl = `${assetBaseURL}${manifest['app.css']}`;
+ const cssBundleTag = ` `;
+
+ result = result.replace(//g, cssBundleTag);
+ }
+
+ fs.writeFile(indexHtmlPath, result, 'utf8', writeErr => {
+ if (writeErr) {
+ console.log('Error while writing index.html');
+ console.log(writeErr);
+ process.exit(1);
+ }
+ });
+});
diff --git a/scripts/web/setup.sh b/scripts/web/setup.sh
new file mode 100755
index 00000000..54649dbf
--- /dev/null
+++ b/scripts/web/setup.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# setup.sh prepares the directory structure and copies static files
+set -eux -o pipefail
+
+dir=$(dirname "${BASH_SOURCE[0]}")
+basePath="$dir/../.."
+publicPath=$PUBLIC_PATH
+compiledPath=$COMPILED_PATH
+assetBaseUrl=$ASSET_BASE_URL
+
+# prepare directories
+rm -rf "$compiledPath"
+rm -rf "$publicPath"
+mkdir -p "$compiledPath"
+mkdir -p "$publicPath"
+
+# copy the assets and artifacts
+cp -r "$basePath"/web/assets/* "$publicPath"
+
+# populate placeholders
+assetBaseUrlEscaped=$(echo "$assetBaseUrl" | sed -e 's/[\/&]/\\&/g')
+sed -i -e "s/ASSET_BASE_PLACEHOLDER/$assetBaseUrlEscaped/g" "$publicPath"/static/manifest.json
diff --git a/scripts/web/webpack-dev.sh b/scripts/web/webpack-dev.sh
new file mode 100755
index 00000000..7a44bc88
--- /dev/null
+++ b/scripts/web/webpack-dev.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+set -eux
+
+dir=$(dirname "${BASH_SOURCE[0]}")
+basePath="$dir/../.."
+appPath="$basePath/web"
+
+(
+ cd "$appPath" &&
+ PUBLIC_PATH=$PUBLIC_PATH \
+ COMPILED_PATH=$COMPILED_PATH \
+ ASSET_BASE_URL=$ASSET_BASE_URL \
+ "$dir/setup.sh" &&
+
+ BUNDLE_BASE_URL=$BUNDLE_BASE_URL
+ ASSET_BASE_URL=$ASSET_BASE_URL \
+ COMPILED_PATH=$COMPILED_PATH \
+ PUBLIC_PATH=$PUBLIC_PATH \
+ node "$dir/placeholder.js" &&
+
+ ROOT_URL=$ROOT_URL \
+ VERSION="$VERSION" \
+ "$appPath"/node_modules/.bin/webpack-dev-server \
+ --env.standalone="$STANDALONE" \
+ --host "$WEBPACK_HOST" \
+ --config "$appPath"/webpack/dev.config.js
+)
diff --git a/web/.babelrc b/web/.babelrc
new file mode 100644
index 00000000..45c979bd
--- /dev/null
+++ b/web/.babelrc
@@ -0,0 +1,9 @@
+{
+ "presets": [
+ [
+ "@babel/preset-env",
+ ]
+ ],
+ "plugins": [
+ ]
+}
diff --git a/web/.gitignore b/web/.gitignore
new file mode 100644
index 00000000..21a69da5
--- /dev/null
+++ b/web/.gitignore
@@ -0,0 +1,27 @@
+node_modules
+npm-debug.log
+/static/dist
+gin-bin
+/server/api/api
+/server/api/api_prod
+/server/jobs/jobs
+/server/jobs/jobs_prod
+
+.env
+.env.api
+__pycache__
+/dump
+
+app.zip
+/compiled
+
+# Elastic Beanstalk Files
+.elasticbeanstalk/*
+!.elasticbeanstalk/*.cfg.yml
+!.elasticbeanstalk/*.global.yml
+
+/public
+/web
+/vendor
+
+/coverage
diff --git a/web/README.md b/web/README.md
new file mode 100644
index 00000000..f993ad6a
--- /dev/null
+++ b/web/README.md
@@ -0,0 +1,13 @@
+# Dnote web client
+
+The web client for Dnote, built with React.
+
+## scripts
+
+Develop locally
+
+* ./scripts/dev.sh
+
+Build prod bundle
+
+* ./scripts/build-prod.sh
diff --git a/web/assets/index.html b/web/assets/index.html
new file mode 100644
index 00000000..9bc4323f
--- /dev/null
+++ b/web/assets/index.html
@@ -0,0 +1,48 @@
+
+
+
+
+
+ {{ .Title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ .MetaTags }}
+
+
+
+
+ Please enable JavaScript to use Dnote.
+
+
+
+
+
+
+
+
+
+
diff --git a/web/assets/robots.txt b/web/assets/robots.txt
new file mode 100644
index 00000000..c2a49f4f
--- /dev/null
+++ b/web/assets/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Allow: /
diff --git a/web/assets/service-worker.js b/web/assets/service-worker.js
new file mode 100644
index 00000000..365b2a32
--- /dev/null
+++ b/web/assets/service-worker.js
@@ -0,0 +1,48 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+/* eslint-disable no-restricted-globals, func-names, no-var, prefer-template */
+
+self.addEventListener('install', function(event) {
+ var offlineRequest = new Request('static/offline.html');
+
+ event.waitUntil(
+ fetch(offlineRequest).then(function(response) {
+ return caches.open('offline').then(function(cache) {
+ console.log('cached offline page', response.url);
+ return cache.put(offlineRequest, response);
+ });
+ })
+ );
+});
+
+self.addEventListener('fetch', function(event) {
+ var request = event.request;
+ if (request.method === 'GET') {
+ event.respondWith(
+ fetch(request).catch(function(error) {
+ console.error(
+ 'onfetch Failed. Serving cached offline fallback ' + error
+ );
+ return caches.open('offline').then(function(cache) {
+ return cache.match('offline.html');
+ });
+ })
+ );
+ }
+});
diff --git a/web/assets/static/404.html b/web/assets/static/404.html
new file mode 100644
index 00000000..27cfcfbc
--- /dev/null
+++ b/web/assets/static/404.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ Page Not Found | Dnote
+
+
+
+
+ That page does not exist.
+
+ Go to Dnote
+
+
+
+
diff --git a/web/assets/static/500.html b/web/assets/static/500.html
new file mode 100644
index 00000000..6632811e
--- /dev/null
+++ b/web/assets/static/500.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ Server Error | Dnote
+
+
+
+
+ Looks like something went wrong!
+
+ An error happened on the server.
+
+
+
+
diff --git a/pkg/server/assets/static/android-icon-144x144.png b/web/assets/static/android-icon-144x144.png
similarity index 100%
rename from pkg/server/assets/static/android-icon-144x144.png
rename to web/assets/static/android-icon-144x144.png
diff --git a/pkg/server/assets/static/android-icon-192x192.png b/web/assets/static/android-icon-192x192.png
similarity index 100%
rename from pkg/server/assets/static/android-icon-192x192.png
rename to web/assets/static/android-icon-192x192.png
diff --git a/pkg/server/assets/static/android-icon-36x36.png b/web/assets/static/android-icon-36x36.png
similarity index 100%
rename from pkg/server/assets/static/android-icon-36x36.png
rename to web/assets/static/android-icon-36x36.png
diff --git a/pkg/server/assets/static/android-icon-48x48.png b/web/assets/static/android-icon-48x48.png
similarity index 100%
rename from pkg/server/assets/static/android-icon-48x48.png
rename to web/assets/static/android-icon-48x48.png
diff --git a/pkg/server/assets/static/android-icon-72x72.png b/web/assets/static/android-icon-72x72.png
similarity index 100%
rename from pkg/server/assets/static/android-icon-72x72.png
rename to web/assets/static/android-icon-72x72.png
diff --git a/pkg/server/assets/static/android-icon-96x96.png b/web/assets/static/android-icon-96x96.png
similarity index 100%
rename from pkg/server/assets/static/android-icon-96x96.png
rename to web/assets/static/android-icon-96x96.png
diff --git a/pkg/server/assets/static/apple-icon-114x114.png b/web/assets/static/apple-icon-114x114.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-114x114.png
rename to web/assets/static/apple-icon-114x114.png
diff --git a/pkg/server/assets/static/apple-icon-120x120.png b/web/assets/static/apple-icon-120x120.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-120x120.png
rename to web/assets/static/apple-icon-120x120.png
diff --git a/pkg/server/assets/static/apple-icon-144x144.png b/web/assets/static/apple-icon-144x144.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-144x144.png
rename to web/assets/static/apple-icon-144x144.png
diff --git a/pkg/server/assets/static/apple-icon-152x152.png b/web/assets/static/apple-icon-152x152.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-152x152.png
rename to web/assets/static/apple-icon-152x152.png
diff --git a/pkg/server/assets/static/apple-icon-180x180.png b/web/assets/static/apple-icon-180x180.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-180x180.png
rename to web/assets/static/apple-icon-180x180.png
diff --git a/pkg/server/assets/static/apple-icon-57x57.png b/web/assets/static/apple-icon-57x57.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-57x57.png
rename to web/assets/static/apple-icon-57x57.png
diff --git a/pkg/server/assets/static/apple-icon-60x60.png b/web/assets/static/apple-icon-60x60.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-60x60.png
rename to web/assets/static/apple-icon-60x60.png
diff --git a/pkg/server/assets/static/apple-icon-72x72.png b/web/assets/static/apple-icon-72x72.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-72x72.png
rename to web/assets/static/apple-icon-72x72.png
diff --git a/pkg/server/assets/static/apple-icon-76x76.png b/web/assets/static/apple-icon-76x76.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-76x76.png
rename to web/assets/static/apple-icon-76x76.png
diff --git a/pkg/server/assets/static/apple-icon-precomposed.png b/web/assets/static/apple-icon-precomposed.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon-precomposed.png
rename to web/assets/static/apple-icon-precomposed.png
diff --git a/pkg/server/assets/static/apple-icon.png b/web/assets/static/apple-icon.png
similarity index 100%
rename from pkg/server/assets/static/apple-icon.png
rename to web/assets/static/apple-icon.png
diff --git a/pkg/server/assets/static/browserconfig.xml b/web/assets/static/browserconfig.xml
similarity index 100%
rename from pkg/server/assets/static/browserconfig.xml
rename to web/assets/static/browserconfig.xml
diff --git a/pkg/server/assets/static/favicon-16x16.png b/web/assets/static/favicon-16x16.png
similarity index 100%
rename from pkg/server/assets/static/favicon-16x16.png
rename to web/assets/static/favicon-16x16.png
diff --git a/pkg/server/assets/static/favicon-32x32.png b/web/assets/static/favicon-32x32.png
similarity index 100%
rename from pkg/server/assets/static/favicon-32x32.png
rename to web/assets/static/favicon-32x32.png
diff --git a/pkg/server/assets/static/favicon-96x96.png b/web/assets/static/favicon-96x96.png
similarity index 100%
rename from pkg/server/assets/static/favicon-96x96.png
rename to web/assets/static/favicon-96x96.png
diff --git a/pkg/server/assets/static/favicon.ico b/web/assets/static/favicon.ico
similarity index 100%
rename from pkg/server/assets/static/favicon.ico
rename to web/assets/static/favicon.ico
diff --git a/pkg/server/assets/static/logo-512x512.png b/web/assets/static/logo-512x512.png
similarity index 100%
rename from pkg/server/assets/static/logo-512x512.png
rename to web/assets/static/logo-512x512.png
diff --git a/pkg/server/assets/static/manifest.json b/web/assets/static/manifest.json
similarity index 100%
rename from pkg/server/assets/static/manifest.json
rename to web/assets/static/manifest.json
diff --git a/pkg/server/assets/static/ms-icon-144x144.png b/web/assets/static/ms-icon-144x144.png
similarity index 100%
rename from pkg/server/assets/static/ms-icon-144x144.png
rename to web/assets/static/ms-icon-144x144.png
diff --git a/pkg/server/assets/static/ms-icon-150x150.png b/web/assets/static/ms-icon-150x150.png
similarity index 100%
rename from pkg/server/assets/static/ms-icon-150x150.png
rename to web/assets/static/ms-icon-150x150.png
diff --git a/pkg/server/assets/static/ms-icon-310x310.png b/web/assets/static/ms-icon-310x310.png
similarity index 100%
rename from pkg/server/assets/static/ms-icon-310x310.png
rename to web/assets/static/ms-icon-310x310.png
diff --git a/pkg/server/assets/static/ms-icon-70x70.png b/web/assets/static/ms-icon-70x70.png
similarity index 100%
rename from pkg/server/assets/static/ms-icon-70x70.png
rename to web/assets/static/ms-icon-70x70.png
diff --git a/pkg/server/assets/static/offline.html b/web/assets/static/offline.html
similarity index 100%
rename from pkg/server/assets/static/offline.html
rename to web/assets/static/offline.html
diff --git a/web/declrations.d.ts b/web/declrations.d.ts
new file mode 100644
index 00000000..08b5aef0
--- /dev/null
+++ b/web/declrations.d.ts
@@ -0,0 +1,26 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// declaration.d.ts
+declare module '*.scss';
+
+// globals defined by webpack-define-plugin
+declare const __ROOT_URL__: string;
+declare const __CDN_URL__: string;
+declare const __VERSION__: string;
+declare const __STANDALONE__: string;
diff --git a/web/jest.config.js b/web/jest.config.js
new file mode 100644
index 00000000..a9365dee
--- /dev/null
+++ b/web/jest.config.js
@@ -0,0 +1,22 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+module.exports = {
+ preset: 'ts-jest',
+ collectCoverageFrom: ['./src/**/*.ts']
+};
diff --git a/web/package-lock.json b/web/package-lock.json
new file mode 100644
index 00000000..a12252dd
--- /dev/null
+++ b/web/package-lock.json
@@ -0,0 +1,16137 @@
+{
+ "name": "dnote",
+ "version": "1.0.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.1.tgz",
+ "integrity": "sha512-IGhtTmpjGbYzcEDOw7DcQtbQSXcG9ftmAXtWTu9V936vDye4xjjekktFAtgZsWpzTj/X01jocB46mTywm/4SZw==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.1"
+ }
+ },
+ "@babel/compat-data": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.12.7.tgz",
+ "integrity": "sha512-YaxPMGs/XIWtYqrdEOZOCPsVWfEoriXopnsz3/i7apYPXQ3698UFhS6dVT1KN5qOsWmVgw/FOrmQgpRaZayGsw==",
+ "dev": true
+ },
+ "@babel/core": {
+ "version": "7.12.9",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.9.tgz",
+ "integrity": "sha512-gTXYh3M5wb7FRXQy+FErKFAv90BnlOuNn1QkCK2lREoPAjrQCO49+HVSrFoe5uakFAF5eenS75KbO2vQiLrTMQ==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.12.5",
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helpers": "^7.12.5",
+ "@babel/parser": "^7.12.7",
+ "@babel/template": "^7.12.7",
+ "@babel/traverse": "^7.12.9",
+ "@babel/types": "^7.12.7",
+ "convert-source-map": "^1.7.0",
+ "debug": "^4.1.0",
+ "gensync": "^1.0.0-beta.1",
+ "json5": "^2.1.2",
+ "lodash": "^4.17.19",
+ "resolve": "^1.3.2",
+ "semver": "^5.4.1",
+ "source-map": "^0.5.0"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/generator": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz",
+ "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.5",
+ "jsesc": "^2.5.1",
+ "source-map": "^0.5.0"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
+ "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.11.0"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==",
+ "dev": true
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.12.9",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
+ "integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.12.5",
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-split-export-declaration": "^7.11.0",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.19"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ },
+ "json5": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
+ "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ }
+ }
+ },
+ "@babel/generator": {
+ "version": "7.10.2",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.2.tgz",
+ "integrity": "sha512-AxfBNHNu99DTMvlUPlt1h2+Hn7knPpH5ayJ8OqDWSeLld+Fi2AYBTC/IejWDM9Edcii4UzZRCsbUt0WlSDsDsA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.2",
+ "jsesc": "^2.5.1",
+ "lodash": "^4.17.13",
+ "source-map": "^0.5.0"
+ }
+ },
+ "@babel/helper-annotate-as-pure": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz",
+ "integrity": "sha512-XQlqKQP4vXFB7BN8fEEerrmYvHp3fK/rBkRFz9jaJbzK0B1DSfej9Kc7ZzE8Z/OnId1jpJdNAZ3BFQjWG68rcA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-builder-binary-assignment-operator-visitor": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.4.tgz",
+ "integrity": "sha512-L0zGlFrGWZK4PbT8AszSfLTM5sDU1+Az/En9VrdT8/LmEiJt4zXt+Jve9DCAnQcbqDhCI+29y/L93mrDzddCcg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-explode-assignable-expression": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-builder-react-jsx": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.10.4.tgz",
+ "integrity": "sha512-5nPcIZ7+KKDxT1427oBivl9V9YTal7qk0diccnh7RrcgrT/pGFOjgGw1dgryyx1GvHEpXVfoDF6Ak3rTiWh8Rg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-builder-react-jsx-experimental": {
+ "version": "7.12.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx-experimental/-/helper-builder-react-jsx-experimental-7.12.4.tgz",
+ "integrity": "sha512-AjEa0jrQqNk7eDQOo0pTfUOwQBMF+xVqrausQwT9/rTKy0g04ggFNaJpaE09IQMn9yExluigWMJcj0WC7bq+Og==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.10.4",
+ "@babel/helper-module-imports": "^7.12.1",
+ "@babel/types": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-compilation-targets": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.12.5.tgz",
+ "integrity": "sha512-+qH6NrscMolUlzOYngSBMIOQpKUGPPsc61Bu5W10mg84LxZ7cmvnBHzARKbDoFxVvqqAbj6Tg6N7bSrWSPXMyw==",
+ "dev": true,
+ "requires": {
+ "@babel/compat-data": "^7.12.5",
+ "@babel/helper-validator-option": "^7.12.1",
+ "browserslist": "^4.14.5",
+ "semver": "^5.5.0"
+ },
+ "dependencies": {
+ "browserslist": {
+ "version": "4.14.7",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.7.tgz",
+ "integrity": "sha512-BSVRLCeG3Xt/j/1cCGj1019Wbty0H+Yvu2AOuZSuoaUWn3RatbL33Cxk+Q4jRMRAbOm0p7SLravLjpnT6s0vzQ==",
+ "dev": true,
+ "requires": {
+ "caniuse-lite": "^1.0.30001157",
+ "colorette": "^1.2.1",
+ "electron-to-chromium": "^1.3.591",
+ "escalade": "^3.1.1",
+ "node-releases": "^1.1.66"
+ }
+ },
+ "caniuse-lite": {
+ "version": "1.0.30001162",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001162.tgz",
+ "integrity": "sha512-E9FktFxaNnp4ky3ucIGzEXLM+Knzlpuq1oN1sFAU0KeayygabGTmOsndpo8QrL4D9pcThlf4D2pUKaDxPCUmVw==",
+ "dev": true
+ },
+ "electron-to-chromium": {
+ "version": "1.3.610",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.610.tgz",
+ "integrity": "sha512-eFDC+yVQpEhtlapk4CYDPfV9ajF9cEof5TBcO49L1ETO+aYogrKWDmYpZyxBScMNe8Bo/gJamH4amQ4yyvXg4g==",
+ "dev": true
+ },
+ "node-releases": {
+ "version": "1.1.67",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.67.tgz",
+ "integrity": "sha512-V5QF9noGFl3EymEwUYzO+3NTDpGfQB4ve6Qfnzf3UNydMhjQRVPR1DZTuvWiLzaFJYw2fmDwAfnRNEVb64hSIg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/helper-create-class-features-plugin": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.1.tgz",
+ "integrity": "sha512-hkL++rWeta/OVOBTRJc9a5Azh5mt5WgZUGAKMD8JM141YsE08K//bp1unBBieO6rUKkIPyUE0USQ30jAy3Sk1w==",
+ "requires": {
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-member-expression-to-functions": "^7.12.1",
+ "@babel/helper-optimise-call-expression": "^7.10.4",
+ "@babel/helper-replace-supers": "^7.12.1",
+ "@babel/helper-split-export-declaration": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
+ "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
+ "requires": {
+ "@babel/types": "^7.11.0"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw=="
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg=="
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-create-regexp-features-plugin": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.12.7.tgz",
+ "integrity": "sha512-idnutvQPdpbduutvi3JVfEgcVIHooQnhvhx0Nk9isOINOIGYkZea1Pk2JlJRiUnMefrlvr0vkByATBY/mB4vjQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.10.4",
+ "regexpu-core": "^4.7.1"
+ }
+ },
+ "@babel/helper-define-map": {
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz",
+ "integrity": "sha512-fMw4kgFB720aQFXSVaXr79pjjcW5puTCM16+rECJ/plGS+zByelE8l9nCpV1GibxTnFVmUuYG9U8wYfQHdzOEQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/types": "^7.10.5",
+ "lodash": "^4.17.19"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==",
+ "dev": true
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-explode-assignable-expression": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.12.1.tgz",
+ "integrity": "sha512-dmUwH8XmlrUpVqgtZ737tK88v07l840z9j3OEhCLwKTkjlvKpfqXVIZ0wpK3aeOxspwGrf/5AP5qLx4rO3w5rA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.1.tgz",
+ "integrity": "sha512-fcpumwhs3YyZ/ttd5Rz0xn0TpIwVkN7X0V38B9TWNfVF42KEkhkAAuPCQ3oXmtTRtiPJrmZ0TrfS0GKF0eMaRQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.1",
+ "@babel/template": "^7.10.1",
+ "@babel/types": "^7.10.1"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.1.tgz",
+ "integrity": "sha512-F5qdXkYGOQUb0hpRaPoetF9AnsXknKjWMZ+wmsIRsp5ge5sFh4c3h1eH2pRTTuy9KKAA2+TTYomGXAtEL2fQEw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.1"
+ }
+ },
+ "@babel/helper-hoist-variables": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.10.4.tgz",
+ "integrity": "sha512-wljroF5PgCk2juF69kanHVs6vrLwIPNp6DLD+Lrl3hoQ3PpPPikaDRNFA+0t81NOoMt2DL6WW/mdU8k4k6ZzuA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-member-expression-to-functions": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.7.tgz",
+ "integrity": "sha512-DCsuPyeWxeHgh1Dus7APn7iza42i/qXqiFPWyBDdOFtvS581JQePsc1F/nD+fHrcswhLlRc2UpYS1NwERxZhHw==",
+ "requires": {
+ "@babel/types": "^7.12.7"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw=="
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-module-imports": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz",
+ "integrity": "sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.5"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-module-transforms": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz",
+ "integrity": "sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-imports": "^7.12.1",
+ "@babel/helper-replace-supers": "^7.12.1",
+ "@babel/helper-simple-access": "^7.12.1",
+ "@babel/helper-split-export-declaration": "^7.11.0",
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/traverse": "^7.12.1",
+ "@babel/types": "^7.12.1",
+ "lodash": "^4.17.19"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/generator": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz",
+ "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.5",
+ "jsesc": "^2.5.1",
+ "source-map": "^0.5.0"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
+ "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.11.0"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==",
+ "dev": true
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.12.9",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
+ "integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.12.5",
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-split-export-declaration": "^7.11.0",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.19"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-optimise-call-expression": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.7.tgz",
+ "integrity": "sha512-I5xc9oSJ2h59OwyUqjv95HRyzxj53DAubUERgQMrpcCEYQyToeHA+NEcUEsVWB4j53RDeskeBJ0SgRAYHDBckw==",
+ "requires": {
+ "@babel/types": "^7.12.7"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw=="
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.1.tgz",
+ "integrity": "sha512-fvoGeXt0bJc7VMWZGCAEBEMo/HAjW2mP8apF5eXK0wSqwLAVHAISCWRoLMBMUs2kqeaG77jltVqu4Hn8Egl3nA==",
+ "dev": true
+ },
+ "@babel/helper-remap-async-to-generator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.12.1.tgz",
+ "integrity": "sha512-9d0KQCRM8clMPcDwo8SevNs+/9a8yWVVmaE80FGJcEP8N1qToREmWEGnBn8BUlJhYRFz6fqxeRL1sl5Ogsed7A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.10.4",
+ "@babel/helper-wrap-function": "^7.10.4",
+ "@babel/types": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-replace-supers": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz",
+ "integrity": "sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA==",
+ "requires": {
+ "@babel/helper-member-expression-to-functions": "^7.12.1",
+ "@babel/helper-optimise-call-expression": "^7.10.4",
+ "@babel/traverse": "^7.12.5",
+ "@babel/types": "^7.12.5"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/generator": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz",
+ "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==",
+ "requires": {
+ "@babel/types": "^7.12.5",
+ "jsesc": "^2.5.1",
+ "source-map": "^0.5.0"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
+ "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
+ "requires": {
+ "@babel/types": "^7.11.0"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw=="
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg=="
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.12.9",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
+ "integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==",
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.12.5",
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-split-export-declaration": "^7.11.0",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.19"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-simple-access": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz",
+ "integrity": "sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-skip-transparent-expression-wrappers": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.12.1.tgz",
+ "integrity": "sha512-Mf5AUuhG1/OCChOJ/HcADmvcHM42WJockombn8ATJG3OnyiSxBK/Mm5x78BQWvmtXZKHgbjdGL2kin/HOLlZGA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.1.tgz",
+ "integrity": "sha512-UQ1LVBPrYdbchNhLwj6fetj46BcFwfS4NllJo/1aJsT+1dLTEnXJL0qHqtY7gPzF8S2fXBJamf1biAXV3X077g==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.1"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.1.tgz",
+ "integrity": "sha512-5vW/JXLALhczRCWP0PnFDMCJAchlBvM7f4uk/jXritBnIa6E1KmqmtrS3yn1LAnxFBypQ3eneLuXjsnfQsgILw==",
+ "dev": true
+ },
+ "@babel/helper-validator-option": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.1.tgz",
+ "integrity": "sha512-YpJabsXlJVWP0USHjnC/AQDTLlZERbON577YUVO/wLpqyj6HAtVYnWaQaN0iUN+1/tWn3c+uKKXjRut5115Y2A==",
+ "dev": true
+ },
+ "@babel/helper-wrap-function": {
+ "version": "7.12.3",
+ "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.12.3.tgz",
+ "integrity": "sha512-Cvb8IuJDln3rs6tzjW3Y8UeelAOdnpB8xtQ4sme2MSZ9wOxrbThporC0y/EtE16VAtoyEfLM404Xr1e0OOp+ow==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/traverse": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/generator": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz",
+ "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.5",
+ "jsesc": "^2.5.1",
+ "source-map": "^0.5.0"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
+ "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.11.0"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==",
+ "dev": true
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.12.9",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
+ "integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.12.5",
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-split-export-declaration": "^7.11.0",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.19"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/helpers": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.12.5.tgz",
+ "integrity": "sha512-lgKGMQlKqA8meJqKsW6rUnc4MdUk35Ln0ATDqdM1a/UpARODdI4j5Y5lVfUScnSNkJcdCRAaWkspykNoFg9sJA==",
+ "dev": true,
+ "requires": {
+ "@babel/template": "^7.10.4",
+ "@babel/traverse": "^7.12.5",
+ "@babel/types": "^7.12.5"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/generator": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz",
+ "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.12.5",
+ "jsesc": "^2.5.1",
+ "source-map": "^0.5.0"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
+ "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.11.0"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==",
+ "dev": true
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.12.9",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
+ "integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.12.5",
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-split-export-declaration": "^7.11.0",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.19"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/highlight": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.1.tgz",
+ "integrity": "sha512-8rMof+gVP8mxYZApLF/JgNDAkdKa+aJt3ZYxF8z6+j/hpeXL7iMsKCPHa2jNMHu/qqBwzQF4OHNoYi8dMA/rYg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.1",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.10.2",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.2.tgz",
+ "integrity": "sha512-PApSXlNMJyB4JiGVhCOlzKIif+TKFTvu0aQAhnTvfP/z3vVSN6ZypH5bfUNwFXXjRQtUEBNFd2PtmCmG2Py3qQ==",
+ "dev": true
+ },
+ "@babel/plugin-proposal-async-generator-functions": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.1.tgz",
+ "integrity": "sha512-d+/o30tJxFxrA1lhzJqiUcEJdI6jKlNregCv5bASeGf2Q4MXmnwH7viDo7nhx1/ohf09oaH8j1GVYG/e3Yqk6A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-remap-async-to-generator": "^7.12.1",
+ "@babel/plugin-syntax-async-generators": "^7.8.0"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-proposal-class-properties": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.1.tgz",
+ "integrity": "sha512-cKp3dlQsFsEs5CWKnN7BnSHOd0EOW8EKpEjkoz1pO2E5KzIDNV9Ros1b0CnmbVgAGXJubOYVBOGCT1OmJwOI7w==",
+ "requires": {
+ "@babel/helper-create-class-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg=="
+ }
+ }
+ },
+ "@babel/plugin-proposal-dynamic-import": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.12.1.tgz",
+ "integrity": "sha512-a4rhUSZFuq5W8/OO8H7BL5zspjnc1FLd9hlOxIK/f7qG4a0qsqk8uvF/ywgBA8/OmjsapjpvaEOYItfGG1qIvQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-dynamic-import": "^7.8.0"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-proposal-export-namespace-from": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.12.1.tgz",
+ "integrity": "sha512-6CThGf0irEkzujYS5LQcjBx8j/4aQGiVv7J9+2f7pGfxqyKh3WnmVJYW3hdrQjyksErMGBPQrCnHfOtna+WLbw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-export-namespace-from": "^7.8.3"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-proposal-json-strings": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.12.1.tgz",
+ "integrity": "sha512-GoLDUi6U9ZLzlSda2Df++VSqDJg3CG+dR0+iWsv6XRw1rEq+zwt4DirM9yrxW6XWaTpmai1cWJLMfM8qQJf+yw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-json-strings": "^7.8.0"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-proposal-logical-assignment-operators": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.12.1.tgz",
+ "integrity": "sha512-k8ZmVv0JU+4gcUGeCDZOGd0lCIamU/sMtIiX3UWnUc5yzgq6YUGyEolNYD+MLYKfSzgECPcqetVcJP9Afe/aCA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ },
+ "@babel/plugin-syntax-logical-assignment-operators": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz",
+ "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ }
+ }
+ },
+ "@babel/plugin-proposal-nullish-coalescing-operator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.12.1.tgz",
+ "integrity": "sha512-nZY0ESiaQDI1y96+jk6VxMOaL4LPo/QDHBqL+SF3/vl6dHkTwHlOI8L4ZwuRBHgakRBw5zsVylel7QPbbGuYgg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-proposal-numeric-separator": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.12.7.tgz",
+ "integrity": "sha512-8c+uy0qmnRTeukiGsjLGy6uVs/TFjJchGXUeBqlG4VWYOdJWkhhVPdQ3uHwbmalfJwv2JsV0qffXP4asRfL2SQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-numeric-separator": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ },
+ "@babel/plugin-syntax-numeric-separator": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz",
+ "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ }
+ }
+ },
+ "@babel/plugin-proposal-object-rest-spread": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.12.1.tgz",
+ "integrity": "sha512-s6SowJIjzlhx8o7lsFx5zmY4At6CTtDvgNQDdPzkBQucle58A6b/TTeEBYtyDgmcXjUTM+vE8YOGHZzzbc/ioA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-object-rest-spread": "^7.8.0",
+ "@babel/plugin-transform-parameters": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-proposal-optional-catch-binding": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.12.1.tgz",
+ "integrity": "sha512-hFvIjgprh9mMw5v42sJWLI1lzU5L2sznP805zeT6rySVRA0Y18StRhDqhSxlap0oVgItRsB6WSROp4YnJTJz0g==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-optional-catch-binding": "^7.8.0"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-proposal-optional-chaining": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.12.7.tgz",
+ "integrity": "sha512-4ovylXZ0PWmwoOvhU2vhnzVNnm88/Sm9nx7V8BPgMvAzn5zDou3/Awy0EjglyubVHasJj+XCEkr/r1X3P5elCA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1",
+ "@babel/plugin-syntax-optional-chaining": "^7.8.0"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-proposal-private-methods": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.1.tgz",
+ "integrity": "sha512-mwZ1phvH7/NHK6Kf8LP7MYDogGV+DKB1mryFOEwx5EBNQrosvIczzZFTUmWaeujd5xT6G1ELYWUz3CutMhjE1w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-class-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-proposal-unicode-property-regex": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.12.1.tgz",
+ "integrity": "sha512-MYq+l+PvHuw/rKUz1at/vb6nCnQ2gmJBNaM62z0OgH7B2W1D9pvkpYtlti9bGtizNIU1K3zm4bZF9F91efVY0w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-syntax-async-generators": {
+ "version": "7.8.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz",
+ "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-bigint": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz",
+ "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-class-properties": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.10.1.tgz",
+ "integrity": "sha512-Gf2Yx/iRs1JREDtVZ56OrjjgFHCaldpTnuy9BHla10qyVT3YkIIGEtoDWhyop0ksu1GvNjHIoYRBqm3zoR1jyQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.1"
+ }
+ },
+ "@babel/plugin-syntax-dynamic-import": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz",
+ "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-export-namespace-from": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz",
+ "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.3"
+ }
+ },
+ "@babel/plugin-syntax-json-strings": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz",
+ "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-jsx": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.12.1.tgz",
+ "integrity": "sha512-1yRi7yAtB0ETgxdY9ti/p2TivUxJkTdhu/ZbF9MshVGqOx1TdB3b7xCXs49Fupgg50N45KcAsRP/ZqWjs9SRjg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-syntax-logical-assignment-operators": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.1.tgz",
+ "integrity": "sha512-XyHIFa9kdrgJS91CUH+ccPVTnJShr8nLGc5bG2IhGXv5p1Rd+8BleGE5yzIg2Nc1QZAdHDa0Qp4m6066OL96Iw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.1"
+ }
+ },
+ "@babel/plugin-syntax-nullish-coalescing-operator": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz",
+ "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-numeric-separator": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.1.tgz",
+ "integrity": "sha512-uTd0OsHrpe3tH5gRPTxG8Voh99/WCU78vIm5NMRYPAqC8lR4vajt6KkCAknCHrx24vkPdd/05yfdGSB4EIY2mg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.1"
+ }
+ },
+ "@babel/plugin-syntax-object-rest-spread": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz",
+ "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-optional-catch-binding": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz",
+ "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-optional-chaining": {
+ "version": "7.8.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz",
+ "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ }
+ },
+ "@babel/plugin-syntax-top-level-await": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.1.tgz",
+ "integrity": "sha512-i7ooMZFS+a/Om0crxZodrTzNEPJHZrlMVGMTEpFAj6rYY/bKCddB0Dk/YxfPuYXOopuhKk/e1jV6h+WUU9XN3A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-syntax-typescript": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.12.1.tgz",
+ "integrity": "sha512-UZNEcCY+4Dp9yYRCAHrHDU+9ZXLYaY9MgBXSRLkB9WjYFRR6quJBumfVrEkUxrePPBwFcpWfNKXqVRQQtm7mMA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-arrow-functions": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.12.1.tgz",
+ "integrity": "sha512-5QB50qyN44fzzz4/qxDPQMBCTHgxg3n0xRBLJUmBlLoU/sFvxVWGZF/ZUfMVDQuJUKXaBhbupxIzIfZ6Fwk/0A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-async-to-generator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.12.1.tgz",
+ "integrity": "sha512-SDtqoEcarK1DFlRJ1hHRY5HvJUj5kX4qmtpMAm2QnhOlyuMC4TMdCRgW6WXpv93rZeYNeLP22y8Aq2dbcDRM1A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-imports": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-remap-async-to-generator": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-block-scoped-functions": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.12.1.tgz",
+ "integrity": "sha512-5OpxfuYnSgPalRpo8EWGPzIYf0lHBWORCkj5M0oLBwHdlux9Ri36QqGW3/LR13RSVOAoUUMzoPI/jpE4ABcHoA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-block-scoping": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.1.tgz",
+ "integrity": "sha512-zJyAC9sZdE60r1nVQHblcfCj29Dh2Y0DOvlMkcqSo0ckqjiCwNiUezUKw+RjOCwGfpLRwnAeQ2XlLpsnGkvv9w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-classes": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.12.1.tgz",
+ "integrity": "sha512-/74xkA7bVdzQTBeSUhLLJgYIcxw/dpEpCdRDiHgPJ3Mv6uC11UhjpOhl72CgqbBCmt1qtssCyB2xnJm1+PFjog==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.10.4",
+ "@babel/helper-define-map": "^7.10.4",
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-optimise-call-expression": "^7.10.4",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-replace-supers": "^7.12.1",
+ "@babel/helper-split-export-declaration": "^7.10.4",
+ "globals": "^11.1.0"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
+ "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.11.0"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==",
+ "dev": true
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/plugin-transform-computed-properties": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.12.1.tgz",
+ "integrity": "sha512-vVUOYpPWB7BkgUWPo4C44mUQHpTZXakEqFjbv8rQMg7TC6S6ZhGZ3otQcRH6u7+adSlE5i0sp63eMC/XGffrzg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-destructuring": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.12.1.tgz",
+ "integrity": "sha512-fRMYFKuzi/rSiYb2uRLiUENJOKq4Gnl+6qOv5f8z0TZXg3llUwUhsNNwrwaT/6dUhJTzNpBr+CUvEWBtfNY1cw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-dotall-regex": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.12.1.tgz",
+ "integrity": "sha512-B2pXeRKoLszfEW7J4Hg9LoFaWEbr/kzo3teWHmtFCszjRNa/b40f9mfeqZsIDLLt/FjwQ6pz/Gdlwy85xNckBA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-duplicate-keys": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.12.1.tgz",
+ "integrity": "sha512-iRght0T0HztAb/CazveUpUQrZY+aGKKaWXMJ4uf9YJtqxSUe09j3wteztCUDRHs+SRAL7yMuFqUsLoAKKzgXjw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-exponentiation-operator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.12.1.tgz",
+ "integrity": "sha512-7tqwy2bv48q+c1EHbXK0Zx3KXd2RVQp6OC7PbwFNt/dPTAV3Lu5sWtWuAj8owr5wqtWnqHfl2/mJlUmqkChKug==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-builder-binary-assignment-operator-visitor": "^7.10.4",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-for-of": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.12.1.tgz",
+ "integrity": "sha512-Zaeq10naAsuHo7heQvyV0ptj4dlZJwZgNAtBYBnu5nNKJoW62m0zKcIEyVECrUKErkUkg6ajMy4ZfnVZciSBhg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-function-name": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.12.1.tgz",
+ "integrity": "sha512-JF3UgJUILoFrFMEnOJLJkRHSk6LUSXLmEFsA23aR2O5CSLUxbeUX1IZ1YQ7Sn0aXb601Ncwjx73a+FVqgcljVw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.10.4",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
+ "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.10.4",
+ "@babel/template": "^7.10.4",
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
+ "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.10.4"
+ }
+ },
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz",
+ "integrity": "sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg==",
+ "dev": true
+ },
+ "@babel/template": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz",
+ "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/parser": "^7.12.7",
+ "@babel/types": "^7.12.7"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/plugin-transform-literals": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.12.1.tgz",
+ "integrity": "sha512-+PxVGA+2Ag6uGgL0A5f+9rklOnnMccwEBzwYFL3EUaKuiyVnUipyXncFcfjSkbimLrODoqki1U9XxZzTvfN7IQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-member-expression-literals": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.12.1.tgz",
+ "integrity": "sha512-1sxePl6z9ad0gFMB9KqmYofk34flq62aqMt9NqliS/7hPEpURUCMbyHXrMPlo282iY7nAvUB1aQd5mg79UD9Jg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-modules-amd": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.12.1.tgz",
+ "integrity": "sha512-tDW8hMkzad5oDtzsB70HIQQRBiTKrhfgwC/KkJeGsaNFTdWhKNt/BiE8c5yj19XiGyrxpbkOfH87qkNg1YGlOQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "babel-plugin-dynamic-import-node": "^2.3.3"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-modules-commonjs": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.12.1.tgz",
+ "integrity": "sha512-dY789wq6l0uLY8py9c1B48V8mVL5gZh/+PQ5ZPrylPYsnAvnEMjqsUXkuoDVPeVK+0VyGar+D08107LzDQ6pag==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-simple-access": "^7.12.1",
+ "babel-plugin-dynamic-import-node": "^2.3.3"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-modules-systemjs": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.12.1.tgz",
+ "integrity": "sha512-Hn7cVvOavVh8yvW6fLwveFqSnd7rbQN3zJvoPNyNaQSvgfKmDBO9U1YL9+PCXGRlZD9tNdWTy5ACKqMuzyn32Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-hoist-variables": "^7.10.4",
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "babel-plugin-dynamic-import-node": "^2.3.3"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-modules-umd": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.12.1.tgz",
+ "integrity": "sha512-aEIubCS0KHKM0zUos5fIoQm+AZUMt1ZvMpqz0/H5qAQ7vWylr9+PLYurT+Ic7ID/bKLd4q8hDovaG3Zch2uz5Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-named-capturing-groups-regex": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.12.1.tgz",
+ "integrity": "sha512-tB43uQ62RHcoDp9v2Nsf+dSM8sbNodbEicbQNA53zHz8pWUhsgHSJCGpt7daXxRydjb0KnfmB+ChXOv3oADp1Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.12.1"
+ }
+ },
+ "@babel/plugin-transform-new-target": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.12.1.tgz",
+ "integrity": "sha512-+eW/VLcUL5L9IvJH7rT1sT0CzkdUTvPrXC2PXTn/7z7tXLBuKvezYbGdxD5WMRoyvyaujOq2fWoKl869heKjhw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-object-super": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.12.1.tgz",
+ "integrity": "sha512-AvypiGJH9hsquNUn+RXVcBdeE3KHPZexWRdimhuV59cSoOt5kFBmqlByorAeUlGG2CJWd0U+4ZtNKga/TB0cAw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-replace-supers": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-parameters": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.12.1.tgz",
+ "integrity": "sha512-xq9C5EQhdPK23ZeCdMxl8bbRnAgHFrw5EOC3KJUsSylZqdkCaFEXxGSBuTSObOpiiHHNyb82es8M1QYgfQGfNg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-property-literals": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.12.1.tgz",
+ "integrity": "sha512-6MTCR/mZ1MQS+AwZLplX4cEySjCpnIF26ToWo942nqn8hXSm7McaHQNeGx/pt7suI1TWOWMfa/NgBhiqSnX0cQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-react-constant-elements": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.12.1.tgz",
+ "integrity": "sha512-KOHd0tIRLoER+J+8f9DblZDa1fLGPwaaN1DI1TVHuQFOpjHV22C3CUB3obeC4fexHY9nx+fH0hQNvLFFfA1mxA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-react-display-name": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.12.1.tgz",
+ "integrity": "sha512-cAzB+UzBIrekfYxyLlFqf/OagTvHLcVBb5vpouzkYkBclRPraiygVnafvAoipErZLI8ANv8Ecn6E/m5qPXD26w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-react-jsx": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.12.7.tgz",
+ "integrity": "sha512-YFlTi6MEsclFAPIDNZYiCRbneg1MFGao9pPG9uD5htwE0vDbPaMUMeYd6itWjw7K4kro4UbdQf3ljmFl9y48dQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-builder-react-jsx": "^7.10.4",
+ "@babel/helper-builder-react-jsx-experimental": "^7.12.4",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-jsx": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-react-jsx-development": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.12.7.tgz",
+ "integrity": "sha512-Rs3ETtMtR3VLXFeYRChle5SsP/P9Jp/6dsewBQfokDSzKJThlsuFcnzLTDRALiUmTC48ej19YD9uN1mupEeEDg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-builder-react-jsx-experimental": "^7.12.4",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-jsx": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-react-jsx-self": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.12.1.tgz",
+ "integrity": "sha512-FbpL0ieNWiiBB5tCldX17EtXgmzeEZjFrix72rQYeq9X6nUK38HCaxexzVQrZWXanxKJPKVVIU37gFjEQYkPkA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-react-jsx-source": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.12.1.tgz",
+ "integrity": "sha512-keQ5kBfjJNRc6zZN1/nVHCd6LLIHq4aUKcVnvE/2l+ZZROSbqoiGFRtT5t3Is89XJxBQaP7NLZX2jgGHdZvvFQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-react-pure-annotations": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.12.1.tgz",
+ "integrity": "sha512-RqeaHiwZtphSIUZ5I85PEH19LOSzxfuEazoY7/pWASCAIBuATQzpSVD+eT6MebeeZT2F4eSL0u4vw6n4Nm0Mjg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.10.4",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-regenerator": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.12.1.tgz",
+ "integrity": "sha512-gYrHqs5itw6i4PflFX3OdBPMQdPbF4bj2REIUxlMRUFk0/ZOAIpDFuViuxPjUL7YC8UPnf+XG7/utJvqXdPKng==",
+ "dev": true,
+ "requires": {
+ "regenerator-transform": "^0.14.2"
+ }
+ },
+ "@babel/plugin-transform-reserved-words": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.12.1.tgz",
+ "integrity": "sha512-pOnUfhyPKvZpVyBHhSBoX8vfA09b7r00Pmm1sH+29ae2hMTKVmSp4Ztsr8KBKjLjx17H0eJqaRC3bR2iThM54A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-shorthand-properties": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.12.1.tgz",
+ "integrity": "sha512-GFZS3c/MhX1OusqB1MZ1ct2xRzX5ppQh2JU1h2Pnfk88HtFTM+TWQqJNfwkmxtPQtb/s1tk87oENfXJlx7rSDw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-spread": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.12.1.tgz",
+ "integrity": "sha512-vuLp8CP0BE18zVYjsEBZ5xoCecMK6LBMMxYzJnh01rxQRvhNhH1csMMmBfNo5tGpGO+NhdSNW2mzIvBu3K1fng==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-sticky-regex": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.12.7.tgz",
+ "integrity": "sha512-VEiqZL5N/QvDbdjfYQBhruN0HYjSPjC4XkeqW4ny/jNtH9gcbgaqBIXYEZCNnESMAGs0/K/R7oFGMhOyu/eIxg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-template-literals": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.12.1.tgz",
+ "integrity": "sha512-b4Zx3KHi+taXB1dVRBhVJtEPi9h1THCeKmae2qP0YdUHIFhVjtpqqNfxeVAa1xeHVhAy4SbHxEwx5cltAu5apw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-typeof-symbol": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.12.1.tgz",
+ "integrity": "sha512-EPGgpGy+O5Kg5pJFNDKuxt9RdmTgj5sgrus2XVeMp/ZIbOESadgILUbm50SNpghOh3/6yrbsH+NB5+WJTmsA7Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-typescript": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.12.1.tgz",
+ "integrity": "sha512-VrsBByqAIntM+EYMqSm59SiMEf7qkmI9dqMt6RbD/wlwueWmYcI0FFK5Fj47pP6DRZm+3teXjosKlwcZJ5lIMw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-class-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-syntax-typescript": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-unicode-escapes": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.12.1.tgz",
+ "integrity": "sha512-I8gNHJLIc7GdApm7wkVnStWssPNbSRMPtgHdmH3sRM1zopz09UWPS4x5V4n1yz/MIWTVnJ9sp6IkuXdWM4w+2Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/plugin-transform-unicode-regex": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.12.1.tgz",
+ "integrity": "sha512-SqH4ClNngh/zGwHZOOQMTD+e8FGWexILV+ePMyiDJttAWRh5dhDL8rcl5lSgU3Huiq6Zn6pWTMvdPAb21Dwdyg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.12.1",
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/preset-env": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.12.7.tgz",
+ "integrity": "sha512-OnNdfAr1FUQg7ksb7bmbKoby4qFOHw6DKWWUNB9KqnnCldxhxJlP+21dpyaWFmf2h0rTbOkXJtAGevY3XW1eew==",
+ "dev": true,
+ "requires": {
+ "@babel/compat-data": "^7.12.7",
+ "@babel/helper-compilation-targets": "^7.12.5",
+ "@babel/helper-module-imports": "^7.12.5",
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-validator-option": "^7.12.1",
+ "@babel/plugin-proposal-async-generator-functions": "^7.12.1",
+ "@babel/plugin-proposal-class-properties": "^7.12.1",
+ "@babel/plugin-proposal-dynamic-import": "^7.12.1",
+ "@babel/plugin-proposal-export-namespace-from": "^7.12.1",
+ "@babel/plugin-proposal-json-strings": "^7.12.1",
+ "@babel/plugin-proposal-logical-assignment-operators": "^7.12.1",
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
+ "@babel/plugin-proposal-numeric-separator": "^7.12.7",
+ "@babel/plugin-proposal-object-rest-spread": "^7.12.1",
+ "@babel/plugin-proposal-optional-catch-binding": "^7.12.1",
+ "@babel/plugin-proposal-optional-chaining": "^7.12.7",
+ "@babel/plugin-proposal-private-methods": "^7.12.1",
+ "@babel/plugin-proposal-unicode-property-regex": "^7.12.1",
+ "@babel/plugin-syntax-async-generators": "^7.8.0",
+ "@babel/plugin-syntax-class-properties": "^7.12.1",
+ "@babel/plugin-syntax-dynamic-import": "^7.8.0",
+ "@babel/plugin-syntax-export-namespace-from": "^7.8.3",
+ "@babel/plugin-syntax-json-strings": "^7.8.0",
+ "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4",
+ "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0",
+ "@babel/plugin-syntax-numeric-separator": "^7.10.4",
+ "@babel/plugin-syntax-object-rest-spread": "^7.8.0",
+ "@babel/plugin-syntax-optional-catch-binding": "^7.8.0",
+ "@babel/plugin-syntax-optional-chaining": "^7.8.0",
+ "@babel/plugin-syntax-top-level-await": "^7.12.1",
+ "@babel/plugin-transform-arrow-functions": "^7.12.1",
+ "@babel/plugin-transform-async-to-generator": "^7.12.1",
+ "@babel/plugin-transform-block-scoped-functions": "^7.12.1",
+ "@babel/plugin-transform-block-scoping": "^7.12.1",
+ "@babel/plugin-transform-classes": "^7.12.1",
+ "@babel/plugin-transform-computed-properties": "^7.12.1",
+ "@babel/plugin-transform-destructuring": "^7.12.1",
+ "@babel/plugin-transform-dotall-regex": "^7.12.1",
+ "@babel/plugin-transform-duplicate-keys": "^7.12.1",
+ "@babel/plugin-transform-exponentiation-operator": "^7.12.1",
+ "@babel/plugin-transform-for-of": "^7.12.1",
+ "@babel/plugin-transform-function-name": "^7.12.1",
+ "@babel/plugin-transform-literals": "^7.12.1",
+ "@babel/plugin-transform-member-expression-literals": "^7.12.1",
+ "@babel/plugin-transform-modules-amd": "^7.12.1",
+ "@babel/plugin-transform-modules-commonjs": "^7.12.1",
+ "@babel/plugin-transform-modules-systemjs": "^7.12.1",
+ "@babel/plugin-transform-modules-umd": "^7.12.1",
+ "@babel/plugin-transform-named-capturing-groups-regex": "^7.12.1",
+ "@babel/plugin-transform-new-target": "^7.12.1",
+ "@babel/plugin-transform-object-super": "^7.12.1",
+ "@babel/plugin-transform-parameters": "^7.12.1",
+ "@babel/plugin-transform-property-literals": "^7.12.1",
+ "@babel/plugin-transform-regenerator": "^7.12.1",
+ "@babel/plugin-transform-reserved-words": "^7.12.1",
+ "@babel/plugin-transform-shorthand-properties": "^7.12.1",
+ "@babel/plugin-transform-spread": "^7.12.1",
+ "@babel/plugin-transform-sticky-regex": "^7.12.7",
+ "@babel/plugin-transform-template-literals": "^7.12.1",
+ "@babel/plugin-transform-typeof-symbol": "^7.12.1",
+ "@babel/plugin-transform-unicode-escapes": "^7.12.1",
+ "@babel/plugin-transform-unicode-regex": "^7.12.1",
+ "@babel/preset-modules": "^0.1.3",
+ "@babel/types": "^7.12.7",
+ "core-js-compat": "^3.7.0",
+ "semver": "^5.5.0"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/plugin-syntax-class-properties": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.1.tgz",
+ "integrity": "sha512-U40A76x5gTwmESz+qiqssqmeEsKvcSyvtgktrm0uzcARAmM9I1jR221f6Oq+GmHrcD+LvZDag1UTOTe2fL3TeA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-syntax-logical-assignment-operators": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz",
+ "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/plugin-syntax-numeric-separator": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz",
+ "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ }
+ },
+ "@babel/types": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz",
+ "integrity": "sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "lodash": "^4.17.19",
+ "to-fast-properties": "^2.0.0"
+ }
+ }
+ }
+ },
+ "@babel/preset-modules": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.4.tgz",
+ "integrity": "sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/plugin-proposal-unicode-property-regex": "^7.4.4",
+ "@babel/plugin-transform-dotall-regex": "^7.4.4",
+ "@babel/types": "^7.4.4",
+ "esutils": "^2.0.2"
+ }
+ },
+ "@babel/preset-react": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.12.7.tgz",
+ "integrity": "sha512-wKeTdnGUP5AEYCYQIMeXMMwU7j+2opxrG0WzuZfxuuW9nhKvvALBjl67653CWamZJVefuJGI219G591RSldrqQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/plugin-transform-react-display-name": "^7.12.1",
+ "@babel/plugin-transform-react-jsx": "^7.12.7",
+ "@babel/plugin-transform-react-jsx-development": "^7.12.7",
+ "@babel/plugin-transform-react-jsx-self": "^7.12.1",
+ "@babel/plugin-transform-react-jsx-source": "^7.12.1",
+ "@babel/plugin-transform-react-pure-annotations": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/preset-typescript": {
+ "version": "7.12.7",
+ "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.12.7.tgz",
+ "integrity": "sha512-nOoIqIqBmHBSEgBXWR4Dv/XBehtIFcw9PqZw6rFYuKrzsZmOQm3PR5siLBnKZFEsDb03IegG8nSjU/iXXXYRmw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.10.4",
+ "@babel/helper-validator-option": "^7.12.1",
+ "@babel/plugin-transform-typescript": "^7.12.1"
+ },
+ "dependencies": {
+ "@babel/helper-plugin-utils": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
+ "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/register": {
+ "version": "7.12.1",
+ "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.12.1.tgz",
+ "integrity": "sha512-XWcmseMIncOjoydKZnWvWi0/5CUCD+ZYKhRwgYlWOrA8fGZ/FjuLRpqtIhLOVD/fvR1b9DQHtZPn68VvhpYf+Q==",
+ "dev": true,
+ "requires": {
+ "find-cache-dir": "^2.0.0",
+ "lodash": "^4.17.19",
+ "make-dir": "^2.1.0",
+ "pirates": "^4.0.0",
+ "source-map-support": "^0.5.16"
+ }
+ },
+ "@babel/runtime": {
+ "version": "7.9.2",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.2.tgz",
+ "integrity": "sha512-NE2DtOdufG7R5vnfQUTehdTfNycfUANEtCa9PssN9O/xmTzP4E08UI797ixaei6hBEVL9BI/PsdJS5x7mWoB9Q==",
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "@babel/template": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.1.tgz",
+ "integrity": "sha512-OQDg6SqvFSsc9A0ej6SKINWrpJiNonRIniYondK2ViKhB06i3c0s+76XUft71iqBEe9S1OKsHwPAjfHnuvnCig==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.1",
+ "@babel/parser": "^7.10.1",
+ "@babel/types": "^7.10.1"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.10.1",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.1.tgz",
+ "integrity": "sha512-C/cTuXeKt85K+p08jN6vMDz8vSV0vZcI0wmQ36o6mjbuo++kPMdpOYw23W2XH04dbRt9/nMEfA4W3eR21CD+TQ==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.1",
+ "@babel/generator": "^7.10.1",
+ "@babel/helper-function-name": "^7.10.1",
+ "@babel/helper-split-export-declaration": "^7.10.1",
+ "@babel/parser": "^7.10.1",
+ "@babel/types": "^7.10.1",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.13"
+ }
+ },
+ "@babel/types": {
+ "version": "7.10.2",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz",
+ "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.1",
+ "lodash": "^4.17.13",
+ "to-fast-properties": "^2.0.0"
+ }
+ },
+ "@bcoe/v8-coverage": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz",
+ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
+ "dev": true
+ },
+ "@cnakazawa/watch": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz",
+ "integrity": "sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ==",
+ "dev": true,
+ "requires": {
+ "exec-sh": "^0.3.2",
+ "minimist": "^1.2.0"
+ }
+ },
+ "@hot-loader/react-dom": {
+ "version": "16.14.0",
+ "resolved": "https://registry.npmjs.org/@hot-loader/react-dom/-/react-dom-16.14.0.tgz",
+ "integrity": "sha512-EN9czvcLsMYmSDo5yRKZOAq3ZGRlDpad1gPtX0NdMMomJXcPE3yFSeFzE94X/NjOaiSVimB7LuqPYpkWVaIi4Q==",
+ "dev": true,
+ "requires": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1",
+ "prop-types": "^15.6.2",
+ "scheduler": "^0.19.1"
+ }
+ },
+ "@istanbuljs/load-nyc-config": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",
+ "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.3.1",
+ "find-up": "^4.1.0",
+ "get-package-type": "^0.1.0",
+ "js-yaml": "^3.13.1",
+ "resolve-from": "^5.0.0"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^4.1.0"
+ }
+ },
+ "p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.2.0"
+ }
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ },
+ "resolve-from": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
+ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
+ "dev": true
+ }
+ }
+ },
+ "@istanbuljs/schema": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz",
+ "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==",
+ "dev": true
+ },
+ "@jest/console": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/@jest/console/-/console-25.5.0.tgz",
+ "integrity": "sha512-T48kZa6MK1Y6k4b89sexwmSF4YLeZS/Udqg3Jj3jG/cHH+N/sLFCEoXEDMOKugJQ9FxPN1osxIknvKkxt6MKyw==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "chalk": "^3.0.0",
+ "jest-message-util": "^25.5.0",
+ "jest-util": "^25.5.0",
+ "slash": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "@jest/core": {
+ "version": "25.5.4",
+ "resolved": "https://registry.npmjs.org/@jest/core/-/core-25.5.4.tgz",
+ "integrity": "sha512-3uSo7laYxF00Dg/DMgbn4xMJKmDdWvZnf89n8Xj/5/AeQ2dOQmn6b6Hkj/MleyzZWXpwv+WSdYWl4cLsy2JsoA==",
+ "dev": true,
+ "requires": {
+ "@jest/console": "^25.5.0",
+ "@jest/reporters": "^25.5.1",
+ "@jest/test-result": "^25.5.0",
+ "@jest/transform": "^25.5.1",
+ "@jest/types": "^25.5.0",
+ "ansi-escapes": "^4.2.1",
+ "chalk": "^3.0.0",
+ "exit": "^0.1.2",
+ "graceful-fs": "^4.2.4",
+ "jest-changed-files": "^25.5.0",
+ "jest-config": "^25.5.4",
+ "jest-haste-map": "^25.5.1",
+ "jest-message-util": "^25.5.0",
+ "jest-regex-util": "^25.2.6",
+ "jest-resolve": "^25.5.1",
+ "jest-resolve-dependencies": "^25.5.4",
+ "jest-runner": "^25.5.4",
+ "jest-runtime": "^25.5.4",
+ "jest-snapshot": "^25.5.1",
+ "jest-util": "^25.5.0",
+ "jest-validate": "^25.5.0",
+ "jest-watcher": "^25.5.0",
+ "micromatch": "^4.0.2",
+ "p-each-series": "^2.1.0",
+ "realpath-native": "^2.0.0",
+ "rimraf": "^3.0.0",
+ "slash": "^3.0.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "@jest/environment": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-25.5.0.tgz",
+ "integrity": "sha512-U2VXPEqL07E/V7pSZMSQCvV5Ea4lqOlT+0ZFijl/i316cRMHvZ4qC+jBdryd+lmRetjQo0YIQr6cVPNxxK87mA==",
+ "dev": true,
+ "requires": {
+ "@jest/fake-timers": "^25.5.0",
+ "@jest/types": "^25.5.0",
+ "jest-mock": "^25.5.0"
+ }
+ },
+ "@jest/fake-timers": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.5.0.tgz",
+ "integrity": "sha512-9y2+uGnESw/oyOI3eww9yaxdZyHq7XvprfP/eeoCsjqKYts2yRlsHS/SgjPDV8FyMfn2nbMy8YzUk6nyvdLOpQ==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "jest-message-util": "^25.5.0",
+ "jest-mock": "^25.5.0",
+ "jest-util": "^25.5.0",
+ "lolex": "^5.0.0"
+ }
+ },
+ "@jest/globals": {
+ "version": "25.5.2",
+ "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-25.5.2.tgz",
+ "integrity": "sha512-AgAS/Ny7Q2RCIj5kZ+0MuKM1wbF0WMLxbCVl/GOMoCNbODRdJ541IxJ98xnZdVSZXivKpJlNPIWa3QmY0l4CXA==",
+ "dev": true,
+ "requires": {
+ "@jest/environment": "^25.5.0",
+ "@jest/types": "^25.5.0",
+ "expect": "^25.5.0"
+ }
+ },
+ "@jest/reporters": {
+ "version": "25.5.1",
+ "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.5.1.tgz",
+ "integrity": "sha512-3jbd8pPDTuhYJ7vqiHXbSwTJQNavczPs+f1kRprRDxETeE3u6srJ+f0NPuwvOmk+lmunZzPkYWIFZDLHQPkviw==",
+ "dev": true,
+ "requires": {
+ "@bcoe/v8-coverage": "^0.2.3",
+ "@jest/console": "^25.5.0",
+ "@jest/test-result": "^25.5.0",
+ "@jest/transform": "^25.5.1",
+ "@jest/types": "^25.5.0",
+ "chalk": "^3.0.0",
+ "collect-v8-coverage": "^1.0.0",
+ "exit": "^0.1.2",
+ "glob": "^7.1.2",
+ "graceful-fs": "^4.2.4",
+ "istanbul-lib-coverage": "^3.0.0",
+ "istanbul-lib-instrument": "^4.0.0",
+ "istanbul-lib-report": "^3.0.0",
+ "istanbul-lib-source-maps": "^4.0.0",
+ "istanbul-reports": "^3.0.2",
+ "jest-haste-map": "^25.5.1",
+ "jest-resolve": "^25.5.1",
+ "jest-util": "^25.5.0",
+ "jest-worker": "^25.5.0",
+ "node-notifier": "^6.0.0",
+ "slash": "^3.0.0",
+ "source-map": "^0.6.0",
+ "string-length": "^3.1.0",
+ "terminal-link": "^2.0.0",
+ "v8-to-istanbul": "^4.1.3"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "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
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "@jest/source-map": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.5.0.tgz",
+ "integrity": "sha512-eIGx0xN12yVpMcPaVpjXPnn3N30QGJCJQSkEDUt9x1fI1Gdvb07Ml6K5iN2hG7NmMP6FDmtPEssE3z6doOYUwQ==",
+ "dev": true,
+ "requires": {
+ "callsites": "^3.0.0",
+ "graceful-fs": "^4.2.4",
+ "source-map": "^0.6.0"
+ },
+ "dependencies": {
+ "callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "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
+ }
+ }
+ },
+ "@jest/test-result": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.5.0.tgz",
+ "integrity": "sha512-oV+hPJgXN7IQf/fHWkcS99y0smKLU2czLBJ9WA0jHITLst58HpQMtzSYxzaBvYc6U5U6jfoMthqsUlUlbRXs0A==",
+ "dev": true,
+ "requires": {
+ "@jest/console": "^25.5.0",
+ "@jest/types": "^25.5.0",
+ "@types/istanbul-lib-coverage": "^2.0.0",
+ "collect-v8-coverage": "^1.0.0"
+ }
+ },
+ "@jest/test-sequencer": {
+ "version": "25.5.4",
+ "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.5.4.tgz",
+ "integrity": "sha512-pTJGEkSeg1EkCO2YWq6hbFvKNXk8ejqlxiOg1jBNLnWrgXOkdY6UmqZpwGFXNnRt9B8nO1uWMzLLZ4eCmhkPNA==",
+ "dev": true,
+ "requires": {
+ "@jest/test-result": "^25.5.0",
+ "graceful-fs": "^4.2.4",
+ "jest-haste-map": "^25.5.1",
+ "jest-runner": "^25.5.4",
+ "jest-runtime": "^25.5.4"
+ },
+ "dependencies": {
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ }
+ }
+ },
+ "@jest/transform": {
+ "version": "25.5.1",
+ "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.5.1.tgz",
+ "integrity": "sha512-Y8CEoVwXb4QwA6Y/9uDkn0Xfz0finGkieuV0xkdF9UtZGJeLukD5nLkaVrVsODB1ojRWlaoD0AJZpVHCSnJEvg==",
+ "dev": true,
+ "requires": {
+ "@babel/core": "^7.1.0",
+ "@jest/types": "^25.5.0",
+ "babel-plugin-istanbul": "^6.0.0",
+ "chalk": "^3.0.0",
+ "convert-source-map": "^1.4.0",
+ "fast-json-stable-stringify": "^2.0.0",
+ "graceful-fs": "^4.2.4",
+ "jest-haste-map": "^25.5.1",
+ "jest-regex-util": "^25.2.6",
+ "jest-util": "^25.5.0",
+ "micromatch": "^4.0.2",
+ "pirates": "^4.0.1",
+ "realpath-native": "^2.0.0",
+ "slash": "^3.0.0",
+ "source-map": "^0.6.1",
+ "write-file-atomic": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "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
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "@jest/types": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz",
+ "integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==",
+ "dev": true,
+ "requires": {
+ "@types/istanbul-lib-coverage": "^2.0.0",
+ "@types/istanbul-reports": "^1.1.1",
+ "@types/yargs": "^15.0.0",
+ "chalk": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "@sinonjs/commons": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.0.tgz",
+ "integrity": "sha512-wEj54PfsZ5jGSwMX68G8ZXFawcSglQSXqCftWX3ec8MDUzQdHgcKvw97awHbY0efQEL5iKUOAmmVtoYgmrSG4Q==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "@types/babel__core": {
+ "version": "7.1.8",
+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.8.tgz",
+ "integrity": "sha512-KXBiQG2OXvaPWFPDS1rD8yV9vO0OuWIqAEqLsbfX0oU2REN5KuoMnZ1gClWcBhO5I3n6oTVAmrMufOvRqdmFTQ==",
+ "dev": true,
+ "requires": {
+ "@babel/parser": "^7.1.0",
+ "@babel/types": "^7.0.0",
+ "@types/babel__generator": "*",
+ "@types/babel__template": "*",
+ "@types/babel__traverse": "*"
+ }
+ },
+ "@types/babel__generator": {
+ "version": "7.6.1",
+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.1.tgz",
+ "integrity": "sha512-bBKm+2VPJcMRVwNhxKu8W+5/zT7pwNEqeokFOmbvVSqGzFneNxYcEBro9Ac7/N9tlsaPYnZLK8J1LWKkMsLAew==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "@types/babel__template": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.2.tgz",
+ "integrity": "sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg==",
+ "dev": true,
+ "requires": {
+ "@babel/parser": "^7.1.0",
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "@types/babel__traverse": {
+ "version": "7.0.12",
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.12.tgz",
+ "integrity": "sha512-t4CoEokHTfcyfb4hUaF9oOHu9RmmNWnm1CP0YmMqOOfClKascOmvlEM736vlqeScuGvBDsHkf8R2INd4DWreQA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.3.0"
+ }
+ },
+ "@types/classnames": {
+ "version": "2.2.11",
+ "resolved": "https://registry.npmjs.org/@types/classnames/-/classnames-2.2.11.tgz",
+ "integrity": "sha512-2koNhpWm3DgWRp5tpkiJ8JGc1xTn2q0l+jUNUE7oMKXUf5NpI9AIdC4kbjGNFBdHtcxBD18LAksoudAVhFKCjw=="
+ },
+ "@types/color-name": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
+ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
+ "dev": true
+ },
+ "@types/glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-VgNIkxK+j7Nz5P7jvUZlRvhuPSmsEfS03b0alKcq5V/STUKAa3Plemsn5mrQUO7am6OErJ4rhGEGJbACclrtRA==",
+ "dev": true,
+ "requires": {
+ "@types/minimatch": "*",
+ "@types/node": "*"
+ }
+ },
+ "@types/graceful-fs": {
+ "version": "4.1.3",
+ "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.3.tgz",
+ "integrity": "sha512-AiHRaEB50LQg0pZmm659vNBb9f4SJ0qrAnteuzhSeAUcJKxoYgEnprg/83kppCnc2zvtCKbdZry1a5pVY3lOTQ==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "@types/history": {
+ "version": "4.7.8",
+ "resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.8.tgz",
+ "integrity": "sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA=="
+ },
+ "@types/hoist-non-react-statics": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
+ "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==",
+ "requires": {
+ "@types/react": "*",
+ "hoist-non-react-statics": "^3.3.0"
+ }
+ },
+ "@types/istanbul-lib-coverage": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz",
+ "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==",
+ "dev": true
+ },
+ "@types/istanbul-lib-report": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
+ "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==",
+ "dev": true,
+ "requires": {
+ "@types/istanbul-lib-coverage": "*"
+ }
+ },
+ "@types/istanbul-reports": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz",
+ "integrity": "sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw==",
+ "dev": true,
+ "requires": {
+ "@types/istanbul-lib-coverage": "*",
+ "@types/istanbul-lib-report": "*"
+ }
+ },
+ "@types/jest": {
+ "version": "25.2.3",
+ "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.2.3.tgz",
+ "integrity": "sha512-JXc1nK/tXHiDhV55dvfzqtmP4S3sy3T3ouV2tkViZgxY/zeUkcpQcQPGRlgF4KmWzWW5oiWYSZwtCB+2RsE4Fw==",
+ "dev": true,
+ "requires": {
+ "jest-diff": "^25.2.1",
+ "pretty-format": "^25.2.1"
+ }
+ },
+ "@types/json-schema": {
+ "version": "7.0.5",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.5.tgz",
+ "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==",
+ "dev": true
+ },
+ "@types/minimatch": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
+ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
+ "dev": true
+ },
+ "@types/node": {
+ "version": "14.0.13",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.13.tgz",
+ "integrity": "sha512-rouEWBImiRaSJsVA+ITTFM6ZxibuAlTuNOCyxVbwreu6k6+ujs7DfnU9o+PShFhET78pMBl3eH+AGSI5eOTkPA==",
+ "dev": true
+ },
+ "@types/normalize-package-data": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
+ "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==",
+ "dev": true
+ },
+ "@types/prettier": {
+ "version": "1.19.1",
+ "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.19.1.tgz",
+ "integrity": "sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ==",
+ "dev": true
+ },
+ "@types/prop-types": {
+ "version": "15.7.3",
+ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",
+ "integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw=="
+ },
+ "@types/q": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz",
+ "integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==",
+ "dev": true
+ },
+ "@types/react": {
+ "version": "16.14.2",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.2.tgz",
+ "integrity": "sha512-BzzcAlyDxXl2nANlabtT4thtvbbnhee8hMmH/CcJrISDBVcJS1iOsP1f0OAgSdGE0MsY9tqcrb9YoZcOFv9dbQ==",
+ "requires": {
+ "@types/prop-types": "*",
+ "csstype": "^3.0.2"
+ }
+ },
+ "@types/react-dom": {
+ "version": "16.9.10",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.10.tgz",
+ "integrity": "sha512-ItatOrnXDMAYpv6G8UCk2VhbYVTjZT9aorLtA/OzDN9XJ2GKcfam68jutoAcILdRjsRUO8qb7AmyObF77Q8QFw==",
+ "dev": true,
+ "requires": {
+ "@types/react": "^16"
+ }
+ },
+ "@types/react-redux": {
+ "version": "7.1.11",
+ "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.11.tgz",
+ "integrity": "sha512-OjaFlmqy0CRbYKBoaWF84dub3impqnLJUrz4u8PRjDzaa4n1A2cVmjMV81shwXyAD5x767efhA8STFGJz/r1Zg==",
+ "requires": {
+ "@types/hoist-non-react-statics": "^3.3.0",
+ "@types/react": "*",
+ "hoist-non-react-statics": "^3.3.0",
+ "redux": "^4.0.0"
+ }
+ },
+ "@types/react-router": {
+ "version": "5.1.8",
+ "resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-5.1.8.tgz",
+ "integrity": "sha512-HzOyJb+wFmyEhyfp4D4NYrumi+LQgQL/68HvJO+q6XtuHSDvw6Aqov7sCAhjbNq3bUPgPqbdvjXC5HeB2oEAPg==",
+ "requires": {
+ "@types/history": "*",
+ "@types/react": "*"
+ }
+ },
+ "@types/react-router-dom": {
+ "version": "5.1.6",
+ "resolved": "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-5.1.6.tgz",
+ "integrity": "sha512-gjrxYqxz37zWEdMVvQtWPFMFj1dRDb4TGOcgyOfSXTrEXdF92L00WE3C471O3TV/RF1oskcStkXsOU0Ete4s/g==",
+ "requires": {
+ "@types/history": "*",
+ "@types/react": "*",
+ "@types/react-router": "*"
+ }
+ },
+ "@types/stack-utils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
+ "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==",
+ "dev": true
+ },
+ "@types/yargs": {
+ "version": "15.0.5",
+ "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.5.tgz",
+ "integrity": "sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==",
+ "dev": true,
+ "requires": {
+ "@types/yargs-parser": "*"
+ }
+ },
+ "@types/yargs-parser": {
+ "version": "15.0.0",
+ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz",
+ "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==",
+ "dev": true
+ },
+ "@webassemblyjs/ast": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz",
+ "integrity": "sha512-C6wW5L+b7ogSDVqymbkkvuW9kruN//YisMED04xzeBBqjHa2FYnmvOlS6Xj68xWQRgWvI9cIglsjFowH/RJyEA==",
+ "requires": {
+ "@webassemblyjs/helper-module-context": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/wast-parser": "1.9.0"
+ }
+ },
+ "@webassemblyjs/floating-point-hex-parser": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.9.0.tgz",
+ "integrity": "sha512-TG5qcFsS8QB4g4MhrxK5TqfdNe7Ey/7YL/xN+36rRjl/BlGE/NcBvJcqsRgCP6Z92mRE+7N50pRIi8SmKUbcQA=="
+ },
+ "@webassemblyjs/helper-api-error": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.9.0.tgz",
+ "integrity": "sha512-NcMLjoFMXpsASZFxJ5h2HZRcEhDkvnNFOAKneP5RbKRzaWJN36NC4jqQHKwStIhGXu5mUWlUUk7ygdtrO8lbmw=="
+ },
+ "@webassemblyjs/helper-buffer": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.9.0.tgz",
+ "integrity": "sha512-qZol43oqhq6yBPx7YM3m9Bv7WMV9Eevj6kMi6InKOuZxhw+q9hOkvq5e/PpKSiLfyetpaBnogSbNCfBwyB00CA=="
+ },
+ "@webassemblyjs/helper-code-frame": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.9.0.tgz",
+ "integrity": "sha512-ERCYdJBkD9Vu4vtjUYe8LZruWuNIToYq/ME22igL+2vj2dQ2OOujIZr3MEFvfEaqKoVqpsFKAGsRdBSBjrIvZA==",
+ "requires": {
+ "@webassemblyjs/wast-printer": "1.9.0"
+ }
+ },
+ "@webassemblyjs/helper-fsm": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.9.0.tgz",
+ "integrity": "sha512-OPRowhGbshCb5PxJ8LocpdX9Kl0uB4XsAjl6jH/dWKlk/mzsANvhwbiULsaiqT5GZGT9qinTICdj6PLuM5gslw=="
+ },
+ "@webassemblyjs/helper-module-context": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.9.0.tgz",
+ "integrity": "sha512-MJCW8iGC08tMk2enck1aPW+BE5Cw8/7ph/VGZxwyvGbJwjktKkDK7vy7gAmMDx88D7mhDTCNKAW5tED+gZ0W8g==",
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0"
+ }
+ },
+ "@webassemblyjs/helper-wasm-bytecode": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.9.0.tgz",
+ "integrity": "sha512-R7FStIzyNcd7xKxCZH5lE0Bqy+hGTwS3LJjuv1ZVxd9O7eHCedSdrId/hMOd20I+v8wDXEn+bjfKDLzTepoaUw=="
+ },
+ "@webassemblyjs/helper-wasm-section": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.9.0.tgz",
+ "integrity": "sha512-XnMB8l3ek4tvrKUUku+IVaXNHz2YsJyOOmz+MMkZvh8h1uSJpSen6vYnw3IoQ7WwEuAhL8Efjms1ZWjqh2agvw==",
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-buffer": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/wasm-gen": "1.9.0"
+ }
+ },
+ "@webassemblyjs/ieee754": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.9.0.tgz",
+ "integrity": "sha512-dcX8JuYU/gvymzIHc9DgxTzUUTLexWwt8uCTWP3otys596io0L5aW02Gb1RjYpx2+0Jus1h4ZFqjla7umFniTg==",
+ "requires": {
+ "@xtuc/ieee754": "^1.2.0"
+ }
+ },
+ "@webassemblyjs/leb128": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.9.0.tgz",
+ "integrity": "sha512-ENVzM5VwV1ojs9jam6vPys97B/S65YQtv/aanqnU7D8aSoHFX8GyhGg0CMfyKNIHBuAVjy3tlzd5QMMINa7wpw==",
+ "requires": {
+ "@xtuc/long": "4.2.2"
+ }
+ },
+ "@webassemblyjs/utf8": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.9.0.tgz",
+ "integrity": "sha512-GZbQlWtopBTP0u7cHrEx+73yZKrQoBMpwkGEIqlacljhXCkVM1kMQge/Mf+csMJAjEdSwhOyLAS0AoR3AG5P8w=="
+ },
+ "@webassemblyjs/wasm-edit": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.9.0.tgz",
+ "integrity": "sha512-FgHzBm80uwz5M8WKnMTn6j/sVbqilPdQXTWraSjBwFXSYGirpkSWE2R9Qvz9tNiTKQvoKILpCuTjBKzOIm0nxw==",
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-buffer": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/helper-wasm-section": "1.9.0",
+ "@webassemblyjs/wasm-gen": "1.9.0",
+ "@webassemblyjs/wasm-opt": "1.9.0",
+ "@webassemblyjs/wasm-parser": "1.9.0",
+ "@webassemblyjs/wast-printer": "1.9.0"
+ }
+ },
+ "@webassemblyjs/wasm-gen": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.9.0.tgz",
+ "integrity": "sha512-cPE3o44YzOOHvlsb4+E9qSqjc9Qf9Na1OO/BHFy4OI91XDE14MjFN4lTMezzaIWdPqHnsTodGGNP+iRSYfGkjA==",
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/ieee754": "1.9.0",
+ "@webassemblyjs/leb128": "1.9.0",
+ "@webassemblyjs/utf8": "1.9.0"
+ }
+ },
+ "@webassemblyjs/wasm-opt": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.9.0.tgz",
+ "integrity": "sha512-Qkjgm6Anhm+OMbIL0iokO7meajkzQD71ioelnfPEj6r4eOFuqm4YC3VBPqXjFyyNwowzbMD+hizmprP/Fwkl2A==",
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-buffer": "1.9.0",
+ "@webassemblyjs/wasm-gen": "1.9.0",
+ "@webassemblyjs/wasm-parser": "1.9.0"
+ }
+ },
+ "@webassemblyjs/wasm-parser": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.9.0.tgz",
+ "integrity": "sha512-9+wkMowR2AmdSWQzsPEjFU7njh8HTO5MqO8vjwEHuM+AMHioNqSBONRdr0NQQ3dVQrzp0s8lTcYqzUdb7YgELA==",
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-api-error": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/ieee754": "1.9.0",
+ "@webassemblyjs/leb128": "1.9.0",
+ "@webassemblyjs/utf8": "1.9.0"
+ }
+ },
+ "@webassemblyjs/wast-parser": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.9.0.tgz",
+ "integrity": "sha512-qsqSAP3QQ3LyZjNC/0jBJ/ToSxfYJ8kYyuiGvtn/8MK89VrNEfwj7BPQzJVHi0jGTRK2dGdJ5PRqhtjzoww+bw==",
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/floating-point-hex-parser": "1.9.0",
+ "@webassemblyjs/helper-api-error": "1.9.0",
+ "@webassemblyjs/helper-code-frame": "1.9.0",
+ "@webassemblyjs/helper-fsm": "1.9.0",
+ "@xtuc/long": "4.2.2"
+ }
+ },
+ "@webassemblyjs/wast-printer": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.9.0.tgz",
+ "integrity": "sha512-2J0nE95rHXHyQ24cWjMKJ1tqB/ds8z/cyeOZxJhcb+rW+SQASVjuznUSmdz5GpVJTzU8JkhYut0D3siFDD6wsA==",
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/wast-parser": "1.9.0",
+ "@xtuc/long": "4.2.2"
+ }
+ },
+ "@xtuc/ieee754": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
+ "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA=="
+ },
+ "@xtuc/long": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
+ "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
+ },
+ "abab": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz",
+ "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==",
+ "dev": true
+ },
+ "abbrev": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
+ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
+ "dev": true
+ },
+ "accepts": {
+ "version": "1.3.7",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
+ "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
+ "dev": true,
+ "requires": {
+ "mime-types": "~2.1.24",
+ "negotiator": "0.6.2"
+ }
+ },
+ "acorn": {
+ "version": "6.4.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
+ "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA=="
+ },
+ "acorn-globals": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz",
+ "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==",
+ "dev": true,
+ "requires": {
+ "acorn": "^6.0.1",
+ "acorn-walk": "^6.0.1"
+ }
+ },
+ "acorn-walk": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz",
+ "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==",
+ "dev": true
+ },
+ "ajv": {
+ "version": "6.12.2",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz",
+ "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==",
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ajv-errors": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz",
+ "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ=="
+ },
+ "ajv-keywords": {
+ "version": "3.4.1",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz",
+ "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ=="
+ },
+ "alphanum-sort": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz",
+ "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=",
+ "dev": true
+ },
+ "amdefine": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
+ "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
+ "dev": true
+ },
+ "ansi-colors": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz",
+ "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==",
+ "dev": true
+ },
+ "ansi-escapes": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz",
+ "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==",
+ "dev": true,
+ "requires": {
+ "type-fest": "^0.11.0"
+ },
+ "dependencies": {
+ "type-fest": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz",
+ "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==",
+ "dev": true
+ }
+ }
+ },
+ "ansi-html": {
+ "version": "0.0.7",
+ "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz",
+ "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=",
+ "dev": true
+ },
+ "ansi-regex": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
+ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
+ "dev": true
+ },
+ "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==",
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "anymatch": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz",
+ "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==",
+ "requires": {
+ "micromatch": "^3.1.4",
+ "normalize-path": "^2.1.1"
+ },
+ "dependencies": {
+ "normalize-path": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
+ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
+ "requires": {
+ "remove-trailing-separator": "^1.0.1"
+ }
+ }
+ }
+ },
+ "aproba": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
+ "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw=="
+ },
+ "are-we-there-yet": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
+ "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
+ "dev": true,
+ "requires": {
+ "delegates": "^1.0.0",
+ "readable-stream": "^2.0.6"
+ }
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "arr-diff": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
+ "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA="
+ },
+ "arr-flatten": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
+ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg=="
+ },
+ "arr-union": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz",
+ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ="
+ },
+ "array-equal": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
+ "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=",
+ "dev": true
+ },
+ "array-find-index": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
+ "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
+ "dev": true
+ },
+ "array-flatten": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz",
+ "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==",
+ "dev": true
+ },
+ "array-union": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
+ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
+ "dev": true,
+ "requires": {
+ "array-uniq": "^1.0.1"
+ }
+ },
+ "array-uniq": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
+ "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=",
+ "dev": true
+ },
+ "array-unique": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
+ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg="
+ },
+ "asn1": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
+ "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
+ "dev": true,
+ "requires": {
+ "safer-buffer": "~2.1.0"
+ }
+ },
+ "asn1.js": {
+ "version": "5.4.1",
+ "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz",
+ "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==",
+ "requires": {
+ "bn.js": "^4.0.0",
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0",
+ "safer-buffer": "^2.1.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw=="
+ }
+ }
+ },
+ "assert": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz",
+ "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==",
+ "requires": {
+ "object-assign": "^4.1.1",
+ "util": "0.10.3"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
+ "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE="
+ },
+ "util": {
+ "version": "0.10.3",
+ "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
+ "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
+ "requires": {
+ "inherits": "2.0.1"
+ }
+ }
+ }
+ },
+ "assert-plus": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
+ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
+ "dev": true
+ },
+ "assign-symbols": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
+ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c="
+ },
+ "astral-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
+ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
+ "dev": true
+ },
+ "async": {
+ "version": "2.6.3",
+ "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
+ "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
+ "dev": true,
+ "requires": {
+ "lodash": "^4.17.14"
+ }
+ },
+ "async-each": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz",
+ "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ=="
+ },
+ "async-foreach": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz",
+ "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=",
+ "dev": true
+ },
+ "async-limiter": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
+ "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
+ "dev": true
+ },
+ "asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
+ "dev": true
+ },
+ "atob": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
+ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg=="
+ },
+ "autoprefixer": {
+ "version": "9.8.6",
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.8.6.tgz",
+ "integrity": "sha512-XrvP4VVHdRBCdX1S3WXVD8+RyG9qeb1D5Sn1DeLiG2xfSpzellk5k54xbUERJ3M5DggQxes39UGOTP8CFrEGbg==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.12.0",
+ "caniuse-lite": "^1.0.30001109",
+ "colorette": "^1.2.1",
+ "normalize-range": "^0.1.2",
+ "num2fraction": "^1.2.2",
+ "postcss": "^7.0.32",
+ "postcss-value-parser": "^4.1.0"
+ },
+ "dependencies": {
+ "caniuse-lite": {
+ "version": "1.0.30001117",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001117.tgz",
+ "integrity": "sha512-4tY0Fatzdx59kYjQs+bNxUwZB03ZEBgVmJ1UkFPz/Q8OLiUUbjct2EdpnXj0fvFTPej2EkbPIG0w8BWsjAyk1Q==",
+ "dev": true
+ },
+ "postcss": {
+ "version": "7.0.32",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz",
+ "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "source-map": "^0.6.1",
+ "supports-color": "^6.1.0"
+ }
+ },
+ "postcss-value-parser": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz",
+ "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==",
+ "dev": true
+ },
+ "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
+ },
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "aws-sign2": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
+ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
+ "dev": true
+ },
+ "aws4": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz",
+ "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==",
+ "dev": true
+ },
+ "babel-jest": {
+ "version": "25.5.1",
+ "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.5.1.tgz",
+ "integrity": "sha512-9dA9+GmMjIzgPnYtkhBg73gOo/RHqPmLruP3BaGL4KEX3Dwz6pI8auSN8G8+iuEG90+GSswyKvslN+JYSaacaQ==",
+ "dev": true,
+ "requires": {
+ "@jest/transform": "^25.5.1",
+ "@jest/types": "^25.5.0",
+ "@types/babel__core": "^7.1.7",
+ "babel-plugin-istanbul": "^6.0.0",
+ "babel-preset-jest": "^25.5.0",
+ "chalk": "^3.0.0",
+ "graceful-fs": "^4.2.4",
+ "slash": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "babel-loader": {
+ "version": "8.2.2",
+ "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.2.tgz",
+ "integrity": "sha512-JvTd0/D889PQBtUXJ2PXaKU/pjZDMtHA9V2ecm+eNRmmBCMR09a+fmpGTNwnJtFmFl5Ei7Vy47LjBb+L0wQ99g==",
+ "dev": true,
+ "requires": {
+ "find-cache-dir": "^3.3.1",
+ "loader-utils": "^1.4.0",
+ "make-dir": "^3.1.0",
+ "schema-utils": "^2.6.5"
+ },
+ "dependencies": {
+ "ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ajv-keywords": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
+ "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
+ "dev": true
+ },
+ "find-cache-dir": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz",
+ "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==",
+ "dev": true,
+ "requires": {
+ "commondir": "^1.0.1",
+ "make-dir": "^3.0.2",
+ "pkg-dir": "^4.1.0"
+ }
+ },
+ "find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^4.1.0"
+ }
+ },
+ "make-dir": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
+ "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
+ "dev": true,
+ "requires": {
+ "semver": "^6.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.2.0"
+ }
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ },
+ "pkg-dir": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
+ "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
+ "dev": true,
+ "requires": {
+ "find-up": "^4.0.0"
+ }
+ },
+ "schema-utils": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz",
+ "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==",
+ "dev": true,
+ "requires": {
+ "@types/json-schema": "^7.0.5",
+ "ajv": "^6.12.4",
+ "ajv-keywords": "^3.5.2"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ }
+ }
+ },
+ "babel-plugin-dynamic-import-node": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
+ "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==",
+ "dev": true,
+ "requires": {
+ "object.assign": "^4.1.0"
+ }
+ },
+ "babel-plugin-istanbul": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz",
+ "integrity": "sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@istanbuljs/load-nyc-config": "^1.0.0",
+ "@istanbuljs/schema": "^0.1.2",
+ "istanbul-lib-instrument": "^4.0.0",
+ "test-exclude": "^6.0.0"
+ }
+ },
+ "babel-plugin-jest-hoist": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.5.0.tgz",
+ "integrity": "sha512-u+/W+WAjMlvoocYGTwthAiQSxDcJAyHpQ6oWlHdFZaaN+Rlk8Q7iiwDPg2lN/FyJtAYnKjFxbn7xus4HCFkg5g==",
+ "dev": true,
+ "requires": {
+ "@babel/template": "^7.3.3",
+ "@babel/types": "^7.3.3",
+ "@types/babel__traverse": "^7.0.6"
+ }
+ },
+ "babel-preset-current-node-syntax": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-0.1.2.tgz",
+ "integrity": "sha512-u/8cS+dEiK1SFILbOC8/rUI3ml9lboKuuMvZ/4aQnQmhecQAgPw5ew066C1ObnEAUmlx7dv/s2z52psWEtLNiw==",
+ "dev": true,
+ "requires": {
+ "@babel/plugin-syntax-async-generators": "^7.8.4",
+ "@babel/plugin-syntax-bigint": "^7.8.3",
+ "@babel/plugin-syntax-class-properties": "^7.8.3",
+ "@babel/plugin-syntax-json-strings": "^7.8.3",
+ "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3",
+ "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
+ "@babel/plugin-syntax-numeric-separator": "^7.8.3",
+ "@babel/plugin-syntax-object-rest-spread": "^7.8.3",
+ "@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
+ "@babel/plugin-syntax-optional-chaining": "^7.8.3"
+ }
+ },
+ "babel-preset-jest": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-25.5.0.tgz",
+ "integrity": "sha512-8ZczygctQkBU+63DtSOKGh7tFL0CeCuz+1ieud9lJ1WPQ9O6A1a/r+LGn6Y705PA6whHQ3T1XuB/PmpfNYf8Fw==",
+ "dev": true,
+ "requires": {
+ "babel-plugin-jest-hoist": "^25.5.0",
+ "babel-preset-current-node-syntax": "^0.1.2"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
+ },
+ "base": {
+ "version": "0.11.2",
+ "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz",
+ "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==",
+ "requires": {
+ "cache-base": "^1.0.1",
+ "class-utils": "^0.3.5",
+ "component-emitter": "^1.2.1",
+ "define-property": "^1.0.0",
+ "isobject": "^3.0.1",
+ "mixin-deep": "^1.2.0",
+ "pascalcase": "^0.1.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
+ },
+ "batch": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz",
+ "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=",
+ "dev": true
+ },
+ "bcrypt-pbkdf": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
+ "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
+ "dev": true,
+ "requires": {
+ "tweetnacl": "^0.14.3"
+ }
+ },
+ "big.js": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
+ "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ=="
+ },
+ "binary-extensions": {
+ "version": "1.13.1",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
+ "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw=="
+ },
+ "bindings": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+ "optional": true,
+ "requires": {
+ "file-uri-to-path": "1.0.0"
+ }
+ },
+ "block-stream": {
+ "version": "0.0.9",
+ "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
+ "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=",
+ "dev": true,
+ "requires": {
+ "inherits": "~2.0.0"
+ }
+ },
+ "bluebird": {
+ "version": "3.7.2",
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
+ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
+ },
+ "bn.js": {
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz",
+ "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ=="
+ },
+ "body-parser": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
+ "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
+ "dev": true,
+ "requires": {
+ "bytes": "3.1.0",
+ "content-type": "~1.0.4",
+ "debug": "2.6.9",
+ "depd": "~1.1.2",
+ "http-errors": "1.7.2",
+ "iconv-lite": "0.4.24",
+ "on-finished": "~2.3.0",
+ "qs": "6.7.0",
+ "raw-body": "2.4.0",
+ "type-is": "~1.6.17"
+ },
+ "dependencies": {
+ "bytes": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
+ "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
+ "dev": true
+ },
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "qs": {
+ "version": "6.7.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
+ "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
+ "dev": true
+ }
+ }
+ },
+ "bonjour": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz",
+ "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=",
+ "dev": true,
+ "requires": {
+ "array-flatten": "^2.1.0",
+ "deep-equal": "^1.0.1",
+ "dns-equal": "^1.0.0",
+ "dns-txt": "^2.0.2",
+ "multicast-dns": "^6.0.1",
+ "multicast-dns-service-types": "^1.1.0"
+ }
+ },
+ "boolbase": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
+ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
+ "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==",
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "braces": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
+ "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
+ "requires": {
+ "arr-flatten": "^1.1.0",
+ "array-unique": "^0.3.2",
+ "extend-shallow": "^2.0.1",
+ "fill-range": "^4.0.0",
+ "isobject": "^3.0.1",
+ "repeat-element": "^1.1.2",
+ "snapdragon": "^0.8.1",
+ "snapdragon-node": "^2.0.1",
+ "split-string": "^3.0.2",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "brorand": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
+ "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8="
+ },
+ "browser-process-hrtime": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz",
+ "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==",
+ "dev": true
+ },
+ "browser-resolve": {
+ "version": "1.11.3",
+ "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz",
+ "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==",
+ "dev": true,
+ "requires": {
+ "resolve": "1.1.7"
+ },
+ "dependencies": {
+ "resolve": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
+ "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
+ "dev": true
+ }
+ }
+ },
+ "browserify-aes": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
+ "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
+ "requires": {
+ "buffer-xor": "^1.0.3",
+ "cipher-base": "^1.0.0",
+ "create-hash": "^1.1.0",
+ "evp_bytestokey": "^1.0.3",
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "browserify-cipher": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz",
+ "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==",
+ "requires": {
+ "browserify-aes": "^1.0.4",
+ "browserify-des": "^1.0.0",
+ "evp_bytestokey": "^1.0.0"
+ }
+ },
+ "browserify-des": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz",
+ "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==",
+ "requires": {
+ "cipher-base": "^1.0.1",
+ "des.js": "^1.0.0",
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.1.2"
+ }
+ },
+ "browserify-rsa": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz",
+ "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==",
+ "requires": {
+ "bn.js": "^5.0.0",
+ "randombytes": "^2.0.1"
+ }
+ },
+ "browserify-sign": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz",
+ "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==",
+ "requires": {
+ "bn.js": "^5.1.1",
+ "browserify-rsa": "^4.0.1",
+ "create-hash": "^1.2.0",
+ "create-hmac": "^1.1.7",
+ "elliptic": "^6.5.3",
+ "inherits": "^2.0.4",
+ "parse-asn1": "^5.1.5",
+ "readable-stream": "^3.6.0",
+ "safe-buffer": "^5.2.0"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
+ }
+ }
+ },
+ "browserify-zlib": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz",
+ "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==",
+ "requires": {
+ "pako": "~1.0.5"
+ }
+ },
+ "browserslist": {
+ "version": "4.12.0",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.12.0.tgz",
+ "integrity": "sha512-UH2GkcEDSI0k/lRkuDSzFl9ZZ87skSy9w2XAn1MsZnL+4c4rqbBd3e82UWHbYDpztABrPBhZsTEeuxVfHppqDg==",
+ "dev": true,
+ "requires": {
+ "caniuse-lite": "^1.0.30001043",
+ "electron-to-chromium": "^1.3.413",
+ "node-releases": "^1.1.53",
+ "pkg-up": "^2.0.0"
+ }
+ },
+ "bs-logger": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz",
+ "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==",
+ "dev": true,
+ "requires": {
+ "fast-json-stable-stringify": "2.x"
+ }
+ },
+ "bser": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz",
+ "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==",
+ "dev": true,
+ "requires": {
+ "node-int64": "^0.4.0"
+ }
+ },
+ "buffer": {
+ "version": "4.9.2",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
+ "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==",
+ "requires": {
+ "base64-js": "^1.0.2",
+ "ieee754": "^1.1.4",
+ "isarray": "^1.0.0"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
+ }
+ }
+ },
+ "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=="
+ },
+ "buffer-indexof": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz",
+ "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==",
+ "dev": true
+ },
+ "buffer-xor": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
+ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk="
+ },
+ "builtin-status-codes": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz",
+ "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug="
+ },
+ "bytes": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
+ "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=",
+ "dev": true
+ },
+ "cacache": {
+ "version": "12.0.4",
+ "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz",
+ "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==",
+ "requires": {
+ "bluebird": "^3.5.5",
+ "chownr": "^1.1.1",
+ "figgy-pudding": "^3.5.1",
+ "glob": "^7.1.4",
+ "graceful-fs": "^4.1.15",
+ "infer-owner": "^1.0.3",
+ "lru-cache": "^5.1.1",
+ "mississippi": "^3.0.0",
+ "mkdirp": "^0.5.1",
+ "move-concurrently": "^1.0.1",
+ "promise-inflight": "^1.0.1",
+ "rimraf": "^2.6.3",
+ "ssri": "^6.0.1",
+ "unique-filename": "^1.1.1",
+ "y18n": "^4.0.0"
+ }
+ },
+ "cache-base": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
+ "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==",
+ "requires": {
+ "collection-visit": "^1.0.0",
+ "component-emitter": "^1.2.1",
+ "get-value": "^2.0.6",
+ "has-value": "^1.0.0",
+ "isobject": "^3.0.1",
+ "set-value": "^2.0.0",
+ "to-object-path": "^0.3.0",
+ "union-value": "^1.0.0",
+ "unset-value": "^1.0.0"
+ }
+ },
+ "caller-callsite": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz",
+ "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=",
+ "dev": true,
+ "requires": {
+ "callsites": "^2.0.0"
+ }
+ },
+ "caller-path": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz",
+ "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=",
+ "dev": true,
+ "requires": {
+ "caller-callsite": "^2.0.0"
+ }
+ },
+ "callsites": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz",
+ "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=",
+ "dev": true
+ },
+ "camelcase": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "dev": true
+ },
+ "camelcase-keys": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
+ "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=",
+ "dev": true,
+ "requires": {
+ "camelcase": "^2.0.0",
+ "map-obj": "^1.0.0"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz",
+ "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=",
+ "dev": true
+ }
+ }
+ },
+ "caniuse-api": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz",
+ "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.0.0",
+ "caniuse-lite": "^1.0.0",
+ "lodash.memoize": "^4.1.2",
+ "lodash.uniq": "^4.5.0"
+ }
+ },
+ "caniuse-lite": {
+ "version": "1.0.30001046",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001046.tgz",
+ "integrity": "sha512-CsGjBRYWG6FvgbyGy+hBbaezpwiqIOLkxQPY4A4Ea49g1eNsnQuESB+n4QM0BKii1j80MyJ26Ir5ywTQkbRE4g==",
+ "dev": true
+ },
+ "capture-exit": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz",
+ "integrity": "sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==",
+ "dev": true,
+ "requires": {
+ "rsvp": "^4.8.4"
+ }
+ },
+ "caseless": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
+ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "chokidar": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
+ "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
+ "requires": {
+ "anymatch": "^2.0.0",
+ "async-each": "^1.0.1",
+ "braces": "^2.3.2",
+ "fsevents": "^1.2.7",
+ "glob-parent": "^3.1.0",
+ "inherits": "^2.0.3",
+ "is-binary-path": "^1.0.0",
+ "is-glob": "^4.0.0",
+ "normalize-path": "^3.0.0",
+ "path-is-absolute": "^1.0.0",
+ "readdirp": "^2.2.1",
+ "upath": "^1.1.1"
+ }
+ },
+ "chownr": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
+ },
+ "chrome-trace-event": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz",
+ "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==",
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
+ "ci-info": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
+ "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==",
+ "dev": true
+ },
+ "cipher-base": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz",
+ "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==",
+ "requires": {
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "class-utils": {
+ "version": "0.3.6",
+ "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
+ "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==",
+ "requires": {
+ "arr-union": "^3.1.0",
+ "define-property": "^0.2.5",
+ "isobject": "^3.0.0",
+ "static-extend": "^0.1.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ }
+ }
+ },
+ "classnames": {
+ "version": "2.2.6",
+ "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz",
+ "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q=="
+ },
+ "cliui": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
+ "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
+ "dev": true,
+ "requires": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^6.2.0"
+ }
+ },
+ "clone-deep": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
+ "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
+ "dev": true,
+ "requires": {
+ "is-plain-object": "^2.0.4",
+ "kind-of": "^6.0.2",
+ "shallow-clone": "^3.0.0"
+ }
+ },
+ "co": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
+ "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
+ "dev": true
+ },
+ "coa": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/coa/-/coa-2.0.2.tgz",
+ "integrity": "sha512-q5/jG+YQnSy4nRTV4F7lPepBJZ8qBNJJDBuJdoejDyLXgmL7IEo+Le2JDZudFTFt7mrCqIRaSjws4ygRCTCAXA==",
+ "dev": true,
+ "requires": {
+ "@types/q": "^1.5.1",
+ "chalk": "^2.4.1",
+ "q": "^1.1.2"
+ }
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+ "dev": true
+ },
+ "collect-v8-coverage": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz",
+ "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==",
+ "dev": true
+ },
+ "collection-visit": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
+ "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=",
+ "requires": {
+ "map-visit": "^1.0.0",
+ "object-visit": "^1.0.0"
+ }
+ },
+ "color": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/color/-/color-3.1.2.tgz",
+ "integrity": "sha512-vXTJhHebByxZn3lDvDJYw4lR5+uB3vuoHsuYA5AKuxRVn5wzzIfQKGLBmgdVRHKTJYeK5rvJcHnrd0Li49CFpg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^1.9.1",
+ "color-string": "^1.5.2"
+ }
+ },
+ "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==",
+ "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="
+ },
+ "color-string": {
+ "version": "1.5.3",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz",
+ "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==",
+ "dev": true,
+ "requires": {
+ "color-name": "^1.0.0",
+ "simple-swizzle": "^0.2.2"
+ }
+ },
+ "colorette": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz",
+ "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==",
+ "dev": true
+ },
+ "combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dev": true,
+ "requires": {
+ "delayed-stream": "~1.0.0"
+ }
+ },
+ "commander": {
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
+ },
+ "commondir": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
+ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs="
+ },
+ "component-emitter": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
+ "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
+ },
+ "compressible": {
+ "version": "2.0.18",
+ "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
+ "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==",
+ "dev": true,
+ "requires": {
+ "mime-db": ">= 1.43.0 < 2"
+ }
+ },
+ "compression": {
+ "version": "1.7.4",
+ "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz",
+ "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==",
+ "dev": true,
+ "requires": {
+ "accepts": "~1.3.5",
+ "bytes": "3.0.0",
+ "compressible": "~2.0.16",
+ "debug": "2.6.9",
+ "on-headers": "~1.0.2",
+ "safe-buffer": "5.1.2",
+ "vary": "~1.1.2"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "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="
+ },
+ "concat-stream": {
+ "version": "1.6.2",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
+ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
+ "requires": {
+ "buffer-from": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.2.2",
+ "typedarray": "^0.0.6"
+ }
+ },
+ "connect-history-api-fallback": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz",
+ "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==",
+ "dev": true
+ },
+ "console-browserify": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz",
+ "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA=="
+ },
+ "console-control-strings": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
+ "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
+ "dev": true
+ },
+ "constants-browserify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz",
+ "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U="
+ },
+ "content-disposition": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
+ "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "5.1.2"
+ }
+ },
+ "content-type": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
+ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
+ "dev": true
+ },
+ "convert-source-map": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
+ "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.1.1"
+ }
+ },
+ "cookie": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
+ "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==",
+ "dev": true
+ },
+ "cookie-signature": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
+ "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=",
+ "dev": true
+ },
+ "copy-concurrently": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
+ "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==",
+ "requires": {
+ "aproba": "^1.1.1",
+ "fs-write-stream-atomic": "^1.0.8",
+ "iferr": "^0.1.5",
+ "mkdirp": "^0.5.1",
+ "rimraf": "^2.5.4",
+ "run-queue": "^1.0.0"
+ }
+ },
+ "copy-descriptor": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
+ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
+ },
+ "core-js": {
+ "version": "3.8.0",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.8.0.tgz",
+ "integrity": "sha512-W2VYNB0nwQQE7tKS7HzXd7r2y/y2SVJl4ga6oH/dnaLFzM0o2lB2P3zCkWj5Wc/zyMYjtgd5Hmhk0ObkQFZOIA=="
+ },
+ "core-js-compat": {
+ "version": "3.8.0",
+ "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.8.0.tgz",
+ "integrity": "sha512-o9QKelQSxQMYWHXc/Gc4L8bx/4F7TTraE5rhuN8I7mKBt5dBIUpXpIR3omv70ebr8ST5R3PqbDQr+ZI3+Tt1FQ==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.14.7",
+ "semver": "7.0.0"
+ },
+ "dependencies": {
+ "browserslist": {
+ "version": "4.14.7",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.7.tgz",
+ "integrity": "sha512-BSVRLCeG3Xt/j/1cCGj1019Wbty0H+Yvu2AOuZSuoaUWn3RatbL33Cxk+Q4jRMRAbOm0p7SLravLjpnT6s0vzQ==",
+ "dev": true,
+ "requires": {
+ "caniuse-lite": "^1.0.30001157",
+ "colorette": "^1.2.1",
+ "electron-to-chromium": "^1.3.591",
+ "escalade": "^3.1.1",
+ "node-releases": "^1.1.66"
+ }
+ },
+ "caniuse-lite": {
+ "version": "1.0.30001162",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001162.tgz",
+ "integrity": "sha512-E9FktFxaNnp4ky3ucIGzEXLM+Knzlpuq1oN1sFAU0KeayygabGTmOsndpo8QrL4D9pcThlf4D2pUKaDxPCUmVw==",
+ "dev": true
+ },
+ "electron-to-chromium": {
+ "version": "1.3.610",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.610.tgz",
+ "integrity": "sha512-eFDC+yVQpEhtlapk4CYDPfV9ajF9cEof5TBcO49L1ETO+aYogrKWDmYpZyxBScMNe8Bo/gJamH4amQ4yyvXg4g==",
+ "dev": true
+ },
+ "node-releases": {
+ "version": "1.1.67",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.67.tgz",
+ "integrity": "sha512-V5QF9noGFl3EymEwUYzO+3NTDpGfQB4ve6Qfnzf3UNydMhjQRVPR1DZTuvWiLzaFJYw2fmDwAfnRNEVb64hSIg==",
+ "dev": true
+ },
+ "semver": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
+ "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
+ "dev": true
+ }
+ }
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
+ },
+ "cosmiconfig": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz",
+ "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==",
+ "dev": true,
+ "requires": {
+ "import-fresh": "^2.0.0",
+ "is-directory": "^0.3.1",
+ "js-yaml": "^3.13.1",
+ "parse-json": "^4.0.0"
+ }
+ },
+ "create-ecdh": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz",
+ "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==",
+ "requires": {
+ "bn.js": "^4.1.0",
+ "elliptic": "^6.5.3"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw=="
+ }
+ }
+ },
+ "create-hash": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
+ "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
+ "requires": {
+ "cipher-base": "^1.0.1",
+ "inherits": "^2.0.1",
+ "md5.js": "^1.3.4",
+ "ripemd160": "^2.0.1",
+ "sha.js": "^2.4.0"
+ }
+ },
+ "create-hmac": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
+ "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
+ "requires": {
+ "cipher-base": "^1.0.3",
+ "create-hash": "^1.1.0",
+ "inherits": "^2.0.1",
+ "ripemd160": "^2.0.0",
+ "safe-buffer": "^5.0.1",
+ "sha.js": "^2.4.8"
+ }
+ },
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ },
+ "dependencies": {
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ }
+ }
+ },
+ "crypto-browserify": {
+ "version": "3.12.0",
+ "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz",
+ "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==",
+ "requires": {
+ "browserify-cipher": "^1.0.0",
+ "browserify-sign": "^4.0.0",
+ "create-ecdh": "^4.0.0",
+ "create-hash": "^1.1.0",
+ "create-hmac": "^1.1.0",
+ "diffie-hellman": "^5.0.0",
+ "inherits": "^2.0.1",
+ "pbkdf2": "^3.0.3",
+ "public-encrypt": "^4.0.0",
+ "randombytes": "^2.0.0",
+ "randomfill": "^1.0.3"
+ }
+ },
+ "css-color-names": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
+ "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=",
+ "dev": true
+ },
+ "css-declaration-sorter": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-4.0.1.tgz",
+ "integrity": "sha512-BcxQSKTSEEQUftYpBVnsH4SF05NTuBokb19/sBt6asXGKZ/6VP7PLG1CBCkFDYOnhXhPh0jMhO6xZ71oYHXHBA==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.1",
+ "timsort": "^0.3.0"
+ }
+ },
+ "css-loader": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-3.6.0.tgz",
+ "integrity": "sha512-M5lSukoWi1If8dhQAUCvj4H8vUt3vOnwbQBH9DdTm/s4Ym2B/3dPMtYZeJmq7Q3S3Pa+I94DcZ7pc9bP14cWIQ==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.3.1",
+ "cssesc": "^3.0.0",
+ "icss-utils": "^4.1.1",
+ "loader-utils": "^1.2.3",
+ "normalize-path": "^3.0.0",
+ "postcss": "^7.0.32",
+ "postcss-modules-extract-imports": "^2.0.0",
+ "postcss-modules-local-by-default": "^3.0.2",
+ "postcss-modules-scope": "^2.2.0",
+ "postcss-modules-values": "^3.0.0",
+ "postcss-value-parser": "^4.1.0",
+ "schema-utils": "^2.7.0",
+ "semver": "^6.3.0"
+ },
+ "dependencies": {
+ "postcss": {
+ "version": "7.0.32",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz",
+ "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "source-map": "^0.6.1",
+ "supports-color": "^6.1.0"
+ }
+ },
+ "postcss-value-parser": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz",
+ "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==",
+ "dev": true
+ },
+ "schema-utils": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz",
+ "integrity": "sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A==",
+ "dev": true,
+ "requires": {
+ "@types/json-schema": "^7.0.4",
+ "ajv": "^6.12.2",
+ "ajv-keywords": "^3.4.1"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ },
+ "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
+ },
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "css-select": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.1.0.tgz",
+ "integrity": "sha512-Dqk7LQKpwLoH3VovzZnkzegqNSuAziQyNZUcrdDM401iY+R5NkGBXGmtO05/yaXQziALuPogeG0b7UAgjnTJTQ==",
+ "dev": true,
+ "requires": {
+ "boolbase": "^1.0.0",
+ "css-what": "^3.2.1",
+ "domutils": "^1.7.0",
+ "nth-check": "^1.0.2"
+ }
+ },
+ "css-select-base-adapter": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz",
+ "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==",
+ "dev": true
+ },
+ "css-tree": {
+ "version": "1.0.0-alpha.37",
+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz",
+ "integrity": "sha512-DMxWJg0rnz7UgxKT0Q1HU/L9BeJI0M6ksor0OgqOnF+aRCDWg/N2641HmVyU9KVIu0OVVWOb2IpC9A+BJRnejg==",
+ "dev": true,
+ "requires": {
+ "mdn-data": "2.0.4",
+ "source-map": "^0.6.1"
+ },
+ "dependencies": {
+ "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
+ }
+ }
+ },
+ "css-what": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.2.1.tgz",
+ "integrity": "sha512-WwOrosiQTvyms+Ti5ZC5vGEK0Vod3FTt1ca+payZqvKuGJF+dq7bG63DstxtN0dpm6FxY27a/zS3Wten+gEtGw==",
+ "dev": true
+ },
+ "cssesc": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
+ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
+ "dev": true
+ },
+ "cssnano": {
+ "version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.10.tgz",
+ "integrity": "sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==",
+ "dev": true,
+ "requires": {
+ "cosmiconfig": "^5.0.0",
+ "cssnano-preset-default": "^4.0.7",
+ "is-resolvable": "^1.0.0",
+ "postcss": "^7.0.0"
+ }
+ },
+ "cssnano-preset-default": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-4.0.7.tgz",
+ "integrity": "sha512-x0YHHx2h6p0fCl1zY9L9roD7rnlltugGu7zXSKQx6k2rYw0Hi3IqxcoAGF7u9Q5w1nt7vK0ulxV8Lo+EvllGsA==",
+ "dev": true,
+ "requires": {
+ "css-declaration-sorter": "^4.0.1",
+ "cssnano-util-raw-cache": "^4.0.1",
+ "postcss": "^7.0.0",
+ "postcss-calc": "^7.0.1",
+ "postcss-colormin": "^4.0.3",
+ "postcss-convert-values": "^4.0.1",
+ "postcss-discard-comments": "^4.0.2",
+ "postcss-discard-duplicates": "^4.0.2",
+ "postcss-discard-empty": "^4.0.1",
+ "postcss-discard-overridden": "^4.0.1",
+ "postcss-merge-longhand": "^4.0.11",
+ "postcss-merge-rules": "^4.0.3",
+ "postcss-minify-font-values": "^4.0.2",
+ "postcss-minify-gradients": "^4.0.2",
+ "postcss-minify-params": "^4.0.2",
+ "postcss-minify-selectors": "^4.0.2",
+ "postcss-normalize-charset": "^4.0.1",
+ "postcss-normalize-display-values": "^4.0.2",
+ "postcss-normalize-positions": "^4.0.2",
+ "postcss-normalize-repeat-style": "^4.0.2",
+ "postcss-normalize-string": "^4.0.2",
+ "postcss-normalize-timing-functions": "^4.0.2",
+ "postcss-normalize-unicode": "^4.0.1",
+ "postcss-normalize-url": "^4.0.1",
+ "postcss-normalize-whitespace": "^4.0.2",
+ "postcss-ordered-values": "^4.1.2",
+ "postcss-reduce-initial": "^4.0.3",
+ "postcss-reduce-transforms": "^4.0.2",
+ "postcss-svgo": "^4.0.2",
+ "postcss-unique-selectors": "^4.0.1"
+ }
+ },
+ "cssnano-util-get-arguments": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz",
+ "integrity": "sha1-7ToIKZ8h11dBsg87gfGU7UnMFQ8=",
+ "dev": true
+ },
+ "cssnano-util-get-match": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/cssnano-util-get-match/-/cssnano-util-get-match-4.0.0.tgz",
+ "integrity": "sha1-wOTKB/U4a7F+xeUiULT1lhNlFW0=",
+ "dev": true
+ },
+ "cssnano-util-raw-cache": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/cssnano-util-raw-cache/-/cssnano-util-raw-cache-4.0.1.tgz",
+ "integrity": "sha512-qLuYtWK2b2Dy55I8ZX3ky1Z16WYsx544Q0UWViebptpwn/xDBmog2TLg4f+DBMg1rJ6JDWtn96WHbOKDWt1WQA==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.0"
+ }
+ },
+ "cssnano-util-same-parent": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz",
+ "integrity": "sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q==",
+ "dev": true
+ },
+ "csso": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/csso/-/csso-4.0.3.tgz",
+ "integrity": "sha512-NL3spysxUkcrOgnpsT4Xdl2aiEiBG6bXswAABQVHcMrfjjBisFOKwLDOmf4wf32aPdcJws1zds2B0Rg+jqMyHQ==",
+ "dev": true,
+ "requires": {
+ "css-tree": "1.0.0-alpha.39"
+ },
+ "dependencies": {
+ "css-tree": {
+ "version": "1.0.0-alpha.39",
+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.39.tgz",
+ "integrity": "sha512-7UvkEYgBAHRG9Nt980lYxjsTrCyHFN53ky3wVsDkiMdVqylqRt+Zc+jm5qw7/qyOvN2dHSYtX0e4MbCCExSvnA==",
+ "dev": true,
+ "requires": {
+ "mdn-data": "2.0.6",
+ "source-map": "^0.6.1"
+ }
+ },
+ "mdn-data": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.6.tgz",
+ "integrity": "sha512-rQvjv71olwNHgiTbfPZFkJtjNMciWgswYeciZhtvWLO8bmX3TnhyA62I6sTWOyZssWHJJjY6/KiWwqQsWWsqOA==",
+ "dev": true
+ },
+ "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
+ }
+ }
+ },
+ "cssom": {
+ "version": "0.4.4",
+ "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz",
+ "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==",
+ "dev": true
+ },
+ "cssstyle": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz",
+ "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==",
+ "dev": true,
+ "requires": {
+ "cssom": "~0.3.6"
+ },
+ "dependencies": {
+ "cssom": {
+ "version": "0.3.8",
+ "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz",
+ "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==",
+ "dev": true
+ }
+ }
+ },
+ "csstype": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.5.tgz",
+ "integrity": "sha512-uVDi8LpBUKQj6sdxNaTetL6FpeCqTjOvAQuQUa/qAqq8oOd4ivkbhgnqayl0dnPal8Tb/yB1tF+gOvCBiicaiQ=="
+ },
+ "currently-unhandled": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
+ "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=",
+ "dev": true,
+ "requires": {
+ "array-find-index": "^1.0.1"
+ }
+ },
+ "cyclist": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz",
+ "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk="
+ },
+ "dashdash": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
+ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "^1.0.0"
+ }
+ },
+ "data-urls": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz",
+ "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==",
+ "dev": true,
+ "requires": {
+ "abab": "^2.0.0",
+ "whatwg-mimetype": "^2.2.0",
+ "whatwg-url": "^7.0.0"
+ }
+ },
+ "debug": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
+ "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
+ "dev": true
+ },
+ "decode-uri-component": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
+ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
+ },
+ "deep-equal": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz",
+ "integrity": "sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==",
+ "dev": true,
+ "requires": {
+ "is-arguments": "^1.0.4",
+ "is-date-object": "^1.0.1",
+ "is-regex": "^1.0.4",
+ "object-is": "^1.0.1",
+ "object-keys": "^1.1.1",
+ "regexp.prototype.flags": "^1.2.0"
+ }
+ },
+ "deep-is": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
+ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
+ "dev": true
+ },
+ "deepmerge": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",
+ "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==",
+ "dev": true
+ },
+ "default-gateway": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-4.2.0.tgz",
+ "integrity": "sha512-h6sMrVB1VMWVrW13mSc6ia/DwYYw5MN6+exNu1OaJeFac5aSAvwM7lZ0NVfTABuSkQelr4h5oebg3KB1XPdjgA==",
+ "dev": true,
+ "requires": {
+ "execa": "^1.0.0",
+ "ip-regex": "^2.1.0"
+ }
+ },
+ "define-properties": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
+ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
+ "dev": true,
+ "requires": {
+ "object-keys": "^1.0.12"
+ }
+ },
+ "define-property": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
+ "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==",
+ "requires": {
+ "is-descriptor": "^1.0.2",
+ "isobject": "^3.0.1"
+ },
+ "dependencies": {
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "del": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz",
+ "integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==",
+ "dev": true,
+ "requires": {
+ "@types/glob": "^7.1.1",
+ "globby": "^6.1.0",
+ "is-path-cwd": "^2.0.0",
+ "is-path-in-cwd": "^2.0.0",
+ "p-map": "^2.0.0",
+ "pify": "^4.0.1",
+ "rimraf": "^2.6.3"
+ }
+ },
+ "delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
+ "dev": true
+ },
+ "delegates": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
+ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
+ "dev": true
+ },
+ "depd": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
+ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
+ "dev": true
+ },
+ "des.js": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz",
+ "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==",
+ "requires": {
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0"
+ }
+ },
+ "destroy": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
+ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=",
+ "dev": true
+ },
+ "detect-file": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz",
+ "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=",
+ "dev": true
+ },
+ "detect-newline": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
+ "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==",
+ "dev": true
+ },
+ "detect-node": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.4.tgz",
+ "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==",
+ "dev": true
+ },
+ "diff-sequences": {
+ "version": "25.2.6",
+ "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-25.2.6.tgz",
+ "integrity": "sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg==",
+ "dev": true
+ },
+ "diffie-hellman": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
+ "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==",
+ "requires": {
+ "bn.js": "^4.1.0",
+ "miller-rabin": "^4.0.0",
+ "randombytes": "^2.0.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw=="
+ }
+ }
+ },
+ "dns-equal": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz",
+ "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=",
+ "dev": true
+ },
+ "dns-packet": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz",
+ "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==",
+ "dev": true,
+ "requires": {
+ "ip": "^1.1.0",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "dns-txt": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz",
+ "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=",
+ "dev": true,
+ "requires": {
+ "buffer-indexof": "^1.0.0"
+ }
+ },
+ "dom-serializer": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz",
+ "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==",
+ "dev": true,
+ "requires": {
+ "domelementtype": "^2.0.1",
+ "entities": "^2.0.0"
+ },
+ "dependencies": {
+ "domelementtype": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz",
+ "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==",
+ "dev": true
+ },
+ "entities": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz",
+ "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==",
+ "dev": true
+ }
+ }
+ },
+ "dom-walk": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz",
+ "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w=="
+ },
+ "domain-browser": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
+ "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA=="
+ },
+ "domelementtype": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz",
+ "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==",
+ "dev": true
+ },
+ "domexception": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz",
+ "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==",
+ "dev": true,
+ "requires": {
+ "webidl-conversions": "^4.0.2"
+ }
+ },
+ "domutils": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz",
+ "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==",
+ "dev": true,
+ "requires": {
+ "dom-serializer": "0",
+ "domelementtype": "1"
+ }
+ },
+ "dot-prop": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz",
+ "integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==",
+ "dev": true,
+ "requires": {
+ "is-obj": "^2.0.0"
+ }
+ },
+ "duplexify": {
+ "version": "3.7.1",
+ "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz",
+ "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==",
+ "requires": {
+ "end-of-stream": "^1.0.0",
+ "inherits": "^2.0.1",
+ "readable-stream": "^2.0.0",
+ "stream-shift": "^1.0.0"
+ }
+ },
+ "ecc-jsbn": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
+ "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
+ "dev": true,
+ "requires": {
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.1.0"
+ }
+ },
+ "ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
+ "dev": true
+ },
+ "electron-to-chromium": {
+ "version": "1.3.417",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.417.tgz",
+ "integrity": "sha512-IMNamkpoT3lVSHC16QPx3lbLt/WBuoPtAmMGLbVVJTwKR/rjohP+Y+j4xHSSgvylICvT5HOnnPha+uJMqwmUWg==",
+ "dev": true
+ },
+ "elliptic": {
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
+ "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
+ "requires": {
+ "bn.js": "^4.4.0",
+ "brorand": "^1.0.1",
+ "hash.js": "^1.0.0",
+ "hmac-drbg": "^1.0.0",
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0",
+ "minimalistic-crypto-utils": "^1.0.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw=="
+ }
+ }
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "emojis-list": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
+ "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q=="
+ },
+ "encodeurl": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
+ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
+ "dev": true
+ },
+ "end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "requires": {
+ "once": "^1.4.0"
+ }
+ },
+ "enhanced-resolve": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz",
+ "integrity": "sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "memory-fs": "^0.5.0",
+ "tapable": "^1.0.0"
+ },
+ "dependencies": {
+ "memory-fs": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz",
+ "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==",
+ "dev": true,
+ "requires": {
+ "errno": "^0.1.3",
+ "readable-stream": "^2.0.1"
+ }
+ }
+ }
+ },
+ "entities": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
+ "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
+ },
+ "errno": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
+ "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
+ "requires": {
+ "prr": "~1.0.1"
+ }
+ },
+ "error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "es-abstract": {
+ "version": "1.17.5",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz",
+ "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==",
+ "dev": true,
+ "requires": {
+ "es-to-primitive": "^1.2.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.1",
+ "is-callable": "^1.1.5",
+ "is-regex": "^1.0.5",
+ "object-inspect": "^1.7.0",
+ "object-keys": "^1.1.1",
+ "object.assign": "^4.1.0",
+ "string.prototype.trimleft": "^2.1.1",
+ "string.prototype.trimright": "^2.1.1"
+ }
+ },
+ "es-to-primitive": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
+ "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
+ "dev": true,
+ "requires": {
+ "is-callable": "^1.1.4",
+ "is-date-object": "^1.0.1",
+ "is-symbol": "^1.0.2"
+ }
+ },
+ "escalade": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+ "dev": true
+ },
+ "escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
+ "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="
+ },
+ "escodegen": {
+ "version": "1.14.2",
+ "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.2.tgz",
+ "integrity": "sha512-InuOIiKk8wwuOFg6x9BQXbzjrQhtyXh46K9bqVTPzSo2FnyMBaYGBMC6PhQy7yxxil9vIedFBweQBMK74/7o8A==",
+ "dev": true,
+ "requires": {
+ "esprima": "^4.0.1",
+ "estraverse": "^4.2.0",
+ "esutils": "^2.0.2",
+ "optionator": "^0.8.1",
+ "source-map": "~0.6.1"
+ },
+ "dependencies": {
+ "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,
+ "optional": true
+ }
+ }
+ },
+ "eslint-scope": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
+ "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==",
+ "requires": {
+ "esrecurse": "^4.1.0",
+ "estraverse": "^4.1.1"
+ }
+ },
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "dev": true
+ },
+ "esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "requires": {
+ "estraverse": "^5.2.0"
+ },
+ "dependencies": {
+ "estraverse": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
+ "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ=="
+ }
+ }
+ },
+ "estraverse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
+ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="
+ },
+ "esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true
+ },
+ "etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
+ "dev": true
+ },
+ "eventemitter3": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz",
+ "integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==",
+ "dev": true
+ },
+ "events": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz",
+ "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg=="
+ },
+ "eventsource": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz",
+ "integrity": "sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==",
+ "dev": true,
+ "requires": {
+ "original": "^1.0.0"
+ }
+ },
+ "evp_bytestokey": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz",
+ "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==",
+ "requires": {
+ "md5.js": "^1.3.4",
+ "safe-buffer": "^5.1.1"
+ }
+ },
+ "exec-sh": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.4.tgz",
+ "integrity": "sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A==",
+ "dev": true
+ },
+ "execa": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
+ "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
+ "dev": true,
+ "requires": {
+ "cross-spawn": "^6.0.0",
+ "get-stream": "^4.0.0",
+ "is-stream": "^1.1.0",
+ "npm-run-path": "^2.0.0",
+ "p-finally": "^1.0.0",
+ "signal-exit": "^3.0.0",
+ "strip-eof": "^1.0.0"
+ }
+ },
+ "exit": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
+ "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=",
+ "dev": true
+ },
+ "expand-brackets": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
+ "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=",
+ "requires": {
+ "debug": "^2.3.3",
+ "define-property": "^0.2.5",
+ "extend-shallow": "^2.0.1",
+ "posix-character-classes": "^0.1.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
+ }
+ }
+ },
+ "expand-tilde": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz",
+ "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=",
+ "dev": true,
+ "requires": {
+ "homedir-polyfill": "^1.0.1"
+ }
+ },
+ "expect": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/expect/-/expect-25.5.0.tgz",
+ "integrity": "sha512-w7KAXo0+6qqZZhovCaBVPSIqQp7/UTcx4M9uKt2m6pd2VB1voyC8JizLRqeEqud3AAVP02g+hbErDu5gu64tlA==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "ansi-styles": "^4.0.0",
+ "jest-get-type": "^25.2.6",
+ "jest-matcher-utils": "^25.5.0",
+ "jest-message-util": "^25.5.0",
+ "jest-regex-util": "^25.2.6"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ }
+ }
+ },
+ "express": {
+ "version": "4.17.1",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
+ "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
+ "dev": true,
+ "requires": {
+ "accepts": "~1.3.7",
+ "array-flatten": "1.1.1",
+ "body-parser": "1.19.0",
+ "content-disposition": "0.5.3",
+ "content-type": "~1.0.4",
+ "cookie": "0.4.0",
+ "cookie-signature": "1.0.6",
+ "debug": "2.6.9",
+ "depd": "~1.1.2",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "finalhandler": "~1.1.2",
+ "fresh": "0.5.2",
+ "merge-descriptors": "1.0.1",
+ "methods": "~1.1.2",
+ "on-finished": "~2.3.0",
+ "parseurl": "~1.3.3",
+ "path-to-regexp": "0.1.7",
+ "proxy-addr": "~2.0.5",
+ "qs": "6.7.0",
+ "range-parser": "~1.2.1",
+ "safe-buffer": "5.1.2",
+ "send": "0.17.1",
+ "serve-static": "1.14.1",
+ "setprototypeof": "1.1.1",
+ "statuses": "~1.5.0",
+ "type-is": "~1.6.18",
+ "utils-merge": "1.0.1",
+ "vary": "~1.1.2"
+ },
+ "dependencies": {
+ "array-flatten": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
+ "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
+ "dev": true
+ },
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "path-to-regexp": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
+ "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
+ "dev": true
+ },
+ "qs": {
+ "version": "6.7.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
+ "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
+ "dev": true
+ }
+ }
+ },
+ "extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+ "dev": true
+ },
+ "extend-shallow": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
+ "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=",
+ "requires": {
+ "assign-symbols": "^1.0.0",
+ "is-extendable": "^1.0.1"
+ },
+ "dependencies": {
+ "is-extendable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
+ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
+ "requires": {
+ "is-plain-object": "^2.0.4"
+ }
+ }
+ }
+ },
+ "extglob": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
+ "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
+ "requires": {
+ "array-unique": "^0.3.2",
+ "define-property": "^1.0.0",
+ "expand-brackets": "^2.1.4",
+ "extend-shallow": "^2.0.1",
+ "fragment-cache": "^0.2.1",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "extsprintf": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
+ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
+ "dev": true
+ },
+ "fast-deep-equal": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
+ "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA=="
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
+ },
+ "fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc="
+ },
+ "faye-websocket": {
+ "version": "0.10.0",
+ "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz",
+ "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=",
+ "dev": true,
+ "requires": {
+ "websocket-driver": ">=0.5.1"
+ }
+ },
+ "fb-watchman": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz",
+ "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==",
+ "dev": true,
+ "requires": {
+ "bser": "2.1.1"
+ }
+ },
+ "figgy-pudding": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz",
+ "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw=="
+ },
+ "file-loader": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-6.2.0.tgz",
+ "integrity": "sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw==",
+ "dev": true,
+ "requires": {
+ "loader-utils": "^2.0.0",
+ "schema-utils": "^3.0.0"
+ },
+ "dependencies": {
+ "@types/json-schema": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
+ "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==",
+ "dev": true
+ },
+ "ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ajv-keywords": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
+ "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
+ "dev": true
+ },
+ "json5": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
+ "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "loader-utils": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
+ "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
+ "dev": true,
+ "requires": {
+ "big.js": "^5.2.2",
+ "emojis-list": "^3.0.0",
+ "json5": "^2.1.2"
+ }
+ },
+ "schema-utils": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz",
+ "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==",
+ "dev": true,
+ "requires": {
+ "@types/json-schema": "^7.0.6",
+ "ajv": "^6.12.5",
+ "ajv-keywords": "^3.5.2"
+ }
+ }
+ }
+ },
+ "file-uri-to-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+ "optional": true
+ },
+ "fill-range": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
+ "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
+ "requires": {
+ "extend-shallow": "^2.0.1",
+ "is-number": "^3.0.0",
+ "repeat-string": "^1.6.1",
+ "to-regex-range": "^2.1.0"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "finalhandler": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
+ "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.3.0",
+ "parseurl": "~1.3.3",
+ "statuses": "~1.5.0",
+ "unpipe": "~1.0.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ }
+ }
+ },
+ "find-cache-dir": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz",
+ "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==",
+ "requires": {
+ "commondir": "^1.0.1",
+ "make-dir": "^2.0.0",
+ "pkg-dir": "^3.0.0"
+ }
+ },
+ "find-up": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
+ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
+ "requires": {
+ "locate-path": "^3.0.0"
+ }
+ },
+ "findup-sync": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz",
+ "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==",
+ "dev": true,
+ "requires": {
+ "detect-file": "^1.0.0",
+ "is-glob": "^4.0.0",
+ "micromatch": "^3.0.4",
+ "resolve-dir": "^1.0.1"
+ }
+ },
+ "flush-write-stream": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz",
+ "integrity": "sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w==",
+ "requires": {
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.3.6"
+ }
+ },
+ "follow-redirects": {
+ "version": "1.11.0",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.11.0.tgz",
+ "integrity": "sha512-KZm0V+ll8PfBrKwMzdo5D13b1bur9Iq9Zd/RMmAoQQcl2PxxFml8cxXPaaPYVbV0RjNjq1CU7zIzAOqtUPudmA==",
+ "dev": true,
+ "requires": {
+ "debug": "^3.0.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
+ "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ }
+ }
+ },
+ "for-in": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
+ "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA="
+ },
+ "forever-agent": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
+ "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
+ "dev": true
+ },
+ "form-data": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
+ "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
+ "dev": true,
+ "requires": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.6",
+ "mime-types": "^2.1.12"
+ }
+ },
+ "forwarded": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
+ "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=",
+ "dev": true
+ },
+ "fragment-cache": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
+ "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=",
+ "requires": {
+ "map-cache": "^0.2.2"
+ }
+ },
+ "fresh": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+ "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=",
+ "dev": true
+ },
+ "from2": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
+ "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=",
+ "requires": {
+ "inherits": "^2.0.1",
+ "readable-stream": "^2.0.0"
+ }
+ },
+ "fs-extra": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
+ "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ }
+ },
+ "fs-write-stream-atomic": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz",
+ "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=",
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "iferr": "^0.1.5",
+ "imurmurhash": "^0.1.4",
+ "readable-stream": "1 || 2"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
+ },
+ "fsevents": {
+ "version": "1.2.12",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz",
+ "integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==",
+ "optional": true,
+ "requires": {
+ "bindings": "^1.5.0",
+ "nan": "^2.12.1",
+ "node-pre-gyp": "*"
+ },
+ "dependencies": {
+ "abbrev": {
+ "version": "1.1.1",
+ "bundled": true,
+ "optional": true
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "bundled": true,
+ "optional": true
+ },
+ "aproba": {
+ "version": "1.2.0",
+ "bundled": true,
+ "optional": true
+ },
+ "are-we-there-yet": {
+ "version": "1.1.5",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "delegates": "^1.0.0",
+ "readable-stream": "^2.0.6"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "bundled": true,
+ "optional": true
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "chownr": {
+ "version": "1.1.4",
+ "bundled": true,
+ "optional": true
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "bundled": true,
+ "optional": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "console-control-strings": {
+ "version": "1.1.0",
+ "bundled": true,
+ "optional": true
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "debug": {
+ "version": "3.2.6",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "deep-extend": {
+ "version": "0.6.0",
+ "bundled": true,
+ "optional": true
+ },
+ "delegates": {
+ "version": "1.0.0",
+ "bundled": true,
+ "optional": true
+ },
+ "detect-libc": {
+ "version": "1.0.3",
+ "bundled": true,
+ "optional": true
+ },
+ "fs-minipass": {
+ "version": "1.2.7",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "minipass": "^2.6.0"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "bundled": true,
+ "optional": true
+ },
+ "gauge": {
+ "version": "2.7.4",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "aproba": "^1.0.3",
+ "console-control-strings": "^1.0.0",
+ "has-unicode": "^2.0.0",
+ "object-assign": "^4.1.0",
+ "signal-exit": "^3.0.0",
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wide-align": "^1.1.0"
+ }
+ },
+ "glob": {
+ "version": "7.1.6",
+ "bundled": true,
+ "optional": 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"
+ }
+ },
+ "has-unicode": {
+ "version": "2.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "ignore-walk": {
+ "version": "3.0.3",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "minimatch": "^3.0.4"
+ }
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "bundled": true,
+ "optional": true
+ },
+ "ini": {
+ "version": "1.3.5",
+ "bundled": true,
+ "optional": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "bundled": true,
+ "optional": true
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "bundled": true,
+ "optional": true
+ },
+ "minipass": {
+ "version": "2.9.0",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.0"
+ }
+ },
+ "minizlib": {
+ "version": "1.3.3",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "minipass": "^2.9.0"
+ }
+ },
+ "mkdirp": {
+ "version": "0.5.3",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "bundled": true,
+ "optional": true
+ },
+ "needle": {
+ "version": "2.3.3",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "debug": "^3.2.6",
+ "iconv-lite": "^0.4.4",
+ "sax": "^1.2.4"
+ }
+ },
+ "node-pre-gyp": {
+ "version": "0.14.0",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "detect-libc": "^1.0.2",
+ "mkdirp": "^0.5.1",
+ "needle": "^2.2.1",
+ "nopt": "^4.0.1",
+ "npm-packlist": "^1.1.6",
+ "npmlog": "^4.0.2",
+ "rc": "^1.2.7",
+ "rimraf": "^2.6.1",
+ "semver": "^5.3.0",
+ "tar": "^4.4.2"
+ }
+ },
+ "nopt": {
+ "version": "4.0.3",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "abbrev": "1",
+ "osenv": "^0.1.4"
+ }
+ },
+ "npm-bundled": {
+ "version": "1.1.1",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "npm-normalize-package-bin": "^1.0.1"
+ }
+ },
+ "npm-normalize-package-bin": {
+ "version": "1.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "npm-packlist": {
+ "version": "1.4.8",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "ignore-walk": "^3.0.1",
+ "npm-bundled": "^1.0.1",
+ "npm-normalize-package-bin": "^1.0.1"
+ }
+ },
+ "npmlog": {
+ "version": "4.1.2",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "are-we-there-yet": "~1.1.2",
+ "console-control-strings": "~1.1.0",
+ "gauge": "~2.7.3",
+ "set-blocking": "~2.0.0"
+ }
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "bundled": true,
+ "optional": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "os-homedir": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "osenv": {
+ "version": "0.1.5",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "os-homedir": "^1.0.0",
+ "os-tmpdir": "^1.0.0"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "process-nextick-args": {
+ "version": "2.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "rc": {
+ "version": "1.2.8",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ }
+ },
+ "readable-stream": {
+ "version": "2.3.7",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "rimraf": {
+ "version": "2.7.1",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "bundled": true,
+ "optional": true
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "bundled": true,
+ "optional": true
+ },
+ "sax": {
+ "version": "1.2.4",
+ "bundled": true,
+ "optional": true
+ },
+ "semver": {
+ "version": "5.7.1",
+ "bundled": true,
+ "optional": true
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "bundled": true,
+ "optional": true
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "tar": {
+ "version": "4.4.13",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "chownr": "^1.1.1",
+ "fs-minipass": "^1.2.5",
+ "minipass": "^2.8.6",
+ "minizlib": "^1.2.1",
+ "mkdirp": "^0.5.0",
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.3"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "wide-align": {
+ "version": "1.1.3",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "string-width": "^1.0.2 || 2"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "yallist": {
+ "version": "3.1.1",
+ "bundled": true,
+ "optional": true
+ }
+ }
+ },
+ "fstream": {
+ "version": "1.0.12",
+ "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz",
+ "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "inherits": "~2.0.0",
+ "mkdirp": ">=0.5 0",
+ "rimraf": "2"
+ }
+ },
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
+ "gauge": {
+ "version": "2.7.4",
+ "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
+ "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
+ "dev": true,
+ "requires": {
+ "aproba": "^1.0.3",
+ "console-control-strings": "^1.0.0",
+ "has-unicode": "^2.0.0",
+ "object-assign": "^4.1.0",
+ "signal-exit": "^3.0.0",
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wide-align": "^1.1.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "dev": true,
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "dev": true,
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ }
+ }
+ },
+ "gaze": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz",
+ "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==",
+ "dev": true,
+ "requires": {
+ "globule": "^1.0.0"
+ }
+ },
+ "gensync": {
+ "version": "1.0.0-beta.2",
+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
+ "dev": true
+ },
+ "get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true
+ },
+ "get-package-type": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz",
+ "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==",
+ "dev": true
+ },
+ "get-stdin": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
+ "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=",
+ "dev": true
+ },
+ "get-stream": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
+ "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
+ "dev": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ },
+ "get-value": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz",
+ "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg="
+ },
+ "getpass": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
+ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "^1.0.0"
+ }
+ },
+ "glob": {
+ "version": "7.1.6",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
+ "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
+ "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"
+ }
+ },
+ "glob-parent": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
+ "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
+ "requires": {
+ "is-glob": "^3.1.0",
+ "path-dirname": "^1.0.0"
+ },
+ "dependencies": {
+ "is-glob": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
+ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
+ "requires": {
+ "is-extglob": "^2.1.0"
+ }
+ }
+ }
+ },
+ "global": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz",
+ "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==",
+ "requires": {
+ "min-document": "^2.19.0",
+ "process": "^0.11.10"
+ }
+ },
+ "global-modules": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz",
+ "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==",
+ "dev": true,
+ "requires": {
+ "global-prefix": "^3.0.0"
+ },
+ "dependencies": {
+ "global-prefix": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz",
+ "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==",
+ "dev": true,
+ "requires": {
+ "ini": "^1.3.5",
+ "kind-of": "^6.0.2",
+ "which": "^1.3.1"
+ }
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ }
+ }
+ },
+ "global-prefix": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz",
+ "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=",
+ "dev": true,
+ "requires": {
+ "expand-tilde": "^2.0.2",
+ "homedir-polyfill": "^1.0.1",
+ "ini": "^1.3.4",
+ "is-windows": "^1.0.1",
+ "which": "^1.2.14"
+ },
+ "dependencies": {
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ }
+ }
+ },
+ "globals": {
+ "version": "11.12.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
+ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="
+ },
+ "globby": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
+ "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
+ "dev": true,
+ "requires": {
+ "array-union": "^1.0.1",
+ "glob": "^7.0.3",
+ "object-assign": "^4.0.1",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ }
+ }
+ },
+ "globule": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz",
+ "integrity": "sha512-7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA==",
+ "dev": true,
+ "requires": {
+ "glob": "~7.1.1",
+ "lodash": "~4.17.10",
+ "minimatch": "~3.0.2"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz",
+ "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ=="
+ },
+ "growly": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz",
+ "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=",
+ "dev": true,
+ "optional": true
+ },
+ "handle-thing": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz",
+ "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==",
+ "dev": true
+ },
+ "har-schema": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
+ "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
+ "dev": true
+ },
+ "har-validator": {
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
+ "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.5.5",
+ "har-schema": "^2.0.0"
+ }
+ },
+ "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-ansi": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
+ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ }
+ }
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
+ },
+ "has-symbols": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
+ "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
+ "dev": true
+ },
+ "has-unicode": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
+ "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
+ "dev": true
+ },
+ "has-value": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
+ "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=",
+ "requires": {
+ "get-value": "^2.0.6",
+ "has-values": "^1.0.0",
+ "isobject": "^3.0.0"
+ }
+ },
+ "has-values": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz",
+ "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=",
+ "requires": {
+ "is-number": "^3.0.0",
+ "kind-of": "^4.0.0"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
+ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=",
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "hash-base": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz",
+ "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==",
+ "requires": {
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.6.0",
+ "safe-buffer": "^5.2.0"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
+ }
+ }
+ },
+ "hash.js": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
+ "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
+ "requires": {
+ "inherits": "^2.0.3",
+ "minimalistic-assert": "^1.0.1"
+ }
+ },
+ "hex-color-regex": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
+ "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==",
+ "dev": true
+ },
+ "highlight.js": {
+ "version": "10.4.0",
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.4.0.tgz",
+ "integrity": "sha512-EfrUGcQ63oLJbj0J0RI9ebX6TAITbsDBLbsjr881L/X5fMO9+oadKzEF21C7R3ULKG6Gv3uoab2HiqVJa/4+oA=="
+ },
+ "history": {
+ "version": "4.10.1",
+ "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz",
+ "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==",
+ "requires": {
+ "@babel/runtime": "^7.1.2",
+ "loose-envify": "^1.2.0",
+ "resolve-pathname": "^3.0.0",
+ "tiny-invariant": "^1.0.2",
+ "tiny-warning": "^1.0.0",
+ "value-equal": "^1.0.1"
+ }
+ },
+ "hmac-drbg": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
+ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=",
+ "requires": {
+ "hash.js": "^1.0.3",
+ "minimalistic-assert": "^1.0.0",
+ "minimalistic-crypto-utils": "^1.0.1"
+ }
+ },
+ "hoist-non-react-statics": {
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
+ "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
+ "requires": {
+ "react-is": "^16.7.0"
+ }
+ },
+ "homedir-polyfill": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
+ "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==",
+ "dev": true,
+ "requires": {
+ "parse-passwd": "^1.0.0"
+ }
+ },
+ "hosted-git-info": {
+ "version": "2.8.8",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
+ "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
+ "dev": true
+ },
+ "hpack.js": {
+ "version": "2.1.6",
+ "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz",
+ "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.1",
+ "obuf": "^1.0.0",
+ "readable-stream": "^2.0.1",
+ "wbuf": "^1.1.0"
+ }
+ },
+ "hsl-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/hsl-regex/-/hsl-regex-1.0.0.tgz",
+ "integrity": "sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4=",
+ "dev": true
+ },
+ "hsla-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/hsla-regex/-/hsla-regex-1.0.0.tgz",
+ "integrity": "sha1-wc56MWjIxmFAM6S194d/OyJfnDg=",
+ "dev": true
+ },
+ "html-comment-regex": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.2.tgz",
+ "integrity": "sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==",
+ "dev": true
+ },
+ "html-encoding-sniffer": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz",
+ "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==",
+ "dev": true,
+ "requires": {
+ "whatwg-encoding": "^1.0.1"
+ }
+ },
+ "html-entities": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.3.1.tgz",
+ "integrity": "sha512-rhE/4Z3hIhzHAUKbW8jVcCyuT5oJCXXqhN/6mXXVCpzTmvJnoH2HL/bt3EZ6p55jbFJBeAe1ZNpL5BugLujxNA==",
+ "dev": true
+ },
+ "html-escaper": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
+ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
+ "dev": true
+ },
+ "http-deceiver": {
+ "version": "1.2.7",
+ "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz",
+ "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=",
+ "dev": true
+ },
+ "http-errors": {
+ "version": "1.7.2",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
+ "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
+ "dev": true,
+ "requires": {
+ "depd": "~1.1.2",
+ "inherits": "2.0.3",
+ "setprototypeof": "1.1.1",
+ "statuses": ">= 1.5.0 < 2",
+ "toidentifier": "1.0.0"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "dev": true
+ }
+ }
+ },
+ "http-proxy": {
+ "version": "1.18.1",
+ "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
+ "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
+ "dev": true,
+ "requires": {
+ "eventemitter3": "^4.0.0",
+ "follow-redirects": "^1.0.0",
+ "requires-port": "^1.0.0"
+ }
+ },
+ "http-proxy-middleware": {
+ "version": "0.19.1",
+ "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz",
+ "integrity": "sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q==",
+ "dev": true,
+ "requires": {
+ "http-proxy": "^1.17.0",
+ "is-glob": "^4.0.0",
+ "lodash": "^4.17.11",
+ "micromatch": "^3.1.10"
+ }
+ },
+ "http-signature": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
+ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "^1.0.0",
+ "jsprim": "^1.2.2",
+ "sshpk": "^1.7.0"
+ }
+ },
+ "https-browserify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz",
+ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM="
+ },
+ "human-signals": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
+ "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==",
+ "dev": true
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "dev": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "icss-utils": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-4.1.1.tgz",
+ "integrity": "sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.14"
+ }
+ },
+ "ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
+ },
+ "iferr": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz",
+ "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE="
+ },
+ "import-cwd": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz",
+ "integrity": "sha1-qmzzbnInYShcs3HsZRn1PiQ1sKk=",
+ "dev": true,
+ "requires": {
+ "import-from": "^2.1.0"
+ }
+ },
+ "import-fresh": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz",
+ "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=",
+ "dev": true,
+ "requires": {
+ "caller-path": "^2.0.0",
+ "resolve-from": "^3.0.0"
+ }
+ },
+ "import-from": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/import-from/-/import-from-2.1.0.tgz",
+ "integrity": "sha1-M1238qev/VOqpHHUuAId7ja387E=",
+ "dev": true,
+ "requires": {
+ "resolve-from": "^3.0.0"
+ }
+ },
+ "import-local": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz",
+ "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==",
+ "dev": true,
+ "requires": {
+ "pkg-dir": "^4.2.0",
+ "resolve-cwd": "^3.0.0"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^4.1.0"
+ }
+ },
+ "p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.2.0"
+ }
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ },
+ "pkg-dir": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
+ "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
+ "dev": true,
+ "requires": {
+ "find-up": "^4.0.0"
+ }
+ }
+ }
+ },
+ "imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
+ },
+ "in-publish": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.1.tgz",
+ "integrity": "sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ==",
+ "dev": true
+ },
+ "indent-string": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz",
+ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=",
+ "dev": true,
+ "requires": {
+ "repeating": "^2.0.0"
+ }
+ },
+ "indexes-of": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
+ "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=",
+ "dev": true
+ },
+ "infer-owner": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",
+ "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A=="
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "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=="
+ },
+ "ini": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
+ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
+ "dev": true
+ },
+ "internal-ip": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-4.3.0.tgz",
+ "integrity": "sha512-S1zBo1D6zcsyuC6PMmY5+55YMILQ9av8lotMx447Bq6SAgo/sDK6y6uUKmuYhW7eacnIhFfsPmCNYdDzsnnDCg==",
+ "dev": true,
+ "requires": {
+ "default-gateway": "^4.2.0",
+ "ipaddr.js": "^1.9.0"
+ }
+ },
+ "interpret": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
+ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
+ "dev": true
+ },
+ "ip": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
+ "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=",
+ "dev": true
+ },
+ "ip-regex": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz",
+ "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=",
+ "dev": true
+ },
+ "ipaddr.js": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+ "dev": true
+ },
+ "is-absolute-url": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz",
+ "integrity": "sha1-UFMN+4T8yap9vnhS6Do3uTufKqY=",
+ "dev": true
+ },
+ "is-accessor-descriptor": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
+ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=",
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-arguments": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz",
+ "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==",
+ "dev": true
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
+ "dev": true
+ },
+ "is-binary-path": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz",
+ "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=",
+ "requires": {
+ "binary-extensions": "^1.0.0"
+ }
+ },
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
+ },
+ "is-callable": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz",
+ "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==",
+ "dev": true
+ },
+ "is-ci": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz",
+ "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==",
+ "dev": true,
+ "requires": {
+ "ci-info": "^2.0.0"
+ }
+ },
+ "is-color-stop": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-color-stop/-/is-color-stop-1.1.0.tgz",
+ "integrity": "sha1-z/9HGu5N1cnhWFmPvhKWe1za00U=",
+ "dev": true,
+ "requires": {
+ "css-color-names": "^0.0.4",
+ "hex-color-regex": "^1.1.0",
+ "hsl-regex": "^1.0.0",
+ "hsla-regex": "^1.0.0",
+ "rgb-regex": "^1.0.1",
+ "rgba-regex": "^1.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
+ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=",
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-date-object": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz",
+ "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==",
+ "dev": true
+ },
+ "is-descriptor": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
+ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "requires": {
+ "is-accessor-descriptor": "^0.1.6",
+ "is-data-descriptor": "^0.1.4",
+ "kind-of": "^5.0.0"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
+ "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw=="
+ }
+ }
+ },
+ "is-directory": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz",
+ "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=",
+ "dev": true
+ },
+ "is-docker": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.0.0.tgz",
+ "integrity": "sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ==",
+ "dev": true,
+ "optional": true
+ },
+ "is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik="
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI="
+ },
+ "is-finite": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz",
+ "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true
+ },
+ "is-generator-fn": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz",
+ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==",
+ "dev": true
+ },
+ "is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-number": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
+ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-obj": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
+ "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
+ "dev": true
+ },
+ "is-path-cwd": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
+ "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==",
+ "dev": true
+ },
+ "is-path-in-cwd": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz",
+ "integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==",
+ "dev": true,
+ "requires": {
+ "is-path-inside": "^2.1.0"
+ }
+ },
+ "is-path-inside": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz",
+ "integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==",
+ "dev": true,
+ "requires": {
+ "path-is-inside": "^1.0.2"
+ }
+ },
+ "is-plain-obj": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
+ "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=",
+ "dev": true
+ },
+ "is-plain-object": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
+ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
+ "requires": {
+ "isobject": "^3.0.1"
+ }
+ },
+ "is-regex": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz",
+ "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.3"
+ }
+ },
+ "is-resolvable": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz",
+ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==",
+ "dev": true
+ },
+ "is-stream": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
+ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
+ "dev": true
+ },
+ "is-svg": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-3.0.0.tgz",
+ "integrity": "sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ==",
+ "dev": true,
+ "requires": {
+ "html-comment-regex": "^1.1.0"
+ }
+ },
+ "is-symbol": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
+ "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==",
+ "dev": true,
+ "requires": {
+ "has-symbols": "^1.0.1"
+ }
+ },
+ "is-typedarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
+ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
+ "dev": true
+ },
+ "is-utf8": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
+ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
+ "dev": true
+ },
+ "is-windows": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
+ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA=="
+ },
+ "is-wsl": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
+ "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0="
+ },
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
+ },
+ "isobject": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
+ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8="
+ },
+ "isstream": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
+ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
+ "dev": true
+ },
+ "istanbul-lib-coverage": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz",
+ "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==",
+ "dev": true
+ },
+ "istanbul-lib-instrument": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz",
+ "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==",
+ "dev": true,
+ "requires": {
+ "@babel/core": "^7.7.5",
+ "@istanbuljs/schema": "^0.1.2",
+ "istanbul-lib-coverage": "^3.0.0",
+ "semver": "^6.3.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ }
+ }
+ },
+ "istanbul-lib-report": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
+ "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==",
+ "dev": true,
+ "requires": {
+ "istanbul-lib-coverage": "^3.0.0",
+ "make-dir": "^3.0.0",
+ "supports-color": "^7.1.0"
+ },
+ "dependencies": {
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "make-dir": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
+ "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
+ "dev": true,
+ "requires": {
+ "semver": "^6.0.0"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "istanbul-lib-source-maps": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz",
+ "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==",
+ "dev": true,
+ "requires": {
+ "debug": "^4.1.1",
+ "istanbul-lib-coverage": "^3.0.0",
+ "source-map": "^0.6.1"
+ },
+ "dependencies": {
+ "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
+ }
+ }
+ },
+ "istanbul-reports": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz",
+ "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==",
+ "dev": true,
+ "requires": {
+ "html-escaper": "^2.0.0",
+ "istanbul-lib-report": "^3.0.0"
+ }
+ },
+ "jest": {
+ "version": "25.5.4",
+ "resolved": "https://registry.npmjs.org/jest/-/jest-25.5.4.tgz",
+ "integrity": "sha512-hHFJROBTqZahnO+X+PMtT6G2/ztqAZJveGqz//FnWWHurizkD05PQGzRZOhF3XP6z7SJmL+5tCfW8qV06JypwQ==",
+ "dev": true,
+ "requires": {
+ "@jest/core": "^25.5.4",
+ "import-local": "^3.0.2",
+ "jest-cli": "^25.5.4"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "jest-cli": {
+ "version": "25.5.4",
+ "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.5.4.tgz",
+ "integrity": "sha512-rG8uJkIiOUpnREh1768/N3n27Cm+xPFkSNFO91tgg+8o2rXeVLStz+vkXkGr4UtzH6t1SNbjwoiswd7p4AhHTw==",
+ "dev": true,
+ "requires": {
+ "@jest/core": "^25.5.4",
+ "@jest/test-result": "^25.5.0",
+ "@jest/types": "^25.5.0",
+ "chalk": "^3.0.0",
+ "exit": "^0.1.2",
+ "graceful-fs": "^4.2.4",
+ "import-local": "^3.0.2",
+ "is-ci": "^2.0.0",
+ "jest-config": "^25.5.4",
+ "jest-util": "^25.5.0",
+ "jest-validate": "^25.5.0",
+ "prompts": "^2.0.1",
+ "realpath-native": "^2.0.0",
+ "yargs": "^15.3.1"
+ }
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-changed-files": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-25.5.0.tgz",
+ "integrity": "sha512-EOw9QEqapsDT7mKF162m8HFzRPbmP8qJQny6ldVOdOVBz3ACgPm/1nAn5fPQ/NDaYhX/AHkrGwwkCncpAVSXcw==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "execa": "^3.2.0",
+ "throat": "^5.0.0"
+ },
+ "dependencies": {
+ "cross-spawn": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
+ "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
+ "dev": true,
+ "requires": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ }
+ },
+ "execa": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz",
+ "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==",
+ "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",
+ "p-finally": "^2.0.0",
+ "signal-exit": "^3.0.2",
+ "strip-final-newline": "^2.0.0"
+ }
+ },
+ "get-stream": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz",
+ "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==",
+ "dev": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ },
+ "is-stream": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
+ "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==",
+ "dev": true
+ },
+ "npm-run-path": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "dev": true,
+ "requires": {
+ "path-key": "^3.0.0"
+ }
+ },
+ "p-finally": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz",
+ "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==",
+ "dev": true
+ },
+ "path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "dev": true
+ },
+ "shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^3.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "dev": true
+ }
+ }
+ },
+ "jest-config": {
+ "version": "25.5.4",
+ "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.5.4.tgz",
+ "integrity": "sha512-SZwR91SwcdK6bz7Gco8qL7YY2sx8tFJYzvg216DLihTWf+LKY/DoJXpM9nTzYakSyfblbqeU48p/p7Jzy05Atg==",
+ "dev": true,
+ "requires": {
+ "@babel/core": "^7.1.0",
+ "@jest/test-sequencer": "^25.5.4",
+ "@jest/types": "^25.5.0",
+ "babel-jest": "^25.5.1",
+ "chalk": "^3.0.0",
+ "deepmerge": "^4.2.2",
+ "glob": "^7.1.1",
+ "graceful-fs": "^4.2.4",
+ "jest-environment-jsdom": "^25.5.0",
+ "jest-environment-node": "^25.5.0",
+ "jest-get-type": "^25.2.6",
+ "jest-jasmine2": "^25.5.4",
+ "jest-regex-util": "^25.2.6",
+ "jest-resolve": "^25.5.1",
+ "jest-util": "^25.5.0",
+ "jest-validate": "^25.5.0",
+ "micromatch": "^4.0.2",
+ "pretty-format": "^25.5.0",
+ "realpath-native": "^2.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "jest-diff": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-25.5.0.tgz",
+ "integrity": "sha512-z1kygetuPiREYdNIumRpAHY6RXiGmp70YHptjdaxTWGmA085W3iCnXNx0DhflK3vwrKmrRWyY1wUpkPMVxMK7A==",
+ "dev": true,
+ "requires": {
+ "chalk": "^3.0.0",
+ "diff-sequences": "^25.2.6",
+ "jest-get-type": "^25.2.6",
+ "pretty-format": "^25.5.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-docblock": {
+ "version": "25.3.0",
+ "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-25.3.0.tgz",
+ "integrity": "sha512-aktF0kCar8+zxRHxQZwxMy70stc9R1mOmrLsT5VO3pIT0uzGRSDAXxSlz4NqQWpuLjPpuMhPRl7H+5FRsvIQAg==",
+ "dev": true,
+ "requires": {
+ "detect-newline": "^3.0.0"
+ }
+ },
+ "jest-each": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-25.5.0.tgz",
+ "integrity": "sha512-QBogUxna3D8vtiItvn54xXde7+vuzqRrEeaw8r1s+1TG9eZLVJE5ZkKoSUlqFwRjnlaA4hyKGiu9OlkFIuKnjA==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "chalk": "^3.0.0",
+ "jest-get-type": "^25.2.6",
+ "jest-util": "^25.5.0",
+ "pretty-format": "^25.5.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-environment-jsdom": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-25.5.0.tgz",
+ "integrity": "sha512-7Jr02ydaq4jaWMZLY+Skn8wL5nVIYpWvmeatOHL3tOcV3Zw8sjnPpx+ZdeBfc457p8jCR9J6YCc+Lga0oIy62A==",
+ "dev": true,
+ "requires": {
+ "@jest/environment": "^25.5.0",
+ "@jest/fake-timers": "^25.5.0",
+ "@jest/types": "^25.5.0",
+ "jest-mock": "^25.5.0",
+ "jest-util": "^25.5.0",
+ "jsdom": "^15.2.1"
+ }
+ },
+ "jest-environment-node": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-25.5.0.tgz",
+ "integrity": "sha512-iuxK6rQR2En9EID+2k+IBs5fCFd919gVVK5BeND82fYeLWPqvRcFNPKu9+gxTwfB5XwBGBvZ0HFQa+cHtIoslA==",
+ "dev": true,
+ "requires": {
+ "@jest/environment": "^25.5.0",
+ "@jest/fake-timers": "^25.5.0",
+ "@jest/types": "^25.5.0",
+ "jest-mock": "^25.5.0",
+ "jest-util": "^25.5.0",
+ "semver": "^6.3.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ }
+ }
+ },
+ "jest-get-type": {
+ "version": "25.2.6",
+ "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-25.2.6.tgz",
+ "integrity": "sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig==",
+ "dev": true
+ },
+ "jest-haste-map": {
+ "version": "25.5.1",
+ "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.5.1.tgz",
+ "integrity": "sha512-dddgh9UZjV7SCDQUrQ+5t9yy8iEgKc1AKqZR9YDww8xsVOtzPQSMVLDChc21+g29oTRexb9/B0bIlZL+sWmvAQ==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "@types/graceful-fs": "^4.1.2",
+ "anymatch": "^3.0.3",
+ "fb-watchman": "^2.0.0",
+ "fsevents": "^2.1.2",
+ "graceful-fs": "^4.2.4",
+ "jest-serializer": "^25.5.0",
+ "jest-util": "^25.5.0",
+ "jest-worker": "^25.5.0",
+ "micromatch": "^4.0.2",
+ "sane": "^4.0.3",
+ "walker": "^1.0.7",
+ "which": "^2.0.2"
+ },
+ "dependencies": {
+ "anymatch": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
+ "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
+ "dev": true,
+ "requires": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "fsevents": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
+ "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
+ "dev": true,
+ "optional": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "jest-jasmine2": {
+ "version": "25.5.4",
+ "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.5.4.tgz",
+ "integrity": "sha512-9acbWEfbmS8UpdcfqnDO+uBUgKa/9hcRh983IHdM+pKmJPL77G0sWAAK0V0kr5LK3a8cSBfkFSoncXwQlRZfkQ==",
+ "dev": true,
+ "requires": {
+ "@babel/traverse": "^7.1.0",
+ "@jest/environment": "^25.5.0",
+ "@jest/source-map": "^25.5.0",
+ "@jest/test-result": "^25.5.0",
+ "@jest/types": "^25.5.0",
+ "chalk": "^3.0.0",
+ "co": "^4.6.0",
+ "expect": "^25.5.0",
+ "is-generator-fn": "^2.0.0",
+ "jest-each": "^25.5.0",
+ "jest-matcher-utils": "^25.5.0",
+ "jest-message-util": "^25.5.0",
+ "jest-runtime": "^25.5.4",
+ "jest-snapshot": "^25.5.1",
+ "jest-util": "^25.5.0",
+ "pretty-format": "^25.5.0",
+ "throat": "^5.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-leak-detector": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-25.5.0.tgz",
+ "integrity": "sha512-rV7JdLsanS8OkdDpZtgBf61L5xZ4NnYLBq72r6ldxahJWWczZjXawRsoHyXzibM5ed7C2QRjpp6ypgwGdKyoVA==",
+ "dev": true,
+ "requires": {
+ "jest-get-type": "^25.2.6",
+ "pretty-format": "^25.5.0"
+ }
+ },
+ "jest-matcher-utils": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-25.5.0.tgz",
+ "integrity": "sha512-VWI269+9JS5cpndnpCwm7dy7JtGQT30UHfrnM3mXl22gHGt/b7NkjBqXfbhZ8V4B7ANUsjK18PlSBmG0YH7gjw==",
+ "dev": true,
+ "requires": {
+ "chalk": "^3.0.0",
+ "jest-diff": "^25.5.0",
+ "jest-get-type": "^25.2.6",
+ "pretty-format": "^25.5.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-message-util": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-25.5.0.tgz",
+ "integrity": "sha512-ezddz3YCT/LT0SKAmylVyWWIGYoKHOFOFXx3/nA4m794lfVUskMcwhip6vTgdVrOtYdjeQeis2ypzes9mZb4EA==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "@jest/types": "^25.5.0",
+ "@types/stack-utils": "^1.0.1",
+ "chalk": "^3.0.0",
+ "graceful-fs": "^4.2.4",
+ "micromatch": "^4.0.2",
+ "slash": "^3.0.0",
+ "stack-utils": "^1.0.1"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "jest-mock": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-25.5.0.tgz",
+ "integrity": "sha512-eXWuTV8mKzp/ovHc5+3USJMYsTBhyQ+5A1Mak35dey/RG8GlM4YWVylZuGgVXinaW6tpvk/RSecmF37FKUlpXA==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0"
+ }
+ },
+ "jest-pnp-resolver": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz",
+ "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==",
+ "dev": true
+ },
+ "jest-regex-util": {
+ "version": "25.2.6",
+ "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz",
+ "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==",
+ "dev": true
+ },
+ "jest-resolve": {
+ "version": "25.5.1",
+ "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-25.5.1.tgz",
+ "integrity": "sha512-Hc09hYch5aWdtejsUZhA+vSzcotf7fajSlPA6EZPE1RmPBAD39XtJhvHWFStid58iit4IPDLI/Da4cwdDmAHiQ==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "browser-resolve": "^1.11.3",
+ "chalk": "^3.0.0",
+ "graceful-fs": "^4.2.4",
+ "jest-pnp-resolver": "^1.2.1",
+ "read-pkg-up": "^7.0.1",
+ "realpath-native": "^2.0.0",
+ "resolve": "^1.17.0",
+ "slash": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-resolve-dependencies": {
+ "version": "25.5.4",
+ "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-25.5.4.tgz",
+ "integrity": "sha512-yFmbPd+DAQjJQg88HveObcGBA32nqNZ02fjYmtL16t1xw9bAttSn5UGRRhzMHIQbsep7znWvAvnD4kDqOFM0Uw==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "jest-regex-util": "^25.2.6",
+ "jest-snapshot": "^25.5.1"
+ }
+ },
+ "jest-runner": {
+ "version": "25.5.4",
+ "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.5.4.tgz",
+ "integrity": "sha512-V/2R7fKZo6blP8E9BL9vJ8aTU4TH2beuqGNxHbxi6t14XzTb+x90B3FRgdvuHm41GY8ch4xxvf0ATH4hdpjTqg==",
+ "dev": true,
+ "requires": {
+ "@jest/console": "^25.5.0",
+ "@jest/environment": "^25.5.0",
+ "@jest/test-result": "^25.5.0",
+ "@jest/types": "^25.5.0",
+ "chalk": "^3.0.0",
+ "exit": "^0.1.2",
+ "graceful-fs": "^4.2.4",
+ "jest-config": "^25.5.4",
+ "jest-docblock": "^25.3.0",
+ "jest-haste-map": "^25.5.1",
+ "jest-jasmine2": "^25.5.4",
+ "jest-leak-detector": "^25.5.0",
+ "jest-message-util": "^25.5.0",
+ "jest-resolve": "^25.5.1",
+ "jest-runtime": "^25.5.4",
+ "jest-util": "^25.5.0",
+ "jest-worker": "^25.5.0",
+ "source-map-support": "^0.5.6",
+ "throat": "^5.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-runtime": {
+ "version": "25.5.4",
+ "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.5.4.tgz",
+ "integrity": "sha512-RWTt8LeWh3GvjYtASH2eezkc8AehVoWKK20udV6n3/gC87wlTbE1kIA+opCvNWyyPeBs6ptYsc6nyHUb1GlUVQ==",
+ "dev": true,
+ "requires": {
+ "@jest/console": "^25.5.0",
+ "@jest/environment": "^25.5.0",
+ "@jest/globals": "^25.5.2",
+ "@jest/source-map": "^25.5.0",
+ "@jest/test-result": "^25.5.0",
+ "@jest/transform": "^25.5.1",
+ "@jest/types": "^25.5.0",
+ "@types/yargs": "^15.0.0",
+ "chalk": "^3.0.0",
+ "collect-v8-coverage": "^1.0.0",
+ "exit": "^0.1.2",
+ "glob": "^7.1.3",
+ "graceful-fs": "^4.2.4",
+ "jest-config": "^25.5.4",
+ "jest-haste-map": "^25.5.1",
+ "jest-message-util": "^25.5.0",
+ "jest-mock": "^25.5.0",
+ "jest-regex-util": "^25.2.6",
+ "jest-resolve": "^25.5.1",
+ "jest-snapshot": "^25.5.1",
+ "jest-util": "^25.5.0",
+ "jest-validate": "^25.5.0",
+ "realpath-native": "^2.0.0",
+ "slash": "^3.0.0",
+ "strip-bom": "^4.0.0",
+ "yargs": "^15.3.1"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-serializer": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.5.0.tgz",
+ "integrity": "sha512-LxD8fY1lByomEPflwur9o4e2a5twSQ7TaVNLlFUuToIdoJuBt8tzHfCsZ42Ok6LkKXWzFWf3AGmheuLAA7LcCA==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.2.4"
+ },
+ "dependencies": {
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ }
+ }
+ },
+ "jest-snapshot": {
+ "version": "25.5.1",
+ "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-25.5.1.tgz",
+ "integrity": "sha512-C02JE1TUe64p2v1auUJ2ze5vcuv32tkv9PyhEb318e8XOKF7MOyXdJ7kdjbvrp3ChPLU2usI7Rjxs97Dj5P0uQ==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.0.0",
+ "@jest/types": "^25.5.0",
+ "@types/prettier": "^1.19.0",
+ "chalk": "^3.0.0",
+ "expect": "^25.5.0",
+ "graceful-fs": "^4.2.4",
+ "jest-diff": "^25.5.0",
+ "jest-get-type": "^25.2.6",
+ "jest-matcher-utils": "^25.5.0",
+ "jest-message-util": "^25.5.0",
+ "jest-resolve": "^25.5.1",
+ "make-dir": "^3.0.0",
+ "natural-compare": "^1.4.0",
+ "pretty-format": "^25.5.0",
+ "semver": "^6.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "make-dir": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
+ "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
+ "dev": true,
+ "requires": {
+ "semver": "^6.0.0"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-util": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.5.0.tgz",
+ "integrity": "sha512-KVlX+WWg1zUTB9ktvhsg2PXZVdkI1NBevOJSkTKYAyXyH4QSvh+Lay/e/v+bmaFfrkfx43xD8QTfgobzlEXdIA==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "chalk": "^3.0.0",
+ "graceful-fs": "^4.2.4",
+ "is-ci": "^2.0.0",
+ "make-dir": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "graceful-fs": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "make-dir": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
+ "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
+ "dev": true,
+ "requires": {
+ "semver": "^6.0.0"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-validate": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-25.5.0.tgz",
+ "integrity": "sha512-okUFKqhZIpo3jDdtUXUZ2LxGUZJIlfdYBvZb1aczzxrlyMlqdnnws9MOxezoLGhSaFc2XYaHNReNQfj5zPIWyQ==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "camelcase": "^5.3.1",
+ "chalk": "^3.0.0",
+ "jest-get-type": "^25.2.6",
+ "leven": "^3.1.0",
+ "pretty-format": "^25.5.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-watcher": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-25.5.0.tgz",
+ "integrity": "sha512-XrSfJnVASEl+5+bb51V0Q7WQx65dTSk7NL4yDdVjPnRNpM0hG+ncFmDYJo9O8jaSRcAitVbuVawyXCRoxGrT5Q==",
+ "dev": true,
+ "requires": {
+ "@jest/test-result": "^25.5.0",
+ "@jest/types": "^25.5.0",
+ "ansi-escapes": "^4.2.1",
+ "chalk": "^3.0.0",
+ "jest-util": "^25.5.0",
+ "string-length": "^3.1.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "jest-worker": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.5.0.tgz",
+ "integrity": "sha512-/dsSmUkIy5EBGfv/IjjqmFxrNAUpBERfGs1oHROyD7yxjG/w+t0GOJDX8O1k32ySmd7+a5IhnJU2qQFcJ4n1vw==",
+ "dev": true,
+ "requires": {
+ "merge-stream": "^2.0.0",
+ "supports-color": "^7.0.0"
+ },
+ "dependencies": {
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "js-base64": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz",
+ "integrity": "sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ==",
+ "dev": true
+ },
+ "js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
+ },
+ "js-yaml": {
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
+ "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
+ "dev": true,
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
+ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
+ "dev": true
+ },
+ "jsdom": {
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz",
+ "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==",
+ "dev": true,
+ "requires": {
+ "abab": "^2.0.0",
+ "acorn": "^7.1.0",
+ "acorn-globals": "^4.3.2",
+ "array-equal": "^1.0.0",
+ "cssom": "^0.4.1",
+ "cssstyle": "^2.0.0",
+ "data-urls": "^1.1.0",
+ "domexception": "^1.0.1",
+ "escodegen": "^1.11.1",
+ "html-encoding-sniffer": "^1.0.2",
+ "nwsapi": "^2.2.0",
+ "parse5": "5.1.0",
+ "pn": "^1.1.0",
+ "request": "^2.88.0",
+ "request-promise-native": "^1.0.7",
+ "saxes": "^3.1.9",
+ "symbol-tree": "^3.2.2",
+ "tough-cookie": "^3.0.1",
+ "w3c-hr-time": "^1.0.1",
+ "w3c-xmlserializer": "^1.1.2",
+ "webidl-conversions": "^4.0.2",
+ "whatwg-encoding": "^1.0.5",
+ "whatwg-mimetype": "^2.3.0",
+ "whatwg-url": "^7.0.0",
+ "ws": "^7.0.0",
+ "xml-name-validator": "^3.0.0"
+ },
+ "dependencies": {
+ "acorn": {
+ "version": "7.3.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.0.tgz",
+ "integrity": "sha512-Q/reetejf1Yf8vY7wyZI8DOsrMr9r7RfnDYBVjIdE61Rk8atUkbV1Kyi/diJzgAWiDiHEPWpNoqpPb+2CUbudQ==",
+ "dev": true
+ }
+ }
+ },
+ "jsesc": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
+ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA=="
+ },
+ "json-parse-better-errors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
+ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
+ },
+ "json-schema": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
+ "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
+ "dev": true
+ },
+ "json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
+ },
+ "json-stringify-safe": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
+ "dev": true
+ },
+ "json3": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.3.tgz",
+ "integrity": "sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA==",
+ "dev": true
+ },
+ "json5": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
+ "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
+ "requires": {
+ "minimist": "^1.2.0"
+ }
+ },
+ "jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
+ "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "jsprim": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
+ "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "1.0.0",
+ "extsprintf": "1.3.0",
+ "json-schema": "0.2.3",
+ "verror": "1.10.0"
+ }
+ },
+ "killable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz",
+ "integrity": "sha512-LzqtLKlUwirEUyl/nicirVmNiPvYs7l5n8wOPP7fyJVpUPkvCnW/vuiXGpylGUlnPDnB7311rARzAt3Mhswpjg==",
+ "dev": true
+ },
+ "kind-of": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
+ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="
+ },
+ "kleur": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
+ "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==",
+ "dev": true
+ },
+ "leven": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
+ "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==",
+ "dev": true
+ },
+ "levn": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2"
+ }
+ },
+ "lines-and-columns": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
+ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=",
+ "dev": true
+ },
+ "linkify-it": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz",
+ "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==",
+ "requires": {
+ "uc.micro": "^1.0.1"
+ }
+ },
+ "load-json-file": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
+ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^2.2.0",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0",
+ "strip-bom": "^2.0.0"
+ },
+ "dependencies": {
+ "parse-json": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
+ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.2.0"
+ }
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ },
+ "strip-bom": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
+ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
+ "dev": true,
+ "requires": {
+ "is-utf8": "^0.2.0"
+ }
+ }
+ }
+ },
+ "loader-runner": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz",
+ "integrity": "sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw=="
+ },
+ "loader-utils": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz",
+ "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==",
+ "requires": {
+ "big.js": "^5.2.2",
+ "emojis-list": "^3.0.0",
+ "json5": "^1.0.1"
+ }
+ },
+ "locate-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
+ "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
+ "requires": {
+ "p-locate": "^3.0.0",
+ "path-exists": "^3.0.0"
+ }
+ },
+ "lodash": {
+ "version": "4.17.20",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
+ "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
+ },
+ "lodash.memoize": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
+ "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
+ "dev": true
+ },
+ "lodash.sortby": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
+ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
+ "dev": true
+ },
+ "lodash.uniq": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
+ "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=",
+ "dev": true
+ },
+ "loglevel": {
+ "version": "1.6.8",
+ "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.8.tgz",
+ "integrity": "sha512-bsU7+gc9AJ2SqpzxwU3+1fedl8zAntbtC5XYlt3s2j1hJcn2PsXSmgN8TaLG/J1/2mod4+cE/3vNL70/c1RNCA==",
+ "dev": true
+ },
+ "lolex": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz",
+ "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.7.0"
+ }
+ },
+ "loose-envify": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "requires": {
+ "js-tokens": "^3.0.0 || ^4.0.0"
+ }
+ },
+ "loud-rejection": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz",
+ "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=",
+ "dev": true,
+ "requires": {
+ "currently-unhandled": "^0.4.1",
+ "signal-exit": "^3.0.0"
+ }
+ },
+ "lru-cache": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
+ "requires": {
+ "yallist": "^3.0.2"
+ }
+ },
+ "make-dir": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
+ "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
+ "requires": {
+ "pify": "^4.0.1",
+ "semver": "^5.6.0"
+ }
+ },
+ "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
+ },
+ "makeerror": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz",
+ "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=",
+ "dev": true,
+ "requires": {
+ "tmpl": "1.0.x"
+ }
+ },
+ "map-cache": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
+ "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8="
+ },
+ "map-obj": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
+ "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
+ "dev": true
+ },
+ "map-visit": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
+ "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=",
+ "requires": {
+ "object-visit": "^1.0.0"
+ }
+ },
+ "markdown-it": {
+ "version": "9.1.0",
+ "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-9.1.0.tgz",
+ "integrity": "sha512-xHKG4C8iPriyfu/jc2hsCC045fKrMQ0VexX2F1FGYiRxDxqMB2aAhF8WauJ3fltn2kb90moGBkiiEdooGIg55w==",
+ "requires": {
+ "argparse": "^1.0.7",
+ "entities": "~1.1.1",
+ "linkify-it": "^2.0.0",
+ "mdurl": "^1.0.1",
+ "uc.micro": "^1.0.5"
+ }
+ },
+ "md5.js": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
+ "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==",
+ "requires": {
+ "hash-base": "^3.0.0",
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.1.2"
+ }
+ },
+ "mdn-data": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz",
+ "integrity": "sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA==",
+ "dev": true
+ },
+ "mdurl": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
+ "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4="
+ },
+ "media-typer": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+ "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
+ "dev": true
+ },
+ "memory-fs": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
+ "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=",
+ "requires": {
+ "errno": "^0.1.3",
+ "readable-stream": "^2.0.1"
+ }
+ },
+ "meow": {
+ "version": "3.7.0",
+ "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
+ "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=",
+ "dev": true,
+ "requires": {
+ "camelcase-keys": "^2.0.0",
+ "decamelize": "^1.1.2",
+ "loud-rejection": "^1.0.0",
+ "map-obj": "^1.0.1",
+ "minimist": "^1.1.3",
+ "normalize-package-data": "^2.3.4",
+ "object-assign": "^4.0.1",
+ "read-pkg-up": "^1.0.1",
+ "redent": "^1.0.0",
+ "trim-newlines": "^1.0.0"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
+ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
+ "dev": true,
+ "requires": {
+ "path-exists": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "path-exists": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
+ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
+ "dev": true,
+ "requires": {
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "read-pkg": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
+ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "^1.0.0",
+ "normalize-package-data": "^2.3.2",
+ "path-type": "^1.0.0"
+ }
+ },
+ "read-pkg-up": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
+ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
+ "dev": true,
+ "requires": {
+ "find-up": "^1.0.0",
+ "read-pkg": "^1.0.0"
+ }
+ }
+ }
+ },
+ "merge-descriptors": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
+ "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=",
+ "dev": true
+ },
+ "merge-stream": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
+ "dev": true
+ },
+ "methods": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
+ "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "3.1.10",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
+ "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
+ "requires": {
+ "arr-diff": "^4.0.0",
+ "array-unique": "^0.3.2",
+ "braces": "^2.3.1",
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "extglob": "^2.0.4",
+ "fragment-cache": "^0.2.1",
+ "kind-of": "^6.0.2",
+ "nanomatch": "^1.2.9",
+ "object.pick": "^1.3.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.2"
+ }
+ },
+ "miller-rabin": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz",
+ "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==",
+ "requires": {
+ "bn.js": "^4.0.0",
+ "brorand": "^1.0.1"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw=="
+ }
+ }
+ },
+ "mime": {
+ "version": "2.4.4",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
+ "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==",
+ "dev": true
+ },
+ "mime-db": {
+ "version": "1.44.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
+ "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==",
+ "dev": true
+ },
+ "mime-types": {
+ "version": "2.1.27",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
+ "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
+ "dev": true,
+ "requires": {
+ "mime-db": "1.44.0"
+ }
+ },
+ "mimic-fn": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
+ "dev": true
+ },
+ "min-document": {
+ "version": "2.19.0",
+ "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz",
+ "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=",
+ "requires": {
+ "dom-walk": "^0.1.0"
+ }
+ },
+ "mini-create-react-context": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.0.tgz",
+ "integrity": "sha512-b0TytUgFSbgFJGzJqXPKCFCBWigAjpjo+Fl7Vf7ZbKRDptszpppKxXH6DRXEABZ/gcEQczeb0iZ7JvL8e8jjCA==",
+ "requires": {
+ "@babel/runtime": "^7.5.5",
+ "tiny-warning": "^1.0.3"
+ }
+ },
+ "mini-css-extract-plugin": {
+ "version": "0.9.0",
+ "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz",
+ "integrity": "sha512-lp3GeY7ygcgAmVIcRPBVhIkf8Us7FZjA+ILpal44qLdSu11wmjKQ3d9k15lfD7pO4esu9eUIAW7qiYIBppv40A==",
+ "dev": true,
+ "requires": {
+ "loader-utils": "^1.1.0",
+ "normalize-url": "1.9.1",
+ "schema-utils": "^1.0.0",
+ "webpack-sources": "^1.1.0"
+ },
+ "dependencies": {
+ "normalize-url": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz",
+ "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=",
+ "dev": true,
+ "requires": {
+ "object-assign": "^4.0.1",
+ "prepend-http": "^1.0.0",
+ "query-string": "^4.1.0",
+ "sort-keys": "^1.0.0"
+ }
+ }
+ }
+ },
+ "minimalistic-assert": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
+ "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
+ },
+ "minimalistic-crypto-utils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
+ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo="
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
+ },
+ "mississippi": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz",
+ "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==",
+ "requires": {
+ "concat-stream": "^1.5.0",
+ "duplexify": "^3.4.2",
+ "end-of-stream": "^1.1.0",
+ "flush-write-stream": "^1.0.0",
+ "from2": "^2.1.0",
+ "parallel-transform": "^1.1.0",
+ "pump": "^3.0.0",
+ "pumpify": "^1.3.3",
+ "stream-each": "^1.1.0",
+ "through2": "^2.0.0"
+ }
+ },
+ "mixin-deep": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
+ "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
+ "requires": {
+ "for-in": "^1.0.2",
+ "is-extendable": "^1.0.1"
+ },
+ "dependencies": {
+ "is-extendable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
+ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
+ "requires": {
+ "is-plain-object": "^2.0.4"
+ }
+ }
+ }
+ },
+ "mkdirp": {
+ "version": "0.5.5",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
+ "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "move-concurrently": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
+ "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=",
+ "requires": {
+ "aproba": "^1.1.1",
+ "copy-concurrently": "^1.0.0",
+ "fs-write-stream-atomic": "^1.0.8",
+ "mkdirp": "^0.5.1",
+ "rimraf": "^2.5.4",
+ "run-queue": "^1.0.3"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
+ },
+ "multicast-dns": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz",
+ "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==",
+ "dev": true,
+ "requires": {
+ "dns-packet": "^1.3.1",
+ "thunky": "^1.0.2"
+ }
+ },
+ "multicast-dns-service-types": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz",
+ "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=",
+ "dev": true
+ },
+ "nan": {
+ "version": "2.14.1",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
+ "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw=="
+ },
+ "nanomatch": {
+ "version": "1.2.13",
+ "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
+ "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==",
+ "requires": {
+ "arr-diff": "^4.0.0",
+ "array-unique": "^0.3.2",
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "fragment-cache": "^0.2.1",
+ "is-windows": "^1.0.2",
+ "kind-of": "^6.0.2",
+ "object.pick": "^1.3.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ }
+ },
+ "natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
+ "dev": true
+ },
+ "negotiator": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
+ "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
+ "dev": true
+ },
+ "neo-async": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
+ "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw=="
+ },
+ "nice-try": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
+ "dev": true
+ },
+ "node-forge": {
+ "version": "0.10.0",
+ "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
+ "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==",
+ "dev": true
+ },
+ "node-gyp": {
+ "version": "3.8.0",
+ "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz",
+ "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==",
+ "dev": true,
+ "requires": {
+ "fstream": "^1.0.0",
+ "glob": "^7.0.3",
+ "graceful-fs": "^4.1.2",
+ "mkdirp": "^0.5.0",
+ "nopt": "2 || 3",
+ "npmlog": "0 || 1 || 2 || 3 || 4",
+ "osenv": "0",
+ "request": "^2.87.0",
+ "rimraf": "2",
+ "semver": "~5.3.0",
+ "tar": "^2.0.0",
+ "which": "1"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
+ "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=",
+ "dev": true
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ }
+ }
+ },
+ "node-int64": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
+ "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=",
+ "dev": true
+ },
+ "node-libs-browser": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz",
+ "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==",
+ "requires": {
+ "assert": "^1.1.1",
+ "browserify-zlib": "^0.2.0",
+ "buffer": "^4.3.0",
+ "console-browserify": "^1.1.0",
+ "constants-browserify": "^1.0.0",
+ "crypto-browserify": "^3.11.0",
+ "domain-browser": "^1.1.1",
+ "events": "^3.0.0",
+ "https-browserify": "^1.0.0",
+ "os-browserify": "^0.3.0",
+ "path-browserify": "0.0.1",
+ "process": "^0.11.10",
+ "punycode": "^1.2.4",
+ "querystring-es3": "^0.2.0",
+ "readable-stream": "^2.3.3",
+ "stream-browserify": "^2.0.1",
+ "stream-http": "^2.7.2",
+ "string_decoder": "^1.0.0",
+ "timers-browserify": "^2.0.4",
+ "tty-browserify": "0.0.0",
+ "url": "^0.11.0",
+ "util": "^0.11.0",
+ "vm-browserify": "^1.0.1"
+ },
+ "dependencies": {
+ "punycode": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
+ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
+ }
+ }
+ },
+ "node-modules-regexp": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz",
+ "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=",
+ "dev": true
+ },
+ "node-notifier": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-6.0.0.tgz",
+ "integrity": "sha512-SVfQ/wMw+DesunOm5cKqr6yDcvUTDl/yc97ybGHMrteNEY6oekXpNpS3lZwgLlwz0FLgHoiW28ZpmBHUDg37cw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "growly": "^1.3.0",
+ "is-wsl": "^2.1.1",
+ "semver": "^6.3.0",
+ "shellwords": "^0.1.1",
+ "which": "^1.3.1"
+ },
+ "dependencies": {
+ "is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "is-docker": "^2.0.0"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true,
+ "optional": true
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ }
+ }
+ },
+ "node-releases": {
+ "version": "1.1.53",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.53.tgz",
+ "integrity": "sha512-wp8zyQVwef2hpZ/dJH7SfSrIPD6YoJz6BDQDpGEkcA0s3LpAQoxBIYmfIq6QAhC1DhwsyCgTaTTcONwX8qzCuQ==",
+ "dev": true
+ },
+ "node-sass": {
+ "version": "4.14.1",
+ "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz",
+ "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==",
+ "dev": true,
+ "requires": {
+ "async-foreach": "^0.1.3",
+ "chalk": "^1.1.1",
+ "cross-spawn": "^3.0.0",
+ "gaze": "^1.0.0",
+ "get-stdin": "^4.0.1",
+ "glob": "^7.0.3",
+ "in-publish": "^2.0.0",
+ "lodash": "^4.17.15",
+ "meow": "^3.7.0",
+ "mkdirp": "^0.5.1",
+ "nan": "^2.13.2",
+ "node-gyp": "^3.8.0",
+ "npmlog": "^4.0.0",
+ "request": "^2.88.0",
+ "sass-graph": "2.2.5",
+ "stdout-stream": "^1.4.0",
+ "true-case-path": "^1.0.2"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
+ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^2.2.1",
+ "escape-string-regexp": "^1.0.2",
+ "has-ansi": "^2.0.0",
+ "strip-ansi": "^3.0.0",
+ "supports-color": "^2.0.0"
+ }
+ },
+ "cross-spawn": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz",
+ "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^4.0.1",
+ "which": "^1.2.9"
+ }
+ },
+ "lru-cache": {
+ "version": "4.1.5",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
+ "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
+ "dev": true,
+ "requires": {
+ "pseudomap": "^1.0.2",
+ "yallist": "^2.1.2"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "supports-color": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
+ "dev": true
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "yallist": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
+ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
+ "dev": true
+ }
+ }
+ },
+ "nopt": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
+ "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=",
+ "dev": true,
+ "requires": {
+ "abbrev": "1"
+ }
+ },
+ "normalize-package-data": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
+ "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
+ "dev": true,
+ "requires": {
+ "hosted-git-info": "^2.1.4",
+ "resolve": "^1.10.0",
+ "semver": "2 || 3 || 4 || 5",
+ "validate-npm-package-license": "^3.0.1"
+ }
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
+ },
+ "normalize-range": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
+ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=",
+ "dev": true
+ },
+ "normalize-url": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz",
+ "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==",
+ "dev": true
+ },
+ "npm-run-path": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
+ "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
+ "dev": true,
+ "requires": {
+ "path-key": "^2.0.0"
+ }
+ },
+ "npmlog": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
+ "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
+ "dev": true,
+ "requires": {
+ "are-we-there-yet": "~1.1.2",
+ "console-control-strings": "~1.1.0",
+ "gauge": "~2.7.3",
+ "set-blocking": "~2.0.0"
+ }
+ },
+ "nth-check": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
+ "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==",
+ "dev": true,
+ "requires": {
+ "boolbase": "~1.0.0"
+ }
+ },
+ "num2fraction": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz",
+ "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=",
+ "dev": true
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
+ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
+ "dev": true
+ },
+ "nwsapi": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz",
+ "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==",
+ "dev": true
+ },
+ "oauth-sign": {
+ "version": "0.9.0",
+ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
+ "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
+ "dev": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
+ },
+ "object-copy": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
+ "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=",
+ "requires": {
+ "copy-descriptor": "^0.1.0",
+ "define-property": "^0.2.5",
+ "kind-of": "^3.0.3"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "object-inspect": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
+ "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==",
+ "dev": true
+ },
+ "object-is": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.2.tgz",
+ "integrity": "sha512-5lHCz+0uufF6wZ7CRFWJN3hp8Jqblpgve06U5CMQ3f//6iDjPr2PEo9MWCjEssDsa+UZEL4PkFpr+BMop6aKzQ==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.5"
+ }
+ },
+ "object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "dev": true
+ },
+ "object-visit": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
+ "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=",
+ "requires": {
+ "isobject": "^3.0.0"
+ }
+ },
+ "object.assign": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz",
+ "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "function-bind": "^1.1.1",
+ "has-symbols": "^1.0.0",
+ "object-keys": "^1.0.11"
+ }
+ },
+ "object.entries": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.1.tgz",
+ "integrity": "sha512-ilqR7BgdyZetJutmDPfXCDffGa0/Yzl2ivVNpbx/g4UeWrCdRnFDUBrKJGLhGieRHDATnyZXWBeCb29k9CJysQ==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.0-next.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3"
+ }
+ },
+ "object.getownpropertydescriptors": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz",
+ "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.0-next.1"
+ }
+ },
+ "object.pick": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz",
+ "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=",
+ "requires": {
+ "isobject": "^3.0.1"
+ }
+ },
+ "object.values": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz",
+ "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.0-next.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3"
+ }
+ },
+ "obuf": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz",
+ "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==",
+ "dev": true
+ },
+ "on-finished": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
+ "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
+ "dev": true,
+ "requires": {
+ "ee-first": "1.1.1"
+ }
+ },
+ "on-headers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
+ "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
+ "dev": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "onetime": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz",
+ "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==",
+ "dev": true,
+ "requires": {
+ "mimic-fn": "^2.1.0"
+ }
+ },
+ "opn": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/opn/-/opn-5.5.0.tgz",
+ "integrity": "sha512-PqHpggC9bLV0VeWcdKhkpxY+3JTzetLSqTCWL/z/tFIbI6G8JCjondXklT1JinczLz2Xib62sSp0T/gKT4KksA==",
+ "dev": true,
+ "requires": {
+ "is-wsl": "^1.1.0"
+ }
+ },
+ "optionator": {
+ "version": "0.8.3",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
+ "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
+ "dev": true,
+ "requires": {
+ "deep-is": "~0.1.3",
+ "fast-levenshtein": "~2.0.6",
+ "levn": "~0.3.0",
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2",
+ "word-wrap": "~1.2.3"
+ }
+ },
+ "original": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz",
+ "integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==",
+ "dev": true,
+ "requires": {
+ "url-parse": "^1.4.3"
+ }
+ },
+ "os-browserify": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz",
+ "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc="
+ },
+ "os-homedir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
+ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
+ "dev": true
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
+ "dev": true
+ },
+ "osenv": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
+ "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
+ "dev": true,
+ "requires": {
+ "os-homedir": "^1.0.0",
+ "os-tmpdir": "^1.0.0"
+ }
+ },
+ "p-each-series": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz",
+ "integrity": "sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==",
+ "dev": true
+ },
+ "p-finally": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
+ "dev": true
+ },
+ "p-limit": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+ "requires": {
+ "p-try": "^2.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
+ "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
+ "requires": {
+ "p-limit": "^2.0.0"
+ }
+ },
+ "p-map": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz",
+ "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==",
+ "dev": true
+ },
+ "p-retry": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-3.0.1.tgz",
+ "integrity": "sha512-XE6G4+YTTkT2a0UWb2kjZe8xNwf8bIbnqpc/IS/idOBVhyves0mK5OJgeocjx7q5pvX/6m23xuzVPYT1uGM73w==",
+ "dev": true,
+ "requires": {
+ "retry": "^0.12.0"
+ }
+ },
+ "p-try": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
+ },
+ "pako": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
+ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
+ },
+ "parallel-transform": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.2.0.tgz",
+ "integrity": "sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==",
+ "requires": {
+ "cyclist": "^1.0.1",
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.1.5"
+ }
+ },
+ "parse-asn1": {
+ "version": "5.1.6",
+ "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz",
+ "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==",
+ "requires": {
+ "asn1.js": "^5.2.0",
+ "browserify-aes": "^1.0.0",
+ "evp_bytestokey": "^1.0.0",
+ "pbkdf2": "^3.0.3",
+ "safe-buffer": "^5.1.1"
+ }
+ },
+ "parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.3.1",
+ "json-parse-better-errors": "^1.0.1"
+ }
+ },
+ "parse-passwd": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz",
+ "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
+ "dev": true
+ },
+ "parse5": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz",
+ "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==",
+ "dev": true
+ },
+ "parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "dev": true
+ },
+ "pascalcase": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz",
+ "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ="
+ },
+ "path-browserify": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz",
+ "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ=="
+ },
+ "path-dirname": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz",
+ "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA="
+ },
+ "path-exists": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
+ },
+ "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="
+ },
+ "path-is-inside": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
+ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",
+ "dev": true
+ },
+ "path-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
+ "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
+ },
+ "path-to-regexp": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
+ "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
+ "requires": {
+ "isarray": "0.0.1"
+ }
+ },
+ "path-type": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
+ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ }
+ }
+ },
+ "pbkdf2": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz",
+ "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==",
+ "requires": {
+ "create-hash": "^1.1.2",
+ "create-hmac": "^1.1.4",
+ "ripemd160": "^2.0.1",
+ "safe-buffer": "^5.0.1",
+ "sha.js": "^2.4.8"
+ }
+ },
+ "performance-now": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
+ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
+ "dev": true
+ },
+ "picomatch": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
+ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg=="
+ },
+ "pify": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
+ "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g=="
+ },
+ "pinkie": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
+ "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
+ "dev": true
+ },
+ "pinkie-promise": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
+ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
+ "dev": true,
+ "requires": {
+ "pinkie": "^2.0.0"
+ }
+ },
+ "pirates": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz",
+ "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==",
+ "dev": true,
+ "requires": {
+ "node-modules-regexp": "^1.0.0"
+ }
+ },
+ "pkg-dir": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz",
+ "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==",
+ "requires": {
+ "find-up": "^3.0.0"
+ }
+ },
+ "pkg-up": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz",
+ "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=",
+ "dev": true,
+ "requires": {
+ "find-up": "^2.1.0"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
+ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
+ "dev": true,
+ "requires": {
+ "locate-path": "^2.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
+ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
+ "dev": true,
+ "requires": {
+ "p-locate": "^2.0.0",
+ "path-exists": "^3.0.0"
+ }
+ },
+ "p-limit": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
+ "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
+ "dev": true,
+ "requires": {
+ "p-try": "^1.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
+ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
+ "dev": true,
+ "requires": {
+ "p-limit": "^1.1.0"
+ }
+ },
+ "p-try": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
+ "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",
+ "dev": true
+ }
+ }
+ },
+ "pn": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz",
+ "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==",
+ "dev": true
+ },
+ "portfinder": {
+ "version": "1.0.26",
+ "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.26.tgz",
+ "integrity": "sha512-Xi7mKxJHHMI3rIUrnm/jjUgwhbYMkp/XKEcZX3aG4BrumLpq3nmoQMX+ClYnDZnZ/New7IatC1no5RX0zo1vXQ==",
+ "dev": true,
+ "requires": {
+ "async": "^2.6.2",
+ "debug": "^3.1.1",
+ "mkdirp": "^0.5.1"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
+ "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ }
+ }
+ },
+ "posix-character-classes": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
+ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs="
+ },
+ "postcss": {
+ "version": "7.0.27",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.27.tgz",
+ "integrity": "sha512-WuQETPMcW9Uf1/22HWUWP9lgsIC+KEHg2kozMflKjbeUtw9ujvFX6QmIfozaErDkmLWS9WEnEdEe6Uo9/BNTdQ==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "source-map": "^0.6.1",
+ "supports-color": "^6.1.0"
+ },
+ "dependencies": {
+ "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
+ },
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "postcss-calc": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-7.0.2.tgz",
+ "integrity": "sha512-rofZFHUg6ZIrvRwPeFktv06GdbDYLcGqh9EwiMutZg+a0oePCCw1zHOEiji6LCpyRcjTREtPASuUqeAvYlEVvQ==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.27",
+ "postcss-selector-parser": "^6.0.2",
+ "postcss-value-parser": "^4.0.2"
+ }
+ },
+ "postcss-colormin": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-4.0.3.tgz",
+ "integrity": "sha512-WyQFAdDZpExQh32j0U0feWisZ0dmOtPl44qYmJKkq9xFWY3p+4qnRzCHeNrkeRhwPHz9bQ3mo0/yVkaply0MNw==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.0.0",
+ "color": "^3.0.0",
+ "has": "^1.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-convert-values": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-4.0.1.tgz",
+ "integrity": "sha512-Kisdo1y77KUC0Jmn0OXU/COOJbzM8cImvw1ZFsBgBgMgb1iL23Zs/LXRe3r+EZqM3vGYKdQ2YJVQ5VkJI+zEJQ==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-discard-comments": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-4.0.2.tgz",
+ "integrity": "sha512-RJutN259iuRf3IW7GZyLM5Sw4GLTOH8FmsXBnv8Ab/Tc2k4SR4qbV4DNbyyY4+Sjo362SyDmW2DQ7lBSChrpkg==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.0"
+ }
+ },
+ "postcss-discard-duplicates": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.2.tgz",
+ "integrity": "sha512-ZNQfR1gPNAiXZhgENFfEglF93pciw0WxMkJeVmw8eF+JZBbMD7jp6C67GqJAXVZP2BWbOztKfbsdmMp/k8c6oQ==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.0"
+ }
+ },
+ "postcss-discard-empty": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-4.0.1.tgz",
+ "integrity": "sha512-B9miTzbznhDjTfjvipfHoqbWKwd0Mj+/fL5s1QOz06wufguil+Xheo4XpOnc4NqKYBCNqqEzgPv2aPBIJLox0w==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.0"
+ }
+ },
+ "postcss-discard-overridden": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-4.0.1.tgz",
+ "integrity": "sha512-IYY2bEDD7g1XM1IDEsUT4//iEYCxAmP5oDSFMVU/JVvT7gh+l4fmjciLqGgwjdWpQIdb0Che2VX00QObS5+cTg==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.0"
+ }
+ },
+ "postcss-load-config": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-2.1.0.tgz",
+ "integrity": "sha512-4pV3JJVPLd5+RueiVVB+gFOAa7GWc25XQcMp86Zexzke69mKf6Nx9LRcQywdz7yZI9n1udOxmLuAwTBypypF8Q==",
+ "dev": true,
+ "requires": {
+ "cosmiconfig": "^5.0.0",
+ "import-cwd": "^2.0.0"
+ }
+ },
+ "postcss-loader": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-3.0.0.tgz",
+ "integrity": "sha512-cLWoDEY5OwHcAjDnkyRQzAXfs2jrKjXpO/HQFcc5b5u/r7aa471wdmChmwfnv7x2u840iat/wi0lQ5nbRgSkUA==",
+ "dev": true,
+ "requires": {
+ "loader-utils": "^1.1.0",
+ "postcss": "^7.0.0",
+ "postcss-load-config": "^2.0.0",
+ "schema-utils": "^1.0.0"
+ }
+ },
+ "postcss-merge-longhand": {
+ "version": "4.0.11",
+ "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-4.0.11.tgz",
+ "integrity": "sha512-alx/zmoeXvJjp7L4mxEMjh8lxVlDFX1gqWHzaaQewwMZiVhLo42TEClKaeHbRf6J7j82ZOdTJ808RtN0ZOZwvw==",
+ "dev": true,
+ "requires": {
+ "css-color-names": "0.0.4",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0",
+ "stylehacks": "^4.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-merge-rules": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-4.0.3.tgz",
+ "integrity": "sha512-U7e3r1SbvYzO0Jr3UT/zKBVgYYyhAz0aitvGIYOYK5CPmkNih+WDSsS5tvPrJ8YMQYlEMvsZIiqmn7HdFUaeEQ==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.0.0",
+ "caniuse-api": "^3.0.0",
+ "cssnano-util-same-parent": "^4.0.0",
+ "postcss": "^7.0.0",
+ "postcss-selector-parser": "^3.0.0",
+ "vendors": "^1.0.0"
+ },
+ "dependencies": {
+ "postcss-selector-parser": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.2.tgz",
+ "integrity": "sha512-h7fJ/5uWuRVyOtkO45pnt1Ih40CEleeyCHzipqAZO2e5H20g25Y48uYnFUiShvY4rZWNJ/Bib/KVPmanaCtOhA==",
+ "dev": true,
+ "requires": {
+ "dot-prop": "^5.2.0",
+ "indexes-of": "^1.0.1",
+ "uniq": "^1.0.1"
+ }
+ }
+ }
+ },
+ "postcss-minify-font-values": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-4.0.2.tgz",
+ "integrity": "sha512-j85oO6OnRU9zPf04+PZv1LYIYOprWm6IA6zkXkrJXyRveDEuQggG6tvoy8ir8ZwjLxLuGfNkCZEQG7zan+Hbtg==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-minify-gradients": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-4.0.2.tgz",
+ "integrity": "sha512-qKPfwlONdcf/AndP1U8SJ/uzIJtowHlMaSioKzebAXSG4iJthlWC9iSWznQcX4f66gIWX44RSA841HTHj3wK+Q==",
+ "dev": true,
+ "requires": {
+ "cssnano-util-get-arguments": "^4.0.0",
+ "is-color-stop": "^1.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-minify-params": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-4.0.2.tgz",
+ "integrity": "sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhPet/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg==",
+ "dev": true,
+ "requires": {
+ "alphanum-sort": "^1.0.0",
+ "browserslist": "^4.0.0",
+ "cssnano-util-get-arguments": "^4.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0",
+ "uniqs": "^2.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-minify-selectors": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-4.0.2.tgz",
+ "integrity": "sha512-D5S1iViljXBj9kflQo4YutWnJmwm8VvIsU1GeXJGiG9j8CIg9zs4voPMdQDUmIxetUOh60VilsNzCiAFTOqu3g==",
+ "dev": true,
+ "requires": {
+ "alphanum-sort": "^1.0.0",
+ "has": "^1.0.0",
+ "postcss": "^7.0.0",
+ "postcss-selector-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-selector-parser": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.2.tgz",
+ "integrity": "sha512-h7fJ/5uWuRVyOtkO45pnt1Ih40CEleeyCHzipqAZO2e5H20g25Y48uYnFUiShvY4rZWNJ/Bib/KVPmanaCtOhA==",
+ "dev": true,
+ "requires": {
+ "dot-prop": "^5.2.0",
+ "indexes-of": "^1.0.1",
+ "uniq": "^1.0.1"
+ }
+ }
+ }
+ },
+ "postcss-modules-extract-imports": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz",
+ "integrity": "sha512-LaYLDNS4SG8Q5WAWqIJgdHPJrDDr/Lv775rMBFUbgjTz6j34lUznACHcdRWroPvXANP2Vj7yNK57vp9eFqzLWQ==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.5"
+ }
+ },
+ "postcss-modules-local-by-default": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-3.0.3.tgz",
+ "integrity": "sha512-e3xDq+LotiGesympRlKNgaJ0PCzoUIdpH0dj47iWAui/kyTgh3CiAr1qP54uodmJhl6p9rN6BoNcdEDVJx9RDw==",
+ "dev": true,
+ "requires": {
+ "icss-utils": "^4.1.1",
+ "postcss": "^7.0.32",
+ "postcss-selector-parser": "^6.0.2",
+ "postcss-value-parser": "^4.1.0"
+ },
+ "dependencies": {
+ "postcss": {
+ "version": "7.0.32",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz",
+ "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "source-map": "^0.6.1",
+ "supports-color": "^6.1.0"
+ }
+ },
+ "postcss-value-parser": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz",
+ "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==",
+ "dev": true
+ },
+ "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
+ },
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "postcss-modules-scope": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-2.2.0.tgz",
+ "integrity": "sha512-YyEgsTMRpNd+HmyC7H/mh3y+MeFWevy7V1evVhJWewmMbjDHIbZbOXICC2y+m1xI1UVfIT1HMW/O04Hxyu9oXQ==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.6",
+ "postcss-selector-parser": "^6.0.0"
+ }
+ },
+ "postcss-modules-values": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-3.0.0.tgz",
+ "integrity": "sha512-1//E5jCBrZ9DmRX+zCtmQtRSV6PV42Ix7Bzj9GbwJceduuf7IqP8MgeTXuRDHOWj2m0VzZD5+roFWDuU8RQjcg==",
+ "dev": true,
+ "requires": {
+ "icss-utils": "^4.0.0",
+ "postcss": "^7.0.6"
+ }
+ },
+ "postcss-normalize-charset": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-4.0.1.tgz",
+ "integrity": "sha512-gMXCrrlWh6G27U0hF3vNvR3w8I1s2wOBILvA87iNXaPvSNo5uZAMYsZG7XjCUf1eVxuPfyL4TJ7++SGZLc9A3g==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.0"
+ }
+ },
+ "postcss-normalize-display-values": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.2.tgz",
+ "integrity": "sha512-3F2jcsaMW7+VtRMAqf/3m4cPFhPD3EFRgNs18u+k3lTJJlVe7d0YPO+bnwqo2xg8YiRpDXJI2u8A0wqJxMsQuQ==",
+ "dev": true,
+ "requires": {
+ "cssnano-util-get-match": "^4.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-normalize-positions": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-4.0.2.tgz",
+ "integrity": "sha512-Dlf3/9AxpxE+NF1fJxYDeggi5WwV35MXGFnnoccP/9qDtFrTArZ0D0R+iKcg5WsUd8nUYMIl8yXDCtcrT8JrdA==",
+ "dev": true,
+ "requires": {
+ "cssnano-util-get-arguments": "^4.0.0",
+ "has": "^1.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-normalize-repeat-style": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-4.0.2.tgz",
+ "integrity": "sha512-qvigdYYMpSuoFs3Is/f5nHdRLJN/ITA7huIoCyqqENJe9PvPmLhNLMu7QTjPdtnVf6OcYYO5SHonx4+fbJE1+Q==",
+ "dev": true,
+ "requires": {
+ "cssnano-util-get-arguments": "^4.0.0",
+ "cssnano-util-get-match": "^4.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-normalize-string": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-4.0.2.tgz",
+ "integrity": "sha512-RrERod97Dnwqq49WNz8qo66ps0swYZDSb6rM57kN2J+aoyEAJfZ6bMx0sx/F9TIEX0xthPGCmeyiam/jXif0eA==",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-normalize-timing-functions": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-4.0.2.tgz",
+ "integrity": "sha512-acwJY95edP762e++00Ehq9L4sZCEcOPyaHwoaFOhIwWCDfik6YvqsYNxckee65JHLKzuNSSmAdxwD2Cud1Z54A==",
+ "dev": true,
+ "requires": {
+ "cssnano-util-get-match": "^4.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-normalize-unicode": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-4.0.1.tgz",
+ "integrity": "sha512-od18Uq2wCYn+vZ/qCOeutvHjB5jm57ToxRaMeNuf0nWVHaP9Hua56QyMF6fs/4FSUnVIw0CBPsU0K4LnBPwYwg==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-normalize-url": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-4.0.1.tgz",
+ "integrity": "sha512-p5oVaF4+IHwu7VpMan/SSpmpYxcJMtkGppYf0VbdH5B6hN8YNmVyJLuY9FmLQTzY3fag5ESUUHDqM+heid0UVA==",
+ "dev": true,
+ "requires": {
+ "is-absolute-url": "^2.0.0",
+ "normalize-url": "^3.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-normalize-whitespace": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-4.0.2.tgz",
+ "integrity": "sha512-tO8QIgrsI3p95r8fyqKV+ufKlSHh9hMJqACqbv2XknufqEDhDvbguXGBBqxw9nsQoXWf0qOqppziKJKHMD4GtA==",
+ "dev": true,
+ "requires": {
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-ordered-values": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-4.1.2.tgz",
+ "integrity": "sha512-2fCObh5UanxvSxeXrtLtlwVThBvHn6MQcu4ksNT2tsaV2Fg76R2CV98W7wNSlX+5/pFwEyaDwKLLoEV7uRybAw==",
+ "dev": true,
+ "requires": {
+ "cssnano-util-get-arguments": "^4.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-reduce-initial": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-4.0.3.tgz",
+ "integrity": "sha512-gKWmR5aUulSjbzOfD9AlJiHCGH6AEVLaM0AV+aSioxUDd16qXP1PCh8d1/BGVvpdWn8k/HiK7n6TjeoXN1F7DA==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.0.0",
+ "caniuse-api": "^3.0.0",
+ "has": "^1.0.0",
+ "postcss": "^7.0.0"
+ }
+ },
+ "postcss-reduce-transforms": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-4.0.2.tgz",
+ "integrity": "sha512-EEVig1Q2QJ4ELpJXMZR8Vt5DQx8/mo+dGWSR7vWXqcob2gQLyQGsionYcGKATXvQzMPn6DSN1vTN7yFximdIAg==",
+ "dev": true,
+ "requires": {
+ "cssnano-util-get-match": "^4.0.0",
+ "has": "^1.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-selector-parser": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz",
+ "integrity": "sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg==",
+ "dev": true,
+ "requires": {
+ "cssesc": "^3.0.0",
+ "indexes-of": "^1.0.1",
+ "uniq": "^1.0.1"
+ }
+ },
+ "postcss-svgo": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-4.0.2.tgz",
+ "integrity": "sha512-C6wyjo3VwFm0QgBy+Fu7gCYOkCmgmClghO+pjcxvrcBKtiKt0uCF+hvbMO1fyv5BMImRK90SMb+dwUnfbGd+jw==",
+ "dev": true,
+ "requires": {
+ "is-svg": "^3.0.0",
+ "postcss": "^7.0.0",
+ "postcss-value-parser": "^3.0.0",
+ "svgo": "^1.0.0"
+ },
+ "dependencies": {
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ }
+ }
+ },
+ "postcss-unique-selectors": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-4.0.1.tgz",
+ "integrity": "sha512-+JanVaryLo9QwZjKrmJgkI4Fn8SBgRO6WXQBJi7KiAVPlmxikB5Jzc4EvXMT2H0/m0RjrVVm9rGNhZddm/8Spg==",
+ "dev": true,
+ "requires": {
+ "alphanum-sort": "^1.0.0",
+ "postcss": "^7.0.0",
+ "uniqs": "^2.0.0"
+ }
+ },
+ "postcss-value-parser": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.0.3.tgz",
+ "integrity": "sha512-N7h4pG+Nnu5BEIzyeaaIYWs0LI5XC40OrRh5L60z0QjFsqGWcHcbkBvpe1WYpcIS9yQ8sOi/vIPt1ejQCrMVrg==",
+ "dev": true
+ },
+ "prelude-ls": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
+ "dev": true
+ },
+ "prepend-http": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz",
+ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
+ "dev": true
+ },
+ "prettier": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz",
+ "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==",
+ "dev": true
+ },
+ "pretty-format": {
+ "version": "25.5.0",
+ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.5.0.tgz",
+ "integrity": "sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==",
+ "dev": true,
+ "requires": {
+ "@jest/types": "^25.5.0",
+ "ansi-regex": "^5.0.0",
+ "ansi-styles": "^4.0.0",
+ "react-is": "^16.12.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ }
+ }
+ },
+ "process": {
+ "version": "0.11.10",
+ "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
+ "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
+ },
+ "process-nextick-args": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
+ },
+ "promise-inflight": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz",
+ "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM="
+ },
+ "prompts": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz",
+ "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==",
+ "dev": true,
+ "requires": {
+ "kleur": "^3.0.3",
+ "sisteransi": "^1.0.4"
+ }
+ },
+ "prop-types": {
+ "version": "15.7.2",
+ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz",
+ "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
+ "requires": {
+ "loose-envify": "^1.4.0",
+ "object-assign": "^4.1.1",
+ "react-is": "^16.8.1"
+ }
+ },
+ "proxy-addr": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
+ "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==",
+ "dev": true,
+ "requires": {
+ "forwarded": "~0.1.2",
+ "ipaddr.js": "1.9.1"
+ }
+ },
+ "prr": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
+ "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY="
+ },
+ "pseudomap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
+ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
+ "dev": true
+ },
+ "psl": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
+ "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==",
+ "dev": true
+ },
+ "public-encrypt": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz",
+ "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==",
+ "requires": {
+ "bn.js": "^4.1.0",
+ "browserify-rsa": "^4.0.0",
+ "create-hash": "^1.1.0",
+ "parse-asn1": "^5.0.0",
+ "randombytes": "^2.0.1",
+ "safe-buffer": "^5.1.2"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw=="
+ }
+ }
+ },
+ "pump": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "pumpify": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz",
+ "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==",
+ "requires": {
+ "duplexify": "^3.6.0",
+ "inherits": "^2.0.3",
+ "pump": "^2.0.0"
+ },
+ "dependencies": {
+ "pump": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz",
+ "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==",
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ }
+ }
+ },
+ "punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
+ },
+ "q": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
+ "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
+ "dev": true
+ },
+ "qs": {
+ "version": "6.9.4",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
+ "integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
+ },
+ "query-string": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz",
+ "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=",
+ "dev": true,
+ "requires": {
+ "object-assign": "^4.1.0",
+ "strict-uri-encode": "^1.0.0"
+ }
+ },
+ "querystring": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
+ "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
+ },
+ "querystring-es3": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz",
+ "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM="
+ },
+ "querystringify": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz",
+ "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==",
+ "dev": true
+ },
+ "randombytes": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "requires": {
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "randomfill": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz",
+ "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==",
+ "requires": {
+ "randombytes": "^2.0.5",
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "range-parser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "dev": true
+ },
+ "raw-body": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
+ "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
+ "dev": true,
+ "requires": {
+ "bytes": "3.1.0",
+ "http-errors": "1.7.2",
+ "iconv-lite": "0.4.24",
+ "unpipe": "1.0.0"
+ },
+ "dependencies": {
+ "bytes": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
+ "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
+ "dev": true
+ }
+ }
+ },
+ "react": {
+ "version": "16.14.0",
+ "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz",
+ "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==",
+ "requires": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1",
+ "prop-types": "^15.6.2"
+ }
+ },
+ "react-dom": {
+ "version": "16.14.0",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz",
+ "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==",
+ "requires": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1",
+ "prop-types": "^15.6.2",
+ "scheduler": "^0.19.1"
+ }
+ },
+ "react-fast-compare": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-2.0.4.tgz",
+ "integrity": "sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw=="
+ },
+ "react-helmet": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-5.2.1.tgz",
+ "integrity": "sha512-CnwD822LU8NDBnjCpZ4ySh8L6HYyngViTZLfBBb3NjtrpN8m49clH8hidHouq20I51Y6TpCTISCBbqiY5GamwA==",
+ "requires": {
+ "object-assign": "^4.1.1",
+ "prop-types": "^15.5.4",
+ "react-fast-compare": "^2.0.2",
+ "react-side-effect": "^1.1.0"
+ }
+ },
+ "react-hot-loader": {
+ "version": "4.13.0",
+ "resolved": "https://registry.npmjs.org/react-hot-loader/-/react-hot-loader-4.13.0.tgz",
+ "integrity": "sha512-JrLlvUPqh6wIkrK2hZDfOyq/Uh/WeVEr8nc7hkn2/3Ul0sx1Kr5y4kOGNacNRoj7RhwLNcQ3Udf1KJXrqc0ZtA==",
+ "requires": {
+ "fast-levenshtein": "^2.0.6",
+ "global": "^4.3.0",
+ "hoist-non-react-statics": "^3.3.0",
+ "loader-utils": "^1.1.0",
+ "prop-types": "^15.6.1",
+ "react-lifecycles-compat": "^3.0.4",
+ "shallowequal": "^1.1.0",
+ "source-map": "^0.7.3"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.7.3",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
+ "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ=="
+ }
+ }
+ },
+ "react-is": {
+ "version": "16.13.1",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
+ },
+ "react-lifecycles-compat": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
+ "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
+ },
+ "react-redux": {
+ "version": "7.2.2",
+ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.2.tgz",
+ "integrity": "sha512-8+CQ1EvIVFkYL/vu6Olo7JFLWop1qRUeb46sGtIMDCSpgwPQq8fPLpirIB0iTqFe9XYEFPHssdX8/UwN6pAkEA==",
+ "requires": {
+ "@babel/runtime": "^7.12.1",
+ "hoist-non-react-statics": "^3.3.2",
+ "loose-envify": "^1.4.0",
+ "prop-types": "^15.7.2",
+ "react-is": "^16.13.1"
+ },
+ "dependencies": {
+ "@babel/runtime": {
+ "version": "7.12.5",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz",
+ "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==",
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ }
+ }
+ },
+ "react-router": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz",
+ "integrity": "sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==",
+ "requires": {
+ "@babel/runtime": "^7.1.2",
+ "history": "^4.9.0",
+ "hoist-non-react-statics": "^3.1.0",
+ "loose-envify": "^1.3.1",
+ "mini-create-react-context": "^0.4.0",
+ "path-to-regexp": "^1.7.0",
+ "prop-types": "^15.6.2",
+ "react-is": "^16.6.0",
+ "tiny-invariant": "^1.0.2",
+ "tiny-warning": "^1.0.0"
+ }
+ },
+ "react-router-config": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/react-router-config/-/react-router-config-5.1.1.tgz",
+ "integrity": "sha512-DuanZjaD8mQp1ppHjgnnUnyOlqYXZVjnov/JzFhjLEwd3Z4dYjMSnqrEzzGThH47vpCOqPPwJM2FtthLeJ8Pbg==",
+ "requires": {
+ "@babel/runtime": "^7.1.2"
+ }
+ },
+ "react-router-dom": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz",
+ "integrity": "sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==",
+ "requires": {
+ "@babel/runtime": "^7.1.2",
+ "history": "^4.9.0",
+ "loose-envify": "^1.3.1",
+ "prop-types": "^15.6.2",
+ "react-router": "5.2.0",
+ "tiny-invariant": "^1.0.2",
+ "tiny-warning": "^1.0.0"
+ }
+ },
+ "react-side-effect": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-1.2.0.tgz",
+ "integrity": "sha512-v1ht1aHg5k/thv56DRcjw+WtojuuDHFUgGfc+bFHOWsF4ZK6C2V57DO0Or0GPsg6+LSTE0M6Ry/gfzhzSwbc5w==",
+ "requires": {
+ "shallowequal": "^1.0.1"
+ }
+ },
+ "read-pkg": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz",
+ "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==",
+ "dev": true,
+ "requires": {
+ "@types/normalize-package-data": "^2.4.0",
+ "normalize-package-data": "^2.5.0",
+ "parse-json": "^5.0.0",
+ "type-fest": "^0.6.0"
+ },
+ "dependencies": {
+ "parse-json": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz",
+ "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "error-ex": "^1.3.1",
+ "json-parse-better-errors": "^1.0.1",
+ "lines-and-columns": "^1.1.6"
+ }
+ },
+ "type-fest": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz",
+ "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==",
+ "dev": true
+ }
+ }
+ },
+ "read-pkg-up": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz",
+ "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==",
+ "dev": true,
+ "requires": {
+ "find-up": "^4.1.0",
+ "read-pkg": "^5.2.0",
+ "type-fest": "^0.8.1"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^4.1.0"
+ }
+ },
+ "p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.2.0"
+ }
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ }
+ }
+ },
+ "readable-stream": {
+ "version": "2.3.7",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
+ "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
+ }
+ }
+ },
+ "readdirp": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz",
+ "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==",
+ "requires": {
+ "graceful-fs": "^4.1.11",
+ "micromatch": "^3.1.10",
+ "readable-stream": "^2.0.2"
+ }
+ },
+ "realpath-native": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-2.0.0.tgz",
+ "integrity": "sha512-v1SEYUOXXdbBZK8ZuNgO4TBjamPsiSgcFr0aP+tEKpQZK8vooEUqV6nm6Cv502mX4NF2EfsnVqtNAHG+/6Ur1Q==",
+ "dev": true
+ },
+ "redent": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz",
+ "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=",
+ "dev": true,
+ "requires": {
+ "indent-string": "^2.1.0",
+ "strip-indent": "^1.0.1"
+ }
+ },
+ "redux": {
+ "version": "4.0.5",
+ "resolved": "https://registry.npmjs.org/redux/-/redux-4.0.5.tgz",
+ "integrity": "sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w==",
+ "requires": {
+ "loose-envify": "^1.4.0",
+ "symbol-observable": "^1.2.0"
+ }
+ },
+ "redux-thunk": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz",
+ "integrity": "sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw=="
+ },
+ "regenerate": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
+ "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==",
+ "dev": true
+ },
+ "regenerate-unicode-properties": {
+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz",
+ "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==",
+ "dev": true,
+ "requires": {
+ "regenerate": "^1.4.0"
+ }
+ },
+ "regenerator-runtime": {
+ "version": "0.13.7",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz",
+ "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew=="
+ },
+ "regenerator-transform": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz",
+ "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==",
+ "dev": true,
+ "requires": {
+ "@babel/runtime": "^7.8.4"
+ }
+ },
+ "regex-not": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
+ "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==",
+ "requires": {
+ "extend-shallow": "^3.0.2",
+ "safe-regex": "^1.1.0"
+ }
+ },
+ "regexp.prototype.flags": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz",
+ "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.0-next.1"
+ }
+ },
+ "regexpu-core": {
+ "version": "4.7.1",
+ "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.7.1.tgz",
+ "integrity": "sha512-ywH2VUraA44DZQuRKzARmw6S66mr48pQVva4LBeRhcOltJ6hExvWly5ZjFLYo67xbIxb6W1q4bAGtgfEl20zfQ==",
+ "dev": true,
+ "requires": {
+ "regenerate": "^1.4.0",
+ "regenerate-unicode-properties": "^8.2.0",
+ "regjsgen": "^0.5.1",
+ "regjsparser": "^0.6.4",
+ "unicode-match-property-ecmascript": "^1.0.4",
+ "unicode-match-property-value-ecmascript": "^1.2.0"
+ }
+ },
+ "regjsgen": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz",
+ "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==",
+ "dev": true
+ },
+ "regjsparser": {
+ "version": "0.6.4",
+ "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.4.tgz",
+ "integrity": "sha512-64O87/dPDgfk8/RQqC4gkZoGyyWFIEUTTh80CU6CWuK5vkCGyekIx+oKcEIYtP/RAxSQltCZHCNu/mdd7fqlJw==",
+ "dev": true,
+ "requires": {
+ "jsesc": "~0.5.0"
+ },
+ "dependencies": {
+ "jsesc": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
+ "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
+ "dev": true
+ }
+ }
+ },
+ "remove-trailing-separator": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
+ "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8="
+ },
+ "repeat-element": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz",
+ "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g=="
+ },
+ "repeat-string": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
+ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc="
+ },
+ "repeating": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz",
+ "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=",
+ "dev": true,
+ "requires": {
+ "is-finite": "^1.0.0"
+ }
+ },
+ "request": {
+ "version": "2.88.2",
+ "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
+ "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
+ "dev": true,
+ "requires": {
+ "aws-sign2": "~0.7.0",
+ "aws4": "^1.8.0",
+ "caseless": "~0.12.0",
+ "combined-stream": "~1.0.6",
+ "extend": "~3.0.2",
+ "forever-agent": "~0.6.1",
+ "form-data": "~2.3.2",
+ "har-validator": "~5.1.3",
+ "http-signature": "~1.2.0",
+ "is-typedarray": "~1.0.0",
+ "isstream": "~0.1.2",
+ "json-stringify-safe": "~5.0.1",
+ "mime-types": "~2.1.19",
+ "oauth-sign": "~0.9.0",
+ "performance-now": "^2.1.0",
+ "qs": "~6.5.2",
+ "safe-buffer": "^5.1.2",
+ "tough-cookie": "~2.5.0",
+ "tunnel-agent": "^0.6.0",
+ "uuid": "^3.3.2"
+ },
+ "dependencies": {
+ "qs": {
+ "version": "6.5.2",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
+ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
+ "dev": true
+ },
+ "tough-cookie": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
+ "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
+ "dev": true,
+ "requires": {
+ "psl": "^1.1.28",
+ "punycode": "^2.1.1"
+ }
+ }
+ }
+ },
+ "request-promise-core": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz",
+ "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==",
+ "dev": true,
+ "requires": {
+ "lodash": "^4.17.15"
+ }
+ },
+ "request-promise-native": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz",
+ "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==",
+ "dev": true,
+ "requires": {
+ "request-promise-core": "1.1.3",
+ "stealthy-require": "^1.1.1",
+ "tough-cookie": "^2.3.3"
+ },
+ "dependencies": {
+ "tough-cookie": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
+ "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
+ "dev": true,
+ "requires": {
+ "psl": "^1.1.28",
+ "punycode": "^2.1.1"
+ }
+ }
+ }
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "dev": true
+ },
+ "require-main-filename": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
+ "dev": true
+ },
+ "requires-port": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
+ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
+ "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
+ "dev": true,
+ "requires": {
+ "path-parse": "^1.0.6"
+ }
+ },
+ "resolve-cwd": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz",
+ "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==",
+ "dev": true,
+ "requires": {
+ "resolve-from": "^5.0.0"
+ },
+ "dependencies": {
+ "resolve-from": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
+ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
+ "dev": true
+ }
+ }
+ },
+ "resolve-dir": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz",
+ "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=",
+ "dev": true,
+ "requires": {
+ "expand-tilde": "^2.0.0",
+ "global-modules": "^1.0.0"
+ },
+ "dependencies": {
+ "global-modules": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz",
+ "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==",
+ "dev": true,
+ "requires": {
+ "global-prefix": "^1.0.1",
+ "is-windows": "^1.0.1",
+ "resolve-dir": "^1.0.0"
+ }
+ }
+ }
+ },
+ "resolve-from": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
+ "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=",
+ "dev": true
+ },
+ "resolve-pathname": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz",
+ "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng=="
+ },
+ "resolve-url": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
+ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo="
+ },
+ "ret": {
+ "version": "0.1.15",
+ "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
+ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg=="
+ },
+ "retry": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
+ "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=",
+ "dev": true
+ },
+ "rgb-regex": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/rgb-regex/-/rgb-regex-1.0.1.tgz",
+ "integrity": "sha1-wODWiC3w4jviVKR16O3UGRX+rrE=",
+ "dev": true
+ },
+ "rgba-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/rgba-regex/-/rgba-regex-1.0.0.tgz",
+ "integrity": "sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=",
+ "dev": true
+ },
+ "rimraf": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
+ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "ripemd160": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz",
+ "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==",
+ "requires": {
+ "hash-base": "^3.0.0",
+ "inherits": "^2.0.1"
+ }
+ },
+ "rsvp": {
+ "version": "4.8.5",
+ "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
+ "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==",
+ "dev": true
+ },
+ "run-queue": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz",
+ "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=",
+ "requires": {
+ "aproba": "^1.1.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ },
+ "safe-regex": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
+ "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
+ "requires": {
+ "ret": "~0.1.10"
+ }
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
+ },
+ "sane": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz",
+ "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==",
+ "dev": true,
+ "requires": {
+ "@cnakazawa/watch": "^1.0.3",
+ "anymatch": "^2.0.0",
+ "capture-exit": "^2.0.0",
+ "exec-sh": "^0.3.2",
+ "execa": "^1.0.0",
+ "fb-watchman": "^2.0.0",
+ "micromatch": "^3.1.4",
+ "minimist": "^1.1.1",
+ "walker": "~1.0.5"
+ }
+ },
+ "sass-graph": {
+ "version": "2.2.5",
+ "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.5.tgz",
+ "integrity": "sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.0.0",
+ "lodash": "^4.0.0",
+ "scss-tokenizer": "^0.2.3",
+ "yargs": "^13.3.2"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "cliui": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+ "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^3.1.0",
+ "strip-ansi": "^5.2.0",
+ "wrap-ansi": "^5.1.0"
+ }
+ },
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ },
+ "wrap-ansi": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+ "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "string-width": "^3.0.0",
+ "strip-ansi": "^5.0.0"
+ }
+ },
+ "yargs": {
+ "version": "13.3.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
+ "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^5.0.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^3.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.1.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "13.1.2",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
+ "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+ },
+ "sass-loader": {
+ "version": "8.0.2",
+ "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-8.0.2.tgz",
+ "integrity": "sha512-7o4dbSK8/Ol2KflEmSco4jTjQoV988bM82P9CZdmo9hR3RLnvNc0ufMNdMrB0caq38JQ/FgF4/7RcbcfKzxoFQ==",
+ "dev": true,
+ "requires": {
+ "clone-deep": "^4.0.1",
+ "loader-utils": "^1.2.3",
+ "neo-async": "^2.6.1",
+ "schema-utils": "^2.6.1",
+ "semver": "^6.3.0"
+ },
+ "dependencies": {
+ "schema-utils": {
+ "version": "2.6.6",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.6.6.tgz",
+ "integrity": "sha512-wHutF/WPSbIi9x6ctjGGk2Hvl0VOz5l3EKEuKbjPlB30mKZUzb9A5k9yEXRX3pwyqVLPvpfZZEllaFq/M718hA==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.12.0",
+ "ajv-keywords": "^3.4.1"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ }
+ }
+ },
+ "sax": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
+ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
+ "dev": true
+ },
+ "saxes": {
+ "version": "3.1.11",
+ "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz",
+ "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==",
+ "dev": true,
+ "requires": {
+ "xmlchars": "^2.1.1"
+ }
+ },
+ "scheduler": {
+ "version": "0.19.1",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz",
+ "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==",
+ "requires": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1"
+ }
+ },
+ "schema-utils": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
+ "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
+ "requires": {
+ "ajv": "^6.1.0",
+ "ajv-errors": "^1.0.0",
+ "ajv-keywords": "^3.1.0"
+ }
+ },
+ "scss-tokenizer": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz",
+ "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=",
+ "dev": true,
+ "requires": {
+ "js-base64": "^2.1.8",
+ "source-map": "^0.4.2"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.4.4",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
+ "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=",
+ "dev": true,
+ "requires": {
+ "amdefine": ">=0.0.4"
+ }
+ }
+ }
+ },
+ "select-hose": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
+ "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=",
+ "dev": true
+ },
+ "selfsigned": {
+ "version": "1.10.8",
+ "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz",
+ "integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==",
+ "dev": true,
+ "requires": {
+ "node-forge": "^0.10.0"
+ }
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
+ },
+ "send": {
+ "version": "0.17.1",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
+ "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "depd": "~1.1.2",
+ "destroy": "~1.0.4",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "0.5.2",
+ "http-errors": "~1.7.2",
+ "mime": "1.6.0",
+ "ms": "2.1.1",
+ "on-finished": "~2.3.0",
+ "range-parser": "~1.2.1",
+ "statuses": "~1.5.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ },
+ "dependencies": {
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ }
+ }
+ },
+ "mime": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "dev": true
+ },
+ "ms": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
+ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
+ "dev": true
+ }
+ }
+ },
+ "serialize-javascript": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
+ "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
+ "requires": {
+ "randombytes": "^2.1.0"
+ }
+ },
+ "serve-index": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
+ "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=",
+ "dev": true,
+ "requires": {
+ "accepts": "~1.3.4",
+ "batch": "0.6.1",
+ "debug": "2.6.9",
+ "escape-html": "~1.0.3",
+ "http-errors": "~1.6.2",
+ "mime-types": "~2.1.17",
+ "parseurl": "~1.3.2"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "http-errors": {
+ "version": "1.6.3",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
+ "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
+ "dev": true,
+ "requires": {
+ "depd": "~1.1.2",
+ "inherits": "2.0.3",
+ "setprototypeof": "1.1.0",
+ "statuses": ">= 1.4.0 < 2"
+ }
+ },
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "dev": true
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "setprototypeof": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
+ "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==",
+ "dev": true
+ }
+ }
+ },
+ "serve-static": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
+ "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
+ "dev": true,
+ "requires": {
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.3",
+ "send": "0.17.1"
+ }
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
+ "dev": true
+ },
+ "set-value": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
+ "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
+ "requires": {
+ "extend-shallow": "^2.0.1",
+ "is-extendable": "^0.1.1",
+ "is-plain-object": "^2.0.3",
+ "split-string": "^3.0.1"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "setimmediate": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
+ "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
+ },
+ "setprototypeof": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
+ "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==",
+ "dev": true
+ },
+ "sha.js": {
+ "version": "2.4.11",
+ "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
+ "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
+ "requires": {
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "shallow-clone": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
+ "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.2"
+ }
+ },
+ "shallowequal": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz",
+ "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ=="
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
+ "dev": true
+ },
+ "shellwords": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz",
+ "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==",
+ "dev": true,
+ "optional": true
+ },
+ "signal-exit": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
+ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
+ "dev": true
+ },
+ "simple-swizzle": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
+ "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "^0.3.1"
+ },
+ "dependencies": {
+ "is-arrayish": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
+ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==",
+ "dev": true
+ }
+ }
+ },
+ "sisteransi": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
+ "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
+ "dev": true
+ },
+ "slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true
+ },
+ "snapdragon": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
+ "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==",
+ "requires": {
+ "base": "^0.11.1",
+ "debug": "^2.2.0",
+ "define-property": "^0.2.5",
+ "extend-shallow": "^2.0.1",
+ "map-cache": "^0.2.2",
+ "source-map": "^0.5.6",
+ "source-map-resolve": "^0.5.0",
+ "use": "^3.1.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
+ }
+ }
+ },
+ "snapdragon-node": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz",
+ "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==",
+ "requires": {
+ "define-property": "^1.0.0",
+ "isobject": "^3.0.0",
+ "snapdragon-util": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
+ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-data-descriptor": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
+ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "requires": {
+ "kind-of": "^6.0.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
+ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "requires": {
+ "is-accessor-descriptor": "^1.0.0",
+ "is-data-descriptor": "^1.0.0",
+ "kind-of": "^6.0.2"
+ }
+ }
+ }
+ },
+ "snapdragon-util": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz",
+ "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==",
+ "requires": {
+ "kind-of": "^3.2.0"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "sockjs": {
+ "version": "0.3.20",
+ "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.20.tgz",
+ "integrity": "sha512-SpmVOVpdq0DJc0qArhF3E5xsxvaiqGNb73XfgBpK1y3UD5gs8DSo8aCTsuT5pX8rssdc2NDIzANwP9eCAiSdTA==",
+ "dev": true,
+ "requires": {
+ "faye-websocket": "^0.10.0",
+ "uuid": "^3.4.0",
+ "websocket-driver": "0.6.5"
+ }
+ },
+ "sockjs-client": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.4.0.tgz",
+ "integrity": "sha512-5zaLyO8/nri5cua0VtOrFXBPK1jbL4+1cebT/mmKA1E1ZXOvJrII75bPu0l0k843G/+iAbhEqzyKr0w/eCCj7g==",
+ "dev": true,
+ "requires": {
+ "debug": "^3.2.5",
+ "eventsource": "^1.0.7",
+ "faye-websocket": "~0.11.1",
+ "inherits": "^2.0.3",
+ "json3": "^3.3.2",
+ "url-parse": "^1.4.3"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
+ "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "faye-websocket": {
+ "version": "0.11.3",
+ "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.3.tgz",
+ "integrity": "sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA==",
+ "dev": true,
+ "requires": {
+ "websocket-driver": ">=0.5.1"
+ }
+ }
+ }
+ },
+ "sort-keys": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz",
+ "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=",
+ "dev": true,
+ "requires": {
+ "is-plain-obj": "^1.0.0"
+ }
+ },
+ "source-list-map": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",
+ "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw=="
+ },
+ "source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
+ },
+ "source-map-loader": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-0.2.4.tgz",
+ "integrity": "sha512-OU6UJUty+i2JDpTItnizPrlpOIBLmQbWMuBg9q5bVtnHACqw1tn9nNwqJLbv0/00JjnJb/Ee5g5WS5vrRv7zIQ==",
+ "dev": true,
+ "requires": {
+ "async": "^2.5.0",
+ "loader-utils": "^1.1.0"
+ }
+ },
+ "source-map-resolve": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz",
+ "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==",
+ "requires": {
+ "atob": "^2.1.2",
+ "decode-uri-component": "^0.2.0",
+ "resolve-url": "^0.2.1",
+ "source-map-url": "^0.4.0",
+ "urix": "^0.1.0"
+ }
+ },
+ "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==",
+ "requires": {
+ "buffer-from": "^1.0.0",
+ "source-map": "^0.6.0"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
+ }
+ }
+ },
+ "source-map-url": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
+ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM="
+ },
+ "spdx-correct": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
+ "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "dev": true,
+ "requires": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-exceptions": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
+ "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==",
+ "dev": true
+ },
+ "spdx-expression-parse": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
+ "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
+ "dev": true,
+ "requires": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-license-ids": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz",
+ "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==",
+ "dev": true
+ },
+ "spdy": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz",
+ "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==",
+ "dev": true,
+ "requires": {
+ "debug": "^4.1.0",
+ "handle-thing": "^2.0.0",
+ "http-deceiver": "^1.2.7",
+ "select-hose": "^2.0.0",
+ "spdy-transport": "^3.0.0"
+ }
+ },
+ "spdy-transport": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz",
+ "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==",
+ "dev": true,
+ "requires": {
+ "debug": "^4.1.0",
+ "detect-node": "^2.0.4",
+ "hpack.js": "^2.1.6",
+ "obuf": "^1.1.2",
+ "readable-stream": "^3.0.6",
+ "wbuf": "^1.7.3"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ }
+ }
+ },
+ "split-string": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
+ "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==",
+ "requires": {
+ "extend-shallow": "^3.0.0"
+ }
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
+ },
+ "sshpk": {
+ "version": "1.16.1",
+ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
+ "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
+ "dev": true,
+ "requires": {
+ "asn1": "~0.2.3",
+ "assert-plus": "^1.0.0",
+ "bcrypt-pbkdf": "^1.0.0",
+ "dashdash": "^1.12.0",
+ "ecc-jsbn": "~0.1.1",
+ "getpass": "^0.1.1",
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.0.2",
+ "tweetnacl": "~0.14.0"
+ }
+ },
+ "ssri": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
+ "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==",
+ "requires": {
+ "figgy-pudding": "^3.5.1"
+ }
+ },
+ "stable": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz",
+ "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==",
+ "dev": true
+ },
+ "stack-utils": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz",
+ "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==",
+ "dev": true
+ },
+ "static-extend": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
+ "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=",
+ "requires": {
+ "define-property": "^0.2.5",
+ "object-copy": "^0.1.0"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ }
+ }
+ },
+ "statuses": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
+ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
+ "dev": true
+ },
+ "stdout-stream": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.1.tgz",
+ "integrity": "sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA==",
+ "dev": true,
+ "requires": {
+ "readable-stream": "^2.0.1"
+ }
+ },
+ "stealthy-require": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
+ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=",
+ "dev": true
+ },
+ "stream-browserify": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz",
+ "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==",
+ "requires": {
+ "inherits": "~2.0.1",
+ "readable-stream": "^2.0.2"
+ }
+ },
+ "stream-each": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz",
+ "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==",
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "stream-shift": "^1.0.0"
+ }
+ },
+ "stream-http": {
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz",
+ "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==",
+ "requires": {
+ "builtin-status-codes": "^3.0.0",
+ "inherits": "^2.0.1",
+ "readable-stream": "^2.3.6",
+ "to-arraybuffer": "^1.0.0",
+ "xtend": "^4.0.0"
+ }
+ },
+ "stream-shift": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz",
+ "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ=="
+ },
+ "strict-uri-encode": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
+ "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
+ "dev": true
+ },
+ "string-length": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-length/-/string-length-3.1.0.tgz",
+ "integrity": "sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA==",
+ "dev": true,
+ "requires": {
+ "astral-regex": "^1.0.0",
+ "strip-ansi": "^5.2.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ }
+ }
+ },
+ "string-width": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
+ "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.0"
+ }
+ },
+ "string.prototype.trimend": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz",
+ "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.5"
+ }
+ },
+ "string.prototype.trimleft": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz",
+ "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.5",
+ "string.prototype.trimstart": "^1.0.0"
+ }
+ },
+ "string.prototype.trimright": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz",
+ "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.5",
+ "string.prototype.trimend": "^1.0.0"
+ }
+ },
+ "string.prototype.trimstart": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz",
+ "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.5"
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
+ "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.0"
+ }
+ },
+ "strip-bom": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz",
+ "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==",
+ "dev": true
+ },
+ "strip-eof": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
+ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
+ "dev": true
+ },
+ "strip-final-newline": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
+ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+ "dev": true
+ },
+ "strip-indent": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz",
+ "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=",
+ "dev": true,
+ "requires": {
+ "get-stdin": "^4.0.1"
+ }
+ },
+ "style-loader": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-1.3.0.tgz",
+ "integrity": "sha512-V7TCORko8rs9rIqkSrlMfkqA63DfoGBBJmK1kKGCcSi+BWb4cqz0SRsnp4l6rU5iwOEd0/2ePv68SV22VXon4Q==",
+ "dev": true,
+ "requires": {
+ "loader-utils": "^2.0.0",
+ "schema-utils": "^2.7.0"
+ },
+ "dependencies": {
+ "ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ajv-keywords": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
+ "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
+ "dev": true
+ },
+ "json5": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
+ "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "loader-utils": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
+ "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
+ "dev": true,
+ "requires": {
+ "big.js": "^5.2.2",
+ "emojis-list": "^3.0.0",
+ "json5": "^2.1.2"
+ }
+ },
+ "schema-utils": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz",
+ "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==",
+ "dev": true,
+ "requires": {
+ "@types/json-schema": "^7.0.5",
+ "ajv": "^6.12.4",
+ "ajv-keywords": "^3.5.2"
+ }
+ }
+ }
+ },
+ "stylehacks": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz",
+ "integrity": "sha512-7GlLk9JwlElY4Y6a/rmbH2MhVlTyVmiJd1PfTCqFaIBEGMYNsrO/v3SeGTdhBThLg4Z+NbOk/qFMwCa+J+3p/g==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.0.0",
+ "postcss": "^7.0.0",
+ "postcss-selector-parser": "^3.0.0"
+ },
+ "dependencies": {
+ "postcss-selector-parser": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.2.tgz",
+ "integrity": "sha512-h7fJ/5uWuRVyOtkO45pnt1Ih40CEleeyCHzipqAZO2e5H20g25Y48uYnFUiShvY4rZWNJ/Bib/KVPmanaCtOhA==",
+ "dev": true,
+ "requires": {
+ "dot-prop": "^5.2.0",
+ "indexes-of": "^1.0.1",
+ "uniq": "^1.0.1"
+ }
+ }
+ }
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "supports-hyperlinks": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz",
+ "integrity": "sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0",
+ "supports-color": "^7.0.0"
+ },
+ "dependencies": {
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "svgo": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.3.2.tgz",
+ "integrity": "sha512-yhy/sQYxR5BkC98CY7o31VGsg014AKLEPxdfhora76l36hD9Rdy5NZA/Ocn6yayNPgSamYdtX2rFJdcv07AYVw==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.1",
+ "coa": "^2.0.2",
+ "css-select": "^2.0.0",
+ "css-select-base-adapter": "^0.1.1",
+ "css-tree": "1.0.0-alpha.37",
+ "csso": "^4.0.2",
+ "js-yaml": "^3.13.1",
+ "mkdirp": "~0.5.1",
+ "object.values": "^1.1.0",
+ "sax": "~1.2.4",
+ "stable": "^0.1.8",
+ "unquote": "~1.1.1",
+ "util.promisify": "~1.0.0"
+ }
+ },
+ "symbol-observable": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
+ "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ=="
+ },
+ "symbol-tree": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
+ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
+ "dev": true
+ },
+ "tapable": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz",
+ "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA=="
+ },
+ "tar": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz",
+ "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==",
+ "dev": true,
+ "requires": {
+ "block-stream": "*",
+ "fstream": "^1.0.12",
+ "inherits": "2"
+ }
+ },
+ "terminal-link": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz",
+ "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==",
+ "dev": true,
+ "requires": {
+ "ansi-escapes": "^4.2.1",
+ "supports-hyperlinks": "^2.0.0"
+ }
+ },
+ "terser": {
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
+ "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==",
+ "requires": {
+ "commander": "^2.20.0",
+ "source-map": "~0.6.1",
+ "source-map-support": "~0.5.12"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
+ }
+ }
+ },
+ "terser-webpack-plugin": {
+ "version": "1.4.5",
+ "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.5.tgz",
+ "integrity": "sha512-04Rfe496lN8EYruwi6oPQkG0vo8C+HT49X687FZnpPF0qMAIHONI6HEXYPKDOE8e5HjXTyKfqRd/agHtH0kOtw==",
+ "requires": {
+ "cacache": "^12.0.2",
+ "find-cache-dir": "^2.1.0",
+ "is-wsl": "^1.1.0",
+ "schema-utils": "^1.0.0",
+ "serialize-javascript": "^4.0.0",
+ "source-map": "^0.6.1",
+ "terser": "^4.1.2",
+ "webpack-sources": "^1.4.0",
+ "worker-farm": "^1.7.0"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
+ }
+ }
+ },
+ "test-exclude": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
+ "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==",
+ "dev": true,
+ "requires": {
+ "@istanbuljs/schema": "^0.1.2",
+ "glob": "^7.1.4",
+ "minimatch": "^3.0.4"
+ }
+ },
+ "throat": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz",
+ "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==",
+ "dev": true
+ },
+ "through2": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
+ "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==",
+ "requires": {
+ "readable-stream": "~2.3.6",
+ "xtend": "~4.0.1"
+ }
+ },
+ "thunky": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
+ "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==",
+ "dev": true
+ },
+ "timers-browserify": {
+ "version": "2.0.12",
+ "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz",
+ "integrity": "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==",
+ "requires": {
+ "setimmediate": "^1.0.4"
+ }
+ },
+ "timsort": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
+ "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=",
+ "dev": true
+ },
+ "tiny-invariant": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz",
+ "integrity": "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw=="
+ },
+ "tiny-warning": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
+ "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
+ },
+ "tmpl": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",
+ "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=",
+ "dev": true
+ },
+ "to-arraybuffer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
+ "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M="
+ },
+ "to-fast-properties": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
+ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4="
+ },
+ "to-object-path": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz",
+ "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=",
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "to-regex": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz",
+ "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==",
+ "requires": {
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "regex-not": "^1.0.2",
+ "safe-regex": "^1.1.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
+ "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=",
+ "requires": {
+ "is-number": "^3.0.0",
+ "repeat-string": "^1.6.1"
+ }
+ },
+ "toidentifier": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
+ "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
+ "dev": true
+ },
+ "tough-cookie": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz",
+ "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==",
+ "dev": true,
+ "requires": {
+ "ip-regex": "^2.1.0",
+ "psl": "^1.1.28",
+ "punycode": "^2.1.1"
+ }
+ },
+ "tr46": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz",
+ "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=",
+ "dev": true,
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "trim-newlines": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
+ "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=",
+ "dev": true
+ },
+ "true-case-path": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz",
+ "integrity": "sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.2"
+ }
+ },
+ "ts-jest": {
+ "version": "25.5.1",
+ "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.5.1.tgz",
+ "integrity": "sha512-kHEUlZMK8fn8vkxDjwbHlxXRB9dHYpyzqKIGDNxbzs+Rz+ssNDSDNusEK8Fk/sDd4xE6iKoQLfFkFVaskmTJyw==",
+ "dev": true,
+ "requires": {
+ "bs-logger": "0.x",
+ "buffer-from": "1.x",
+ "fast-json-stable-stringify": "2.x",
+ "json5": "2.x",
+ "lodash.memoize": "4.x",
+ "make-error": "1.x",
+ "micromatch": "4.x",
+ "mkdirp": "0.x",
+ "semver": "6.x",
+ "yargs-parser": "18.x"
+ },
+ "dependencies": {
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "json5": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
+ "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "ts-loader": {
+ "version": "7.0.5",
+ "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-7.0.5.tgz",
+ "integrity": "sha512-zXypEIT6k3oTc+OZNx/cqElrsbBtYqDknf48OZos0NQ3RTt045fBIU8RRSu+suObBzYB355aIPGOe/3kj9h7Ig==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.3.0",
+ "enhanced-resolve": "^4.0.0",
+ "loader-utils": "^1.0.2",
+ "micromatch": "^4.0.0",
+ "semver": "^6.0.0"
+ },
+ "dependencies": {
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
+ "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
+ "dev": true,
+ "requires": {
+ "braces": "^3.0.1",
+ "picomatch": "^2.0.5"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
+ },
+ "tty-browserify": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
+ "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY="
+ },
+ "tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "tweetnacl": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
+ "dev": true
+ },
+ "type-check": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2"
+ }
+ },
+ "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
+ },
+ "type-fest": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
+ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
+ "dev": true
+ },
+ "type-is": {
+ "version": "1.6.18",
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+ "dev": true,
+ "requires": {
+ "media-typer": "0.3.0",
+ "mime-types": "~2.1.24"
+ }
+ },
+ "typedarray": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
+ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
+ },
+ "typedarray-to-buffer": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
+ "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
+ "dev": true,
+ "requires": {
+ "is-typedarray": "^1.0.0"
+ }
+ },
+ "typescript": {
+ "version": "3.9.7",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
+ "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
+ "dev": true
+ },
+ "uc.micro": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
+ "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
+ },
+ "unicode-canonical-property-names-ecmascript": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",
+ "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==",
+ "dev": true
+ },
+ "unicode-match-property-ecmascript": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz",
+ "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==",
+ "dev": true,
+ "requires": {
+ "unicode-canonical-property-names-ecmascript": "^1.0.4",
+ "unicode-property-aliases-ecmascript": "^1.0.4"
+ }
+ },
+ "unicode-match-property-value-ecmascript": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz",
+ "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==",
+ "dev": true
+ },
+ "unicode-property-aliases-ecmascript": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz",
+ "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==",
+ "dev": true
+ },
+ "union-value": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
+ "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
+ "requires": {
+ "arr-union": "^3.1.0",
+ "get-value": "^2.0.6",
+ "is-extendable": "^0.1.1",
+ "set-value": "^2.0.1"
+ }
+ },
+ "uniq": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz",
+ "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=",
+ "dev": true
+ },
+ "uniqs": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz",
+ "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=",
+ "dev": true
+ },
+ "unique-filename": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz",
+ "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==",
+ "requires": {
+ "unique-slug": "^2.0.0"
+ }
+ },
+ "unique-slug": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz",
+ "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==",
+ "requires": {
+ "imurmurhash": "^0.1.4"
+ }
+ },
+ "universalify": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
+ "dev": true
+ },
+ "unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
+ "dev": true
+ },
+ "unquote": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz",
+ "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=",
+ "dev": true
+ },
+ "unset-value": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",
+ "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=",
+ "requires": {
+ "has-value": "^0.3.1",
+ "isobject": "^3.0.0"
+ },
+ "dependencies": {
+ "has-value": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz",
+ "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=",
+ "requires": {
+ "get-value": "^2.0.3",
+ "has-values": "^0.1.4",
+ "isobject": "^2.0.0"
+ },
+ "dependencies": {
+ "isobject": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
+ "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
+ "requires": {
+ "isarray": "1.0.0"
+ }
+ }
+ }
+ },
+ "has-values": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz",
+ "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E="
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
+ }
+ }
+ },
+ "upath": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz",
+ "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg=="
+ },
+ "uri-js": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
+ "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "urix": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",
+ "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI="
+ },
+ "url": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz",
+ "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=",
+ "requires": {
+ "punycode": "1.3.2",
+ "querystring": "0.2.0"
+ },
+ "dependencies": {
+ "punycode": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
+ "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
+ }
+ }
+ },
+ "url-loader": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-4.1.1.tgz",
+ "integrity": "sha512-3BTV812+AVHHOJQO8O5MkWgZ5aosP7GnROJwvzLS9hWDj00lZ6Z0wNak423Lp9PBZN05N+Jk/N5Si8jRAlGyWA==",
+ "dev": true,
+ "requires": {
+ "loader-utils": "^2.0.0",
+ "mime-types": "^2.1.27",
+ "schema-utils": "^3.0.0"
+ },
+ "dependencies": {
+ "@types/json-schema": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
+ "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==",
+ "dev": true
+ },
+ "ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ajv-keywords": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
+ "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
+ "dev": true
+ },
+ "json5": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
+ "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "loader-utils": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
+ "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
+ "dev": true,
+ "requires": {
+ "big.js": "^5.2.2",
+ "emojis-list": "^3.0.0",
+ "json5": "^2.1.2"
+ }
+ },
+ "schema-utils": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz",
+ "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==",
+ "dev": true,
+ "requires": {
+ "@types/json-schema": "^7.0.6",
+ "ajv": "^6.12.5",
+ "ajv-keywords": "^3.5.2"
+ }
+ }
+ }
+ },
+ "url-parse": {
+ "version": "1.4.7",
+ "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz",
+ "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==",
+ "dev": true,
+ "requires": {
+ "querystringify": "^2.1.1",
+ "requires-port": "^1.0.0"
+ }
+ },
+ "use": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
+ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ=="
+ },
+ "util": {
+ "version": "0.11.1",
+ "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz",
+ "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==",
+ "requires": {
+ "inherits": "2.0.3"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
+ }
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
+ },
+ "util.promisify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz",
+ "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.2",
+ "has-symbols": "^1.0.1",
+ "object.getownpropertydescriptors": "^2.1.0"
+ }
+ },
+ "utils-merge": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
+ "dev": true
+ },
+ "uuid": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
+ "dev": true
+ },
+ "v8-compile-cache": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz",
+ "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==",
+ "dev": true
+ },
+ "v8-to-istanbul": {
+ "version": "4.1.4",
+ "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-4.1.4.tgz",
+ "integrity": "sha512-Rw6vJHj1mbdK8edjR7+zuJrpDtKIgNdAvTSAcpYfgMIw+u2dPDntD3dgN4XQFLU2/fvFQdzj+EeSGfd/jnY5fQ==",
+ "dev": true,
+ "requires": {
+ "@types/istanbul-lib-coverage": "^2.0.1",
+ "convert-source-map": "^1.6.0",
+ "source-map": "^0.7.3"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.7.3",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
+ "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
+ "dev": true
+ }
+ }
+ },
+ "validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "dev": true,
+ "requires": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
+ "value-equal": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz",
+ "integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw=="
+ },
+ "vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
+ "dev": true
+ },
+ "vendors": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.4.tgz",
+ "integrity": "sha512-/juG65kTL4Cy2su4P8HjtkTxk6VmJDiOPBufWniqQ6wknac6jNiXS9vU+hO3wgusiyqWlzTbVHi0dyJqRONg3w==",
+ "dev": true
+ },
+ "verror": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
+ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "^1.0.0",
+ "core-util-is": "1.0.2",
+ "extsprintf": "^1.2.0"
+ }
+ },
+ "vm-browserify": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
+ "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ=="
+ },
+ "w3c-hr-time": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",
+ "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==",
+ "dev": true,
+ "requires": {
+ "browser-process-hrtime": "^1.0.0"
+ }
+ },
+ "w3c-xmlserializer": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz",
+ "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==",
+ "dev": true,
+ "requires": {
+ "domexception": "^1.0.1",
+ "webidl-conversions": "^4.0.2",
+ "xml-name-validator": "^3.0.0"
+ }
+ },
+ "walker": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz",
+ "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=",
+ "dev": true,
+ "requires": {
+ "makeerror": "1.0.x"
+ }
+ },
+ "watchpack": {
+ "version": "1.7.5",
+ "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
+ "integrity": "sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ==",
+ "requires": {
+ "chokidar": "^3.4.1",
+ "graceful-fs": "^4.1.2",
+ "neo-async": "^2.5.0",
+ "watchpack-chokidar2": "^2.0.1"
+ },
+ "dependencies": {
+ "anymatch": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
+ "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
+ "optional": true,
+ "requires": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ }
+ },
+ "binary-extensions": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz",
+ "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==",
+ "optional": true
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "optional": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "chokidar": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz",
+ "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==",
+ "optional": true,
+ "requires": {
+ "anymatch": "~3.1.1",
+ "braces": "~3.0.2",
+ "fsevents": "~2.1.2",
+ "glob-parent": "~5.1.0",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.5.0"
+ }
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "optional": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "fsevents": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
+ "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
+ "optional": true
+ },
+ "glob-parent": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
+ "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
+ "optional": true,
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "optional": true,
+ "requires": {
+ "binary-extensions": "^2.0.0"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "optional": true
+ },
+ "readdirp": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
+ "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==",
+ "optional": true,
+ "requires": {
+ "picomatch": "^2.2.1"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "optional": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ }
+ }
+ },
+ "watchpack-chokidar2": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz",
+ "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==",
+ "optional": true,
+ "requires": {
+ "chokidar": "^2.1.8"
+ }
+ },
+ "wbuf": {
+ "version": "1.7.3",
+ "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz",
+ "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==",
+ "dev": true,
+ "requires": {
+ "minimalistic-assert": "^1.0.0"
+ }
+ },
+ "webidl-conversions": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
+ "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==",
+ "dev": true
+ },
+ "webpack": {
+ "version": "4.44.2",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.44.2.tgz",
+ "integrity": "sha512-6KJVGlCxYdISyurpQ0IPTklv+DULv05rs2hseIXer6D7KrUicRDLFb4IUM1S6LUAKypPM/nSiVSuv8jHu1m3/Q==",
+ "requires": {
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-module-context": "1.9.0",
+ "@webassemblyjs/wasm-edit": "1.9.0",
+ "@webassemblyjs/wasm-parser": "1.9.0",
+ "acorn": "^6.4.1",
+ "ajv": "^6.10.2",
+ "ajv-keywords": "^3.4.1",
+ "chrome-trace-event": "^1.0.2",
+ "enhanced-resolve": "^4.3.0",
+ "eslint-scope": "^4.0.3",
+ "json-parse-better-errors": "^1.0.2",
+ "loader-runner": "^2.4.0",
+ "loader-utils": "^1.2.3",
+ "memory-fs": "^0.4.1",
+ "micromatch": "^3.1.10",
+ "mkdirp": "^0.5.3",
+ "neo-async": "^2.6.1",
+ "node-libs-browser": "^2.2.1",
+ "schema-utils": "^1.0.0",
+ "tapable": "^1.1.3",
+ "terser-webpack-plugin": "^1.4.3",
+ "watchpack": "^1.7.4",
+ "webpack-sources": "^1.4.1"
+ },
+ "dependencies": {
+ "enhanced-resolve": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.3.0.tgz",
+ "integrity": "sha512-3e87LvavsdxyoCfGusJnrZ5G8SLPOFeHSNpZI/ATL9a5leXo2k0w6MKnbqhdBad9qTobSfB20Ld7UmgoNbAZkQ==",
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "memory-fs": "^0.5.0",
+ "tapable": "^1.0.0"
+ },
+ "dependencies": {
+ "memory-fs": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz",
+ "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==",
+ "requires": {
+ "errno": "^0.1.3",
+ "readable-stream": "^2.0.1"
+ }
+ }
+ }
+ }
+ }
+ },
+ "webpack-cli": {
+ "version": "3.3.12",
+ "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.12.tgz",
+ "integrity": "sha512-NVWBaz9k839ZH/sinurM+HcDvJOTXwSjYp1ku+5XKeOC03z8v5QitnK/x+lAxGXFyhdayoIf/GOpv85z3/xPag==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "cross-spawn": "^6.0.5",
+ "enhanced-resolve": "^4.1.1",
+ "findup-sync": "^3.0.0",
+ "global-modules": "^2.0.0",
+ "import-local": "^2.0.0",
+ "interpret": "^1.4.0",
+ "loader-utils": "^1.4.0",
+ "supports-color": "^6.1.0",
+ "v8-compile-cache": "^2.1.1",
+ "yargs": "^13.3.2"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "cliui": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+ "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^3.1.0",
+ "strip-ansi": "^5.2.0",
+ "wrap-ansi": "^5.1.0"
+ }
+ },
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "import-local": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz",
+ "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==",
+ "dev": true,
+ "requires": {
+ "pkg-dir": "^3.0.0",
+ "resolve-cwd": "^2.0.0"
+ }
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "resolve-cwd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz",
+ "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=",
+ "dev": true,
+ "requires": {
+ "resolve-from": "^3.0.0"
+ }
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ },
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "wrap-ansi": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+ "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "string-width": "^3.0.0",
+ "strip-ansi": "^5.0.0"
+ }
+ },
+ "yargs": {
+ "version": "13.3.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
+ "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^5.0.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^3.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.1.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "13.1.2",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
+ "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+ },
+ "webpack-dev-middleware": {
+ "version": "3.7.2",
+ "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-3.7.2.tgz",
+ "integrity": "sha512-1xC42LxbYoqLNAhV6YzTYacicgMZQTqRd27Sim9wn5hJrX3I5nxYy1SxSd4+gjUFsz1dQFj+yEe6zEVmSkeJjw==",
+ "dev": true,
+ "requires": {
+ "memory-fs": "^0.4.1",
+ "mime": "^2.4.4",
+ "mkdirp": "^0.5.1",
+ "range-parser": "^1.2.1",
+ "webpack-log": "^2.0.0"
+ }
+ },
+ "webpack-dev-server": {
+ "version": "3.11.0",
+ "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.11.0.tgz",
+ "integrity": "sha512-PUxZ+oSTxogFQgkTtFndEtJIPNmml7ExwufBZ9L2/Xyyd5PnOL5UreWe5ZT7IU25DSdykL9p1MLQzmLh2ljSeg==",
+ "dev": true,
+ "requires": {
+ "ansi-html": "0.0.7",
+ "bonjour": "^3.5.0",
+ "chokidar": "^2.1.8",
+ "compression": "^1.7.4",
+ "connect-history-api-fallback": "^1.6.0",
+ "debug": "^4.1.1",
+ "del": "^4.1.1",
+ "express": "^4.17.1",
+ "html-entities": "^1.3.1",
+ "http-proxy-middleware": "0.19.1",
+ "import-local": "^2.0.0",
+ "internal-ip": "^4.3.0",
+ "ip": "^1.1.5",
+ "is-absolute-url": "^3.0.3",
+ "killable": "^1.0.1",
+ "loglevel": "^1.6.8",
+ "opn": "^5.5.0",
+ "p-retry": "^3.0.1",
+ "portfinder": "^1.0.26",
+ "schema-utils": "^1.0.0",
+ "selfsigned": "^1.10.7",
+ "semver": "^6.3.0",
+ "serve-index": "^1.9.1",
+ "sockjs": "0.3.20",
+ "sockjs-client": "1.4.0",
+ "spdy": "^4.0.2",
+ "strip-ansi": "^3.0.1",
+ "supports-color": "^6.1.0",
+ "url": "^0.11.0",
+ "webpack-dev-middleware": "^3.7.2",
+ "webpack-log": "^2.0.0",
+ "ws": "^6.2.1",
+ "yargs": "^13.3.2"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "cliui": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+ "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^3.1.0",
+ "strip-ansi": "^5.2.0",
+ "wrap-ansi": "^5.1.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ }
+ }
+ },
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "import-local": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz",
+ "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==",
+ "dev": true,
+ "requires": {
+ "pkg-dir": "^3.0.0",
+ "resolve-cwd": "^2.0.0"
+ }
+ },
+ "is-absolute-url": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-3.0.3.tgz",
+ "integrity": "sha512-opmNIX7uFnS96NtPmhWQgQx6/NYFgsUXYMllcfzwWKUMwfo8kku1TvE6hkNcH+Q1ts5cMVrsY7j0bxXQDciu9Q==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "resolve-cwd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz",
+ "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=",
+ "dev": true,
+ "requires": {
+ "resolve-from": "^3.0.0"
+ }
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ }
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "supports-color": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "wrap-ansi": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+ "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "string-width": "^3.0.0",
+ "strip-ansi": "^5.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ }
+ }
+ },
+ "ws": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
+ "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
+ "dev": true,
+ "requires": {
+ "async-limiter": "~1.0.0"
+ }
+ },
+ "yargs": {
+ "version": "13.3.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
+ "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^5.0.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^3.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.1.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "13.1.2",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
+ "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+ },
+ "webpack-hot-middleware": {
+ "version": "2.25.0",
+ "resolved": "https://registry.npmjs.org/webpack-hot-middleware/-/webpack-hot-middleware-2.25.0.tgz",
+ "integrity": "sha512-xs5dPOrGPCzuRXNi8F6rwhawWvQQkeli5Ro48PRuQh8pYPCPmNnltP9itiUPT4xI8oW+y0m59lyyeQk54s5VgA==",
+ "dev": true,
+ "requires": {
+ "ansi-html": "0.0.7",
+ "html-entities": "^1.2.0",
+ "querystring": "^0.2.0",
+ "strip-ansi": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ }
+ }
+ },
+ "webpack-log": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-2.0.0.tgz",
+ "integrity": "sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg==",
+ "dev": true,
+ "requires": {
+ "ansi-colors": "^3.0.0",
+ "uuid": "^3.3.2"
+ }
+ },
+ "webpack-manifest-plugin": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/webpack-manifest-plugin/-/webpack-manifest-plugin-2.2.0.tgz",
+ "integrity": "sha512-9S6YyKKKh/Oz/eryM1RyLVDVmy3NSPV0JXMRhZ18fJsq+AwGxUY34X54VNwkzYcEmEkDwNxuEOboCZEebJXBAQ==",
+ "dev": true,
+ "requires": {
+ "fs-extra": "^7.0.0",
+ "lodash": ">=3.5 <5",
+ "object.entries": "^1.1.0",
+ "tapable": "^1.0.0"
+ }
+ },
+ "webpack-sources": {
+ "version": "1.4.3",
+ "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz",
+ "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==",
+ "requires": {
+ "source-list-map": "^2.0.0",
+ "source-map": "~0.6.1"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
+ }
+ }
+ },
+ "websocket-driver": {
+ "version": "0.6.5",
+ "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.6.5.tgz",
+ "integrity": "sha1-XLJVbOuF9Dc8bYI4qmkchFThOjY=",
+ "dev": true,
+ "requires": {
+ "websocket-extensions": ">=0.1.1"
+ }
+ },
+ "websocket-extensions": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz",
+ "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
+ "dev": true
+ },
+ "whatwg-encoding": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz",
+ "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==",
+ "dev": true,
+ "requires": {
+ "iconv-lite": "0.4.24"
+ }
+ },
+ "whatwg-mimetype": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz",
+ "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==",
+ "dev": true
+ },
+ "whatwg-url": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz",
+ "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==",
+ "dev": true,
+ "requires": {
+ "lodash.sortby": "^4.7.0",
+ "tr46": "^1.0.1",
+ "webidl-conversions": "^4.0.2"
+ }
+ },
+ "which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "which-module": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
+ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
+ "dev": true
+ },
+ "wide-align": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
+ "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^1.0.2 || 2"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
+ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "string-width": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
+ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
+ "dev": true,
+ "requires": {
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^4.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
+ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^3.0.0"
+ }
+ }
+ }
+ },
+ "word-wrap": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
+ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
+ "dev": true
+ },
+ "worker-farm": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",
+ "integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==",
+ "requires": {
+ "errno": "~0.1.7"
+ }
+ },
+ "wrap-ansi": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
+ "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ }
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
+ },
+ "write-file-atomic": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz",
+ "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==",
+ "dev": true,
+ "requires": {
+ "imurmurhash": "^0.1.4",
+ "is-typedarray": "^1.0.0",
+ "signal-exit": "^3.0.2",
+ "typedarray-to-buffer": "^3.1.5"
+ }
+ },
+ "ws": {
+ "version": "7.3.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.0.tgz",
+ "integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w==",
+ "dev": true
+ },
+ "xml-name-validator": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
+ "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
+ "dev": true
+ },
+ "xmlchars": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
+ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
+ "dev": true
+ },
+ "xtend": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
+ },
+ "y18n": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
+ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
+ },
+ "yallist": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="
+ },
+ "yargs": {
+ "version": "15.3.1",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz",
+ "integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==",
+ "dev": true,
+ "requires": {
+ "cliui": "^6.0.0",
+ "decamelize": "^1.2.0",
+ "find-up": "^4.1.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^4.2.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^18.1.1"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^4.1.0"
+ }
+ },
+ "p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.2.0"
+ }
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ }
+ }
+ },
+ "yargs-parser": {
+ "version": "18.1.3",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
+ "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+}
diff --git a/web/package.json b/web/package.json
new file mode 100644
index 00000000..c073e822
--- /dev/null
+++ b/web/package.json
@@ -0,0 +1,74 @@
+{
+ "name": "dnote",
+ "version": "1.0.0",
+ "description": "",
+ "repository": "https://github.com/dnote/dnote",
+ "main": "index",
+ "scripts": {
+ "test": "jest --coverage",
+ "test:watch": "jest --watch",
+ "lint": "../node_modules/.bin/eslint ./src --ext .ts,.tsx,.js",
+ "lint:fix": "../node_modules/.bin/eslint ./src --fix --ext .ts,.tsx,.js"
+ },
+ "author": "Monomax Software Pty Ltd",
+ "license": "AGPL-3.0-or-later",
+ "devDependencies": {
+ "@babel/core": "^7.12.9",
+ "@babel/plugin-transform-react-constant-elements": "^7.12.1",
+ "@babel/preset-env": "^7.12.7",
+ "@babel/preset-react": "^7.12.7",
+ "@babel/preset-typescript": "^7.12.7",
+ "@babel/register": "^7.12.1",
+ "@hot-loader/react-dom": "^16.14.0",
+ "@types/jest": "^25.2.3",
+ "@types/react": "^16.14.2",
+ "@types/react-dom": "^16.9.10",
+ "autoprefixer": "^9.8.6",
+ "babel-loader": "^8.2.2",
+ "css-loader": "^3.6.0",
+ "cssnano": "^4.1.10",
+ "file-loader": "^6.2.0",
+ "jest": "^25.5.4",
+ "mini-css-extract-plugin": "^0.9.0",
+ "node-sass": "^4.14.1",
+ "postcss-loader": "^3.0.0",
+ "prettier": "^2.2.1",
+ "sass-loader": "^8.0.2",
+ "source-map-loader": "^0.2.4",
+ "source-map-support": "^0.5.19",
+ "style-loader": "^1.3.0",
+ "ts-jest": "^25.5.1",
+ "ts-loader": "^7.0.5",
+ "typescript": "^3.9.7",
+ "url-loader": "^4.1.1",
+ "webpack-cli": "^3.3.12",
+ "webpack-dev-middleware": "^3.7.2",
+ "webpack-dev-server": "^3.11.0",
+ "webpack-hot-middleware": "^2.25.0",
+ "webpack-manifest-plugin": "^2.2.0"
+ },
+ "dependencies": {
+ "@babel/plugin-proposal-class-properties": "^7.12.1",
+ "@types/classnames": "^2.2.11",
+ "@types/react-redux": "^7.1.11",
+ "@types/react-router-dom": "^5.1.6",
+ "classnames": "^2.2.5",
+ "core-js": "^3.8.0",
+ "highlight.js": "^10.4.0",
+ "history": "^4.10.1",
+ "markdown-it": "^9.0.0",
+ "qs": "^6.9.4",
+ "react": "^16.14.0",
+ "react-dom": "^16.14.0",
+ "react-helmet": "^5.0.0",
+ "react-hot-loader": "^4.13.0",
+ "react-redux": "^7.2.2",
+ "react-router": "^5.2.0",
+ "react-router-config": "^5.1.1",
+ "react-router-dom": "^5.2.0",
+ "redux": "^4.0.5",
+ "redux-thunk": "^2.1.0",
+ "regenerator-runtime": "^0.13.7",
+ "webpack": "^4.44.2"
+ }
+}
diff --git a/web/src/client.tsx b/web/src/client.tsx
new file mode 100644
index 00000000..cb9dea37
--- /dev/null
+++ b/web/src/client.tsx
@@ -0,0 +1,66 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import 'core-js/stable';
+import 'regenerator-runtime/runtime';
+
+import React from 'react';
+import { render } from 'react-dom';
+import { BrowserRouter } from 'react-router-dom';
+import { Provider } from 'react-redux';
+
+import { debounce } from 'jslib/helpers/perf';
+import App from './components/App';
+import configureStore from './store';
+import { markPersisted } from './store/editor';
+import { loadState, saveState } from './libs/localStorage';
+import './libs/restoreScroll';
+
+const persistedState = loadState();
+const store = configureStore(persistedState);
+
+store.subscribe(
+ debounce(() => {
+ const state = store.getState();
+
+ saveState({
+ editor: state.editor
+ });
+
+ if (!state.editor.persisted) {
+ store.dispatch(markPersisted());
+ }
+ }, 50)
+);
+
+function renderApp() {
+ render(
+
+
+
+
+ ,
+ document.getElementById('app')
+ );
+}
+
+const splashEl = document.getElementById('splash');
+if (splashEl && splashEl.parentNode) {
+ splashEl.parentNode.removeChild(splashEl);
+}
+renderApp();
diff --git a/pkg/server/assets/styles/src/main.scss b/web/src/components/App/App.global.scss
similarity index 61%
rename from pkg/server/assets/styles/src/main.scss
rename to web/src/components/App/App.global.scss
index 9afa9f6d..70abfe1c 100644
--- a/pkg/server/assets/styles/src/main.scss
+++ b/web/src/components/App/App.global.scss
@@ -1,37 +1,32 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
-@use 'reboot';
-@use 'grid';
-@use 'bootstrap';
-@use 'buttons';
-@use 'responsive';
-@use 'select';
-@use 'shared';
-@use 'marker';
-@use 'rem';
-@use 'markdown';
-@use 'hljs';
-
-@use 'login';
-@use 'home';
-@use 'note';
-@use 'books';
-@use 'settings';
-@use 'header';
-@use 'global';
+@import './reboot';
+@import './grid';
+@import './bootstrap';
+@import './buttons';
+@import './responsive';
+@import './select';
+@import './shared';
+@import './marker';
+@import './rem';
+@import './markdown';
+@import './hljs';
html {
font-size: 62.5%; /* 1.0 rem = 10px */
@@ -71,11 +66,11 @@ img {
}
.container.mobile-nopadding {
- @include responsive.breakpoint(mdonly) {
+ @include breakpoint(mdonly) {
max-width: 100%;
}
- @include responsive.breakpoint(mddown) {
+ @include breakpoint(mddown) {
padding-left: 0;
padding-right: 0;
@@ -134,7 +129,7 @@ img {
}
.input {
- border-radius: rem.rem(4px);
+ border-radius: rem(4px);
background-clip: padding-box;
border: 1px solid #ced4da;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
diff --git a/web/src/components/App/App.scss b/web/src/components/App/App.scss
new file mode 100644
index 00000000..5e257c26
--- /dev/null
+++ b/web/src/components/App/App.scss
@@ -0,0 +1,49 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/theme';
+@import '../App/responsive';
+@import '../App/rem';
+
+.wrapper {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ background: $lighter-gray;
+ min-height: calc(100vh - #{$header-height} - #{$footer-height});
+ margin-bottom: $footer-height;
+
+ &.nofooter {
+ margin-bottom: 0;
+ }
+
+ &.noheader:not(.nofooter) {
+ min-height: calc(100vh - #{$footer-height});
+ }
+ &.nofooter:not(.noheader) {
+ min-height: calc(100vh - #{$header-height});
+ }
+ &.nofooter.noheader {
+ min-height: 100vh;
+ }
+
+ @include breakpoint(lg) {
+ margin-bottom: 0;
+ min-height: calc(100vh - #{$header-height});
+ }
+}
diff --git a/web/src/components/App/HeaderData.tsx b/web/src/components/App/HeaderData.tsx
new file mode 100644
index 00000000..6e7f4d7e
--- /dev/null
+++ b/web/src/components/App/HeaderData.tsx
@@ -0,0 +1,50 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import Helmet from 'react-helmet';
+
+import config from 'web/libs/config';
+
+const title = 'Dnote - A Simple Personal Knowledge Base';
+const description =
+ 'Dnote is a personal knowledge base with an automated spaced repetition. Give a home to your knowledge and let your knowledge flow.';
+
+export default () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/pkg/server/assets/styles/src/_bootstrap.scss b/web/src/components/App/_bootstrap.scss
similarity index 74%
rename from pkg/server/assets/styles/src/_bootstrap.scss
rename to web/src/components/App/_bootstrap.scss
index 9ccc9a78..25de43b3 100644
--- a/pkg/server/assets/styles/src/_bootstrap.scss
+++ b/web/src/components/App/_bootstrap.scss
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
// From Bootstrap <4.3.1
@@ -31,8 +34,10 @@
.alert {
position: relative;
- padding: 1.75rem 1.25rem;
+ padding: 0.75rem 1.25rem;
+ margin-bottom: 1rem;
border: 1px solid transparent;
+ border-radius: 0.25rem;
}
.alert-heading {
@@ -44,7 +49,7 @@
}
.alert-dismissible {
- // padding-right: 4rem;
+ padding-right: 4rem;
}
.alert-dismissible .close {
@@ -166,8 +171,3 @@
.alert-dark .alert-link {
color: #040505;
}
-
-// custom
-.alert-slim {
- padding: 0.75rem 1.25rem;
-}
diff --git a/pkg/server/assets/styles/src/_buttons.scss b/web/src/components/App/_buttons.scss
similarity index 52%
rename from pkg/server/assets/styles/src/_buttons.scss
rename to web/src/components/App/_buttons.scss
index e734b003..6178c0ce 100644
--- a/pkg/server/assets/styles/src/_buttons.scss
+++ b/web/src/components/App/_buttons.scss
@@ -1,23 +1,24 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
-@use "sass:color";
-@use 'theme';
-@use 'rem';
-@use 'font';
-@use "responsive";
+@import './theme';
+@import './rem';
+@import './font';
@mixin button($text-color, $background-color) {
color: $text-color;
@@ -25,7 +26,7 @@
&:not(:disabled):hover {
color: $text-color;
- background-color: color.adjust($background-color, $lightness: -5%);
+ background-color: darken($background-color, 5%);
box-shadow: 0px 0px 4px 2px #cacaca;
}
}
@@ -86,40 +87,40 @@ button:disabled {
}
.button-small {
- @include font.font-size('small');
- padding: rem.rem(4px) rem.rem(12px);
+ @include font-size('small');
+ padding: rem(4px) rem(12px);
}
.button-normal {
// @include font-size('small');
- padding: rem.rem(8px) rem.rem(16px);
+ padding: rem(8px) rem(16px);
}
.button-large {
- @include font.font-size('medium');
+ @include font-size('medium');
- padding: rem.rem(8px) rem.rem(24px);
+ padding: rem(8px) rem(24px);
- @include responsive.breakpoint(md) {
- padding: rem.rem(12px) rem.rem(36px);
+ @include breakpoint(md) {
+ padding: rem(12px) rem(36px);
}
- @include responsive.breakpoint(lg) {
- padding: rem.rem(12px) rem.rem(48px);
+ @include breakpoint(lg) {
+ padding: rem(12px) rem(48px);
}
}
.button-xlarge {
- @include font.font-size('x-large');
+ @include font-size('x-large');
- padding: rem.rem(16px) rem.rem(24px);
+ padding: rem(16px) rem(24px);
- @include responsive.breakpoint(md) {
- padding: rem.rem(12px) rem.rem(36px);
+ @include breakpoint(md) {
+ padding: rem(12px) rem(36px);
}
- @include responsive.breakpoint(lg) {
- padding: rem.rem(16px) rem.rem(48px);
+ @include breakpoint(lg) {
+ padding: rem(16px) rem(48px);
}
}
@@ -132,23 +133,23 @@ button:disabled {
}
.button-second {
- @include button(theme.$black, theme.$second);
+ @include button($black, $second);
}
.button-second-outline {
- @include button-outline(theme.$black, theme.$second);
+ @include button-outline($black, $second);
}
.button-third {
- @include button(#ffffff, theme.$third);
+ @include button(#ffffff, $third);
}
.button-third-outline {
- @include button-outline(theme.$third, theme.$third);
+ @include button-outline($third, $third);
}
.button-danger {
- @include button-outline(theme.$danger-text, theme.$danger-text);
+ @include button-outline($danger-text, $danger-text);
font-weight: 600;
}
@@ -157,7 +158,7 @@ button:disabled {
}
.button ~ .button {
- margin-left: rem.rem(12px);
+ margin-left: rem(12px);
}
.button-no-ui {
@@ -172,10 +173,10 @@ button:disabled {
}
.button-link {
- color: theme.$link;
+ color: $link;
&:hover {
- color: theme.$link-hover;
+ color: $link-hover;
text-decoration: underline;
}
}
diff --git a/pkg/server/assets/styles/src/_font.scss b/web/src/components/App/_font.scss
similarity index 73%
rename from pkg/server/assets/styles/src/_font.scss
rename to web/src/components/App/_font.scss
index 4818014a..1f0b90d5 100644
--- a/pkg/server/assets/styles/src/_font.scss
+++ b/web/src/components/App/_font.scss
@@ -1,19 +1,22 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
-@use 'responsive';
+@import './responsive';
$lowDecay: 0.1;
$medDecay: 0.15;
@@ -92,12 +95,12 @@ $highDecay: 0.2;
font-size: $smSizeValue * 1px;
font-size: $smSizeValue * 0.1rem;
- @include responsive.breakpoint(md) {
+ @include breakpoint(md) {
font-size: $mdSizeValue * 1px;
font-size: $mdSizeValue * 0.1rem;
}
- @include responsive.breakpoint(lg) {
+ @include breakpoint(lg) {
font-size: $lgSizeValue * 1px;
font-size: $lgSizeValue * 0.1rem;
}
diff --git a/pkg/server/assets/styles/src/_grid.scss b/web/src/components/App/_grid.scss
similarity index 95%
rename from pkg/server/assets/styles/src/_grid.scss
rename to web/src/components/App/_grid.scss
index 9e527582..5f25b11c 100644
--- a/pkg/server/assets/styles/src/_grid.scss
+++ b/web/src/components/App/_grid.scss
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
/*!
@@ -64,7 +67,7 @@ html {
@media (min-width: 1440px) {
.container-wide {
- max-width: 1280px;
+ max-width: 1180px;
}
}
diff --git a/pkg/server/assets/styles/src/_hljs.scss b/web/src/components/App/_hljs.scss
similarity index 78%
rename from pkg/server/assets/styles/src/_hljs.scss
rename to web/src/components/App/_hljs.scss
index 4decc572..03636f1a 100644
--- a/pkg/server/assets/styles/src/_hljs.scss
+++ b/web/src/components/App/_hljs.scss
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
/*
diff --git a/pkg/server/assets/styles/src/_markdown.scss b/web/src/components/App/_markdown.scss
similarity index 95%
rename from pkg/server/assets/styles/src/_markdown.scss
rename to web/src/components/App/_markdown.scss
index e1621ffa..99b3e92f 100644
--- a/pkg/server/assets/styles/src/_markdown.scss
+++ b/web/src/components/App/_markdown.scss
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
/*
diff --git a/web/src/components/App/_marker.scss b/web/src/components/App/_marker.scss
new file mode 100644
index 00000000..75afcc10
--- /dev/null
+++ b/web/src/components/App/_marker.scss
@@ -0,0 +1,39 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+.marker {
+ display: inline-block;
+ padding: 0.25em 0.4em;
+ font-size: 75%;
+ font-weight: 700;
+ line-height: 1;
+ text-align: center;
+ white-space: nowrap;
+ vertical-align: baseline;
+ border-radius: 0.25rem;
+}
+
+.marker-first {
+ color: #fff;
+ background-color: #007bff;
+}
+
+.marker-info {
+ color: #fff;
+ background-color: #17a2b8;
+}
diff --git a/pkg/server/assets/styles/src/_reboot.scss b/web/src/components/App/_reboot.scss
similarity index 87%
rename from pkg/server/assets/styles/src/_reboot.scss
rename to web/src/components/App/_reboot.scss
index 369cf5de..174f2989 100644
--- a/pkg/server/assets/styles/src/_reboot.scss
+++ b/web/src/components/App/_reboot.scss
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
/*!
diff --git a/pkg/server/assets/styles/src/_rem.scss b/web/src/components/App/_rem.scss
similarity index 57%
rename from pkg/server/assets/styles/src/_rem.scss
rename to web/src/components/App/_rem.scss
index c2b914ff..c7e307b4 100644
--- a/pkg/server/assets/styles/src/_rem.scss
+++ b/web/src/components/App/_rem.scss
@@ -1,31 +1,33 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
-@use "sass:list";
-@use "sass:map";
-@use "sass:meta";
/*
MIT License
+
Copyright (c) 2017 Pierre Burel
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-@use "sass:math";
-
// assume 1 rem = 10 px
// achieved by body { font-size: 62.5%; )
$rem-baseline: 10px !default;
@@ -33,25 +35,25 @@ $rem-fallback: false !default;
$rem-px-only: false !default;
@function rem-separator($list, $separator: false) {
- @if $separator == "comma" or $separator == "space" {
- @return list.append($list, null, $separator);
+ @if $separator == 'comma' or $separator == 'space' {
+ @return append($list, null, $separator);
}
- @if meta.function-exists("list-separator") == true {
- @return list.separator($list);
+ @if function-exists('list-separator') == true {
+ @return list-separator($list);
}
// list-separator polyfill by Hugo Giraudel (https://sass-compatibility.github.io/#list_separator_function)
$test-list: ();
@each $item in $list {
- $test-list: list.append($test-list, $item, space);
+ $test-list: append($test-list, $item, space);
}
@return if($test-list == $list, space, comma);
}
@mixin rem-baseline($zoom: 100%) {
- font-size: math.div($zoom, 16px) * $rem-baseline;
+ font-size: $zoom / 16px * $rem-baseline;
}
@function rem-convert($to, $values...) {
@@ -59,28 +61,28 @@ $rem-px-only: false !default;
$separator: rem-separator($values);
@each $value in $values {
- @if meta.type-of($value) == "number" and math.unit($value) == "rem" and $to == "px" {
- $result: list.append($result, math.div($value, 1rem) * $rem-baseline, $separator);
+ @if type-of($value) == 'number' and unit($value) == 'rem' and $to == 'px' {
+ $result: append($result, $value / 1rem * $rem-baseline, $separator);
} @else if
- meta.type-of($value) ==
- "number" and
- math.unit($value) ==
- "px" and
+ type-of($value) ==
+ 'number' and
+ unit($value) ==
+ 'px' and
$to ==
- "rem"
+ 'rem'
{
- $result: list.append($result, math.div($value, $rem-baseline) * 1rem, $separator);
- } @else if meta.type-of($value) == "list" {
+ $result: append($result, $value / $rem-baseline * 1rem, $separator);
+ } @else if type-of($value) == 'list' {
$value-separator: rem-separator($value);
$value: rem-convert($to, $value...);
$value: rem-separator($value, $value-separator);
- $result: list.append($result, $value, $separator);
+ $result: append($result, $value, $separator);
} @else {
- $result: list.append($result, $value, $separator);
+ $result: append($result, $value, $separator);
}
}
- @return if(list.length($result) == 1, list.nth($result, 1), $result);
+ @return if(length($result) == 1, nth($result, 1), $result);
}
@function rem($values...) {
@@ -92,9 +94,9 @@ $rem-px-only: false !default;
}
@mixin rem($properties, $values...) {
- @if meta.type-of($properties) == "map" {
- @each $property in map.keys($properties) {
- @include rem($property, map.get($properties, $property));
+ @if type-of($properties) == 'map' {
+ @each $property in map-keys($properties) {
+ @include rem($property, map-get($properties, $property));
}
} @else {
@each $property in $properties {
diff --git a/web/src/components/App/_responsive.scss b/web/src/components/App/_responsive.scss
new file mode 100644
index 00000000..caf5bc12
--- /dev/null
+++ b/web/src/components/App/_responsive.scss
@@ -0,0 +1,62 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import './variables';
+
+@mixin breakpoint($point) {
+ @if $point == xl {
+ @media (min-width: $xl-breakpoint) {
+ @content;
+ }
+ } @else if $point == lg {
+ @media (min-width: $lg-breakpoint) {
+ @content;
+ }
+ } @else if $point == md {
+ @media (min-width: $md-breakpoint) {
+ @content;
+ }
+ } @else if $point == sm {
+ @media (min-width: $sm-breakpoint) {
+ @content;
+ }
+ } @else if $point == smonly {
+ @media (min-width: $sm-breakpoint) and (max-width: $md-breakpoint - 1px) {
+ @content;
+ }
+ } @else if $point == smdown {
+ @media (max-width: $md-breakpoint - 1px) {
+ @content;
+ }
+ } @else if $point == mdonly {
+ @media (min-width: $md-breakpoint) and (max-width: $lg-breakpoint - 1px) {
+ @content;
+ }
+ } @else if $point == mddown {
+ @media (max-width: $lg-breakpoint - 1px) {
+ @content;
+ }
+ }
+}
+
+// landscape is the mobile landscape mode
+@mixin landscape() {
+ @media (max-height: 400px) {
+ @content;
+ }
+}
diff --git a/pkg/server/assets/styles/src/_select.scss b/web/src/components/App/_select.scss
similarity index 93%
rename from pkg/server/assets/styles/src/_select.scss
rename to web/src/components/App/_select.scss
index a0dc5d8c..f534a64a 100644
--- a/pkg/server/assets/styles/src/_select.scss
+++ b/web/src/components/App/_select.scss
@@ -1,16 +1,19 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
/**
diff --git a/pkg/server/assets/styles/src/_shared.scss b/web/src/components/App/_shared.scss
similarity index 67%
rename from pkg/server/assets/styles/src/_shared.scss
rename to web/src/components/App/_shared.scss
index 3dcbcbe4..1ce9ee43 100644
--- a/pkg/server/assets/styles/src/_shared.scss
+++ b/web/src/components/App/_shared.scss
@@ -1,22 +1,23 @@
-/* Copyright 2025 Dnote Authors
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
*
- * 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
+ * This file is part of Dnote.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * 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.
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
*/
-@use 'font';
-@use 'responsive';
-@use "rem";
-@use "theme";
+@import './font';
+@import './responsive';
@keyframes holderPulse {
0% {
@@ -45,7 +46,7 @@ input[type='email']:disabled,
input[type='number']:disabled,
input[type='password']:disabled,
textarea:disabled {
- background-color: theme.$lighter-gray;
+ background-color: $lighter-gray;
cursor: not-allowed;
}
@@ -75,17 +76,17 @@ button {
}
.text-input {
- border: 1px solid theme.$border-color;
- padding: rem.rem(8px) rem.rem(12px);
+ border: 1px solid $border-color;
+ padding: rem(8px) rem(12px);
position: relative;
- border-radius: rem.rem(4px);
+ border-radius: rem(4px);
display: block;
&::placeholder {
- color: theme.$gray;
+ color: $gray;
}
&:focus {
- border-color: theme.$light-blue;
+ border-color: $light-blue;
box-shadow: inset 0 1px 2px rgba(24, 31, 35, 0.075),
0 0 0 0.2em rgba(4, 100, 210, 0.3);
outline: none;
@@ -93,11 +94,11 @@ button {
}
.text-input-small {
- padding: rem.rem(4px) rem.rem(12px);
+ padding: rem(4px) rem(12px);
}
.text-input-medium {
- padding: rem.rem(8px) rem.rem(12px);
+ padding: rem(8px) rem(12px);
}
.text-input-stretch {
@@ -109,10 +110,10 @@ button {
}
a {
- color: theme.$link;
+ color: $link;
&:hover {
- color: theme.$link-hover;
+ color: $link-hover;
}
}
@@ -128,12 +129,12 @@ h6 {
// grid
.container.mobile-fw {
- @include responsive.breakpoint(mddown) {
+ @include breakpoint(mddown) {
max-width: 100%;
}
}
.container.mobile-nopadding {
- @include responsive.breakpoint(mddown) {
+ @include breakpoint(mddown) {
padding-left: 0;
padding-right: 0;
@@ -153,30 +154,30 @@ html body {
}
.page {
- padding-top: rem.rem(20px);
- padding-bottom: rem.rem(20px);
+ padding-top: rem(20px);
+ padding-bottom: rem(20px);
&.page-mobile-full {
padding-top: 0;
padding-bottom: 0;
- @include responsive.breakpoint(lg) {
- padding-top: rem.rem(32px);
- padding-bottom: rem.rem(32px);
+ @include breakpoint(lg) {
+ padding-top: rem(32px);
+ padding-bottom: rem(32px);
}
}
}
.page-header {
- margin-top: rem.rem(20px);
+ margin-top: rem(20px);
&.page-header-full {
- margin-bottom: rem.rem(20px);
+ margin-bottom: rem(20px);
}
- @include responsive.breakpoint(lg) {
+ @include breakpoint(lg) {
// padding: 0;
- margin-bottom: rem.rem(20px);
+ margin-bottom: rem(20px);
margin-top: 0;
}
}
@@ -188,7 +189,7 @@ html body {
background-repeat: no-repeat;
background-position: right 8px center;
background-size: 8px 10px;
- border: 1px solid theme.$border-color;
+ border: 1px solid $border-color;
min-height: 34px;
padding: 6px 8px;
padding-right: 24px;
@@ -206,7 +207,7 @@ html body {
&:disabled,
&.form-select-disabled {
background-image: url('data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAABAAAAAUCAYAAACEYr13AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEKSURBVHgBzVTNDYIwFC4NB46OwAi4gY7gETgoE6gTGCcwTgAJ4efGCLCBjMAIXrmA3yOhQazQhJj4JQ0v7fte3/e1hbFfIk3TYxzHp6kc7dtCFEUW5/xBcdM0a9d1S1kel00mSWKCnIkkxDSnXADIMYYEU9O0zPf91WwB6L6NyB3atrUMw7hNFkCbFyROmXYYmypMDMNwo+t6ztSwtW27oEAXrXBuwu2rCht+WPgU7C8gPCBzYOBKhQS5FTwIKBYeQFeJoWyiKNYH5Co6OCuQr/0JdBuPVyElQCd7GRMb3B3HebsHHzexrmvyQvZwqjFZWsDzvCc62BFhSGYD3UMsfs6ToKOd+6EsxgtrtWLW4gUN3AAAAABJRU5ErkJggg==');
- background-color: theme.$lighter-gray;
+ background-color: $lighter-gray;
}
}
@@ -214,12 +215,12 @@ html body {
// width: 100%;
width: auto;
font-weight: 600;
- margin-bottom: rem.rem(4px);
- @include font.font-size('small');
+ margin-bottom: rem(4px);
+ @include font-size('small');
}
.page-heading {
- @include font.font-size('x-large');
+ @include font-size('x-large');
}
.dropdown-caret {
@@ -230,11 +231,5 @@ html body {
border-right: 4px solid transparent;
border-bottom: 0 solid transparent;
border-left: 4px solid transparent;
- margin-left: rem.rem(8px);
-}
-
-.divider {
- height: 0;
- overflow: hidden;
- border-top: 1px solid #e9ecef;
+ margin-left: rem(8px);
}
diff --git a/web/src/components/App/_theme.scss b/web/src/components/App/_theme.scss
new file mode 100644
index 00000000..a3e09996
--- /dev/null
+++ b/web/src/components/App/_theme.scss
@@ -0,0 +1,47 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// basic colors
+$black: #2a2a2a;
+$white: #ffffff;
+$light: #f7f9fa;
+$gray: #686868;
+$light-gray: #8c8c8c;
+$lighter-gray: #f3f3f3;
+$dark-gray: #637283;
+
+// primary colors
+$first: #072a40;
+$second: #e7e7e7;
+$third: #0a4b73;
+
+// functional colors
+$border-color: #d8d8d8;
+$border-color-light: $lighter-gray;
+
+$link: #6f53c0;
+$link-hover: darken($link, 5%);
+
+$danger-text: #cb2431;
+$danger-background: #f8d7da;
+
+$blue: #0668d7;
+$light-blue: #ecf4ff;
+$green: #28a755;
+
+$active: #49abfd;
diff --git a/web/src/components/App/_variables.scss b/web/src/components/App/_variables.scss
new file mode 100644
index 00000000..0a2907db
--- /dev/null
+++ b/web/src/components/App/_variables.scss
@@ -0,0 +1,31 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+$header-height: 60px;
+$footer-height: 56px;
+
+// breakpoints
+$xl-breakpoint: 1441px;
+$lg-breakpoint: 992px;
+$md-breakpoint: 576px;
+$sm-breakpoint: 321px;
+
+:export {
+ mdBreakpoint: $md-breakpoint;
+ smBreakpoint: $sm-breakpoint;
+}
diff --git a/web/src/components/App/index.tsx b/web/src/components/App/index.tsx
new file mode 100644
index 00000000..092b77e3
--- /dev/null
+++ b/web/src/components/App/index.tsx
@@ -0,0 +1,224 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import React, { Fragment, useEffect, useState } from 'react';
+import { Location } from 'history';
+
+import { getFiltersFromSearchStr } from 'jslib/helpers/filters';
+import { hot } from 'react-hot-loader/root';
+import { Route, Switch } from 'react-router';
+import { RouteComponentProps, withRouter } from 'react-router-dom';
+import { usePrevious } from 'web/libs/hooks';
+import {
+ checkCurrentPath,
+ checkCurrentPathIn,
+ homePathDef,
+ noFooterPaths,
+ noHeaderPaths,
+ notePathDef
+} from 'web/libs/paths';
+import render from '../../routes';
+import { useDispatch, useSelector } from '../../store';
+import { getCurrentUser } from '../../store/auth';
+import { getBooks } from '../../store/books';
+import { updatePage, updateQuery } from '../../store/filters';
+import { setPrevLocation } from '../../store/route';
+import { unsetMessage } from '../../store/ui';
+import MobileMenu from '../Common/MobileMenu';
+import SystemMessage from '../Common/SystemMessage';
+import NormalHeader from '../Header/Normal';
+import NoteHeader from '../Header/Note';
+import Splash from '../Splash';
+import TabBar from '../TabBar';
+import './App.global.scss';
+import styles from './App.scss';
+import HeaderData from './HeaderData';
+
+interface Props extends RouteComponentProps {}
+
+function useFetchData() {
+ const dispatch = useDispatch();
+
+ const { user } = useSelector(state => {
+ return {
+ user: state.auth.user
+ };
+ });
+
+ useEffect(() => {
+ if (!user.isFetched) {
+ dispatch(getCurrentUser());
+ }
+ }, [dispatch, user.isFetched]);
+
+ useEffect(() => {
+ if (user.isFetched) {
+ dispatch(getBooks());
+ }
+ }, [dispatch, user.isFetched]);
+}
+
+function hasLocationChanged(loc1: Location, loc2: Location) {
+ return (
+ loc1.pathname !== loc2.pathname ||
+ loc1.search !== loc2.search ||
+ loc1.hash !== loc2.hash
+ );
+}
+
+// useSavePrevLocation saves the prev location upon route change
+function useSavePrevLocation(location: Location) {
+ const prevLocation = usePrevious(location);
+ const dispatch = useDispatch();
+
+ useEffect(() => {
+ if (!prevLocation) {
+ return;
+ }
+
+ if (hasLocationChanged(location, prevLocation)) {
+ dispatch(setPrevLocation(prevLocation));
+ }
+ }, [prevLocation, dispatch, location]);
+}
+
+function usePersistFilters(location: Location) {
+ const dispatch = useDispatch();
+ useEffect(() => {
+ const f = getFiltersFromSearchStr(location.search);
+
+ dispatch(updateQuery('q', f.queries.q));
+ dispatch(updateQuery('book', f.queries.book));
+ dispatch(updatePage(f.page || 1));
+ }, [dispatch, location.search]);
+}
+
+function useMobileMenuState(
+ location: Location
+): [boolean, React.Dispatch>] {
+ const [isMobileMenuOpen, setMobileMenuOpen] = useState(false);
+
+ function wrappedSetMobileMenuOpen(nextState: boolean) {
+ setMobileMenuOpen(nextState);
+
+ if (nextState) {
+ document.body.classList.add('no-scroll');
+ } else {
+ document.body.classList.remove('no-scroll');
+ }
+ }
+
+ useEffect(() => {
+ wrappedSetMobileMenuOpen(false);
+ }, [location, setMobileMenuOpen]);
+
+ return [isMobileMenuOpen, wrappedSetMobileMenuOpen];
+}
+
+function checkNoFooter(location: Location, loggedIn: boolean): boolean {
+ if (checkCurrentPath(location, notePathDef)) {
+ if (!loggedIn) {
+ return true;
+ }
+ }
+
+ return checkCurrentPathIn(location, noFooterPaths);
+}
+
+function useClearMessage(location: Location) {
+ const dispatch = useDispatch();
+
+ useEffect(() => {
+ dispatch(unsetMessage());
+ }, [dispatch, location.pathname]);
+}
+
+const App: React.FunctionComponent = ({ location }) => {
+ useFetchData();
+ useSavePrevLocation(location);
+ usePersistFilters(location);
+ useClearMessage(location);
+ const [isMobileMenuOpen, setMobileMenuOpen] = useMobileMenuState(location);
+
+ const { user } = useSelector(state => {
+ return {
+ user: state.auth.user
+ };
+ });
+
+ const isReady = !user.isFetched || user.isFetching;
+ if (isReady) {
+ return ;
+ }
+
+ const loggedIn = user.data.uuid !== '';
+ const noHeader = checkCurrentPathIn(location, noHeaderPaths);
+ const noFooter = checkNoFooter(location, loggedIn);
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ {render()}
+
+
+
+
+ {
+ if (noFooter) {
+ return null;
+ }
+
+ return (
+
+ );
+ }}
+ />
+
+
+ {
+ setMobileMenuOpen(false);
+ }}
+ />
+
+ );
+};
+
+export default hot(withRouter(App));
diff --git a/web/src/components/Books/BookHolder.scss b/web/src/components/Books/BookHolder.scss
new file mode 100644
index 00000000..a7293977
--- /dev/null
+++ b/web/src/components/Books/BookHolder.scss
@@ -0,0 +1,41 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/rem';
+
+.wrapper {
+ background: #fff;
+ height: rem(48px);
+ position: relative;
+ border-bottom: 1px solid $border-color-light;
+}
+
+.title {
+ position: absolute;
+ top: rem(12px);
+ left: rem(20px);
+ right: rem(20px);
+ height: rem(20px);
+
+ @include breakpoint(md) {
+ right: auto;
+ width: 152px;
+ }
+}
diff --git a/web/src/components/Books/BookHolder.tsx b/web/src/components/Books/BookHolder.tsx
new file mode 100644
index 00000000..97bae34e
--- /dev/null
+++ b/web/src/components/Books/BookHolder.tsx
@@ -0,0 +1,30 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import styles from './BookHolder.scss';
+
+export default () => {
+ return (
+
+
+
+ );
+};
diff --git a/web/src/components/Books/BookItem/Actions.scss b/web/src/components/Books/BookItem/Actions.scss
new file mode 100644
index 00000000..780cf465
--- /dev/null
+++ b/web/src/components/Books/BookItem/Actions.scss
@@ -0,0 +1,28 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/theme';
+
+.actions {
+ position: absolute;
+ right: rem(8px);
+ top: 50%;
+ transform: translateY(-50%);
+}
diff --git a/web/src/components/Books/BookItem/Actions.tsx b/web/src/components/Books/BookItem/Actions.tsx
new file mode 100644
index 00000000..4fd92132
--- /dev/null
+++ b/web/src/components/Books/BookItem/Actions.tsx
@@ -0,0 +1,75 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import React, { useRef, useState } from 'react';
+import ItemActions from '../../Common/ItemActions';
+import ItemActionsStyles from '../../Common/ItemActions/ItemActions.scss';
+import styles from './Actions.scss';
+
+interface Props {
+ bookUUID: string;
+ onDeleteBook: (string) => void;
+ isActive: boolean;
+}
+
+const Actions: React.FunctionComponent = ({
+ bookUUID,
+ onDeleteBook,
+ isActive
+}) => {
+ const [isOpen, setIsOpen] = useState(false);
+
+ const optRefs = [useRef(null)];
+ const options = [
+ {
+ name: 'remove',
+ value: (
+ {
+ setIsOpen(false);
+ onDeleteBook(bookUUID);
+ }}
+ >
+ Remove…
+
+ )
+ }
+ ];
+
+ return (
+
+ );
+};
+
+export default Actions;
diff --git a/web/src/components/Books/BookItem/BookItem.scss b/web/src/components/Books/BookItem/BookItem.scss
new file mode 100644
index 00000000..56baf64a
--- /dev/null
+++ b/web/src/components/Books/BookItem/BookItem.scss
@@ -0,0 +1,77 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/theme';
+
+.item {
+ position: relative;
+
+ &:not(:first-child) {
+ border-top: 1px solid $border-color-light;
+ }
+}
+
+.link {
+ padding: rem(12px) rem(20px);
+ display: block;
+ color: inherit;
+
+ &:hover {
+ text-decoration: none;
+ }
+}
+
+.icon {
+ vertical-align: middle;
+}
+
+.label {
+ @include font-size('medium');
+
+ display: inline-block;
+ font-weight: 400;
+ margin-bottom: 0;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ width: rem(200px);
+ display: block;
+
+ @include breakpoint(sm) {
+ width: rem(240px);
+ }
+
+ @include breakpoint(md) {
+ width: rem(440px);
+ }
+ @include breakpoint(lg) {
+ width: rem(700px);
+ }
+ @include breakpoint(xl) {
+ width: rem(852px);
+ }
+}
+
+.active {
+ .link {
+ background: $light-blue;
+ color: $black;
+ }
+}
diff --git a/web/src/components/Books/BookItem/index.tsx b/web/src/components/Books/BookItem/index.tsx
new file mode 100644
index 00000000..43620855
--- /dev/null
+++ b/web/src/components/Books/BookItem/index.tsx
@@ -0,0 +1,80 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import classnames from 'classnames';
+import { Link } from 'react-router-dom';
+
+import { getHomePath } from 'web/libs/paths';
+import { BookData } from 'jslib/operations/types';
+import Actions from './Actions';
+
+import styles from './BookItem.scss';
+
+interface Props {
+ book: BookData;
+ isFocused: boolean;
+ setFocusedOptEl: (HTMLElement) => void;
+ onDeleteBook: (bookUUID) => void;
+}
+
+const BookItem: React.FunctionComponent = ({
+ book,
+ isFocused,
+ setFocusedOptEl,
+ onDeleteBook
+}) => {
+ const [isHovered, setIsHovered] = useState(false);
+ const isActive = isFocused || isHovered;
+
+ return (
+ {
+ if (isFocused) {
+ // eslint-disable-next-line no-param-reassign
+ setFocusedOptEl(el);
+ }
+ }}
+ onMouseEnter={() => {
+ setIsHovered(true);
+ }}
+ onMouseLeave={() => {
+ setIsHovered(false);
+ }}
+ >
+
+ {book.label}
+
+
+
+
+ );
+};
+
+export default React.memo(BookItem);
diff --git a/web/src/components/Books/BookList.scss b/web/src/components/Books/BookList.scss
new file mode 100644
index 00000000..0e60b240
--- /dev/null
+++ b/web/src/components/Books/BookList.scss
@@ -0,0 +1,30 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/theme';
+
+.list {
+ background-color: white;
+ list-style: none;
+ padding-left: 0;
+ margin-bottom: 0;
+ margin-top: rem(20px);
+ border-radius: 2px;
+ border: 1px solid $border-color;
+}
diff --git a/web/src/components/Books/BookList.tsx b/web/src/components/Books/BookList.tsx
new file mode 100644
index 00000000..09741533
--- /dev/null
+++ b/web/src/components/Books/BookList.tsx
@@ -0,0 +1,80 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { Fragment } from 'react';
+import classnames from 'classnames';
+
+import { BookData } from 'jslib/operations/types';
+import BookItem from './BookItem';
+import BookHolder from './BookHolder';
+import styles from './BookList.scss';
+
+function Placeholder() {
+ const ret = [];
+
+ for (let i = 0; i < 8; i++) {
+ ret.push( );
+ }
+
+ return {ret} ;
+}
+
+interface Props {
+ isFetching: boolean;
+ isFetched: boolean;
+ books: BookData[];
+ focusedIdx: number;
+ setFocusedOptEl: (HTMLElement) => void;
+ onDeleteBook: (string) => void;
+}
+
+const BookList: React.FunctionComponent = ({
+ isFetching,
+ isFetched,
+ books,
+ focusedIdx,
+ setFocusedOptEl,
+ onDeleteBook
+}) => {
+ return (
+
+ {isFetching ? (
+
+ ) : (
+ books.map((book, idx) => {
+ const isFocused = idx === focusedIdx;
+
+ return (
+
+ );
+ })
+ )}
+
+ );
+};
+
+export default React.memo(BookList);
diff --git a/web/src/components/Books/Books.scss b/web/src/components/Books/Books.scss
new file mode 100644
index 00000000..8d2e3de5
--- /dev/null
+++ b/web/src/components/Books/Books.scss
@@ -0,0 +1,24 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/responsive';
+@import '../App/theme';
+
+.wrapper {
+}
diff --git a/web/src/components/Books/Content.scss b/web/src/components/Books/Content.scss
new file mode 100644
index 00000000..af023f86
--- /dev/null
+++ b/web/src/components/Books/Content.scss
@@ -0,0 +1,59 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/responsive';
+@import '../App/theme';
+
+.header {
+ display: flex;
+ flex-direction: column;
+
+ @include breakpoint(md) {
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ }
+}
+
+.header-left {
+ display: flex;
+ flex-grow: 1;
+ align-items: center;
+ justify-content: space-between;
+}
+
+.search-input-wrapper {
+ width: 100%;
+ margin-top: rem(12px);
+
+ @include breakpoint(md) {
+ width: auto;
+ margin-top: 0;
+ }
+}
+
+.search-input {
+ width: 100%;
+
+ @include breakpoint(md) {
+ margin-top: 0;
+ width: auto;
+ margin-left: rem(24px);
+ }
+}
diff --git a/web/src/components/Books/Content.tsx b/web/src/components/Books/Content.tsx
new file mode 100644
index 00000000..74b7d4d3
--- /dev/null
+++ b/web/src/components/Books/Content.tsx
@@ -0,0 +1,225 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { Fragment, useState, useEffect, useRef } from 'react';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+import classnames from 'classnames';
+import { History } from 'history';
+
+import { BookData } from 'jslib/operations/types';
+import { escapesRegExp } from 'web/libs/string';
+import { getHomePath } from 'web/libs/paths';
+import {
+ KeydownSelectFn,
+ useSearchMenuKeydown,
+ useScrollToFocused
+} from 'web/libs/hooks/dom';
+import { useSelector } from '../../store';
+import CreateBookModal from './CreateBookModal';
+import BookList from './BookList';
+import EmptyList from './EmptyList';
+import SearchInput from '../Common/SearchInput';
+import DeleteBookModal from './DeleteBookModal';
+import { usePrevious } from '../../libs/hooks';
+import CreateBookButton from './CreateBookButton';
+import styles from './Content.scss';
+
+function filterBooks(books: BookData[], searchInput: string): BookData[] {
+ if (searchInput === '') {
+ return books;
+ }
+
+ const input = escapesRegExp(searchInput);
+ const re = new RegExp(input, 'i');
+
+ return books.filter(book => {
+ return re.test(book.label);
+ });
+}
+
+function handleMenuKeydownSelect(history: History): KeydownSelectFn {
+ return (option: BookData) => {
+ const destination = getHomePath({
+ book: option.label
+ });
+
+ history.push(destination);
+ };
+}
+
+function useSetFocusedOptionOnInputFocus({
+ searchValue,
+ searchFocus,
+ setFocusedIdx,
+ containerEl
+}) {
+ useEffect(() => {
+ if (searchFocus) {
+ setFocusedIdx(0);
+ } else {
+ setFocusedIdx(-1);
+ }
+ }, [searchValue, searchFocus, containerEl, setFocusedIdx]);
+}
+
+function useFocusInputOnReset(
+ searchValue: string,
+ inputRef: React.MutableRefObject
+) {
+ const prevSearchValue = usePrevious(searchValue);
+
+ useEffect(() => {
+ if (prevSearchValue !== null && searchValue === '') {
+ if (inputRef.current !== null) {
+ inputRef.current.focus();
+ }
+ }
+ }, [searchValue, inputRef, prevSearchValue]);
+}
+
+interface Props extends RouteComponentProps {
+ setSuccessMessage: (string) => void;
+}
+
+const Content: React.FunctionComponent = ({
+ history,
+ setSuccessMessage
+}) => {
+ const { books } = useSelector(state => {
+ return {
+ books: state.books
+ };
+ });
+
+ const [searchValue, setSearchValue] = useState('');
+ const [searchFocus, setSearchFocus] = useState(false);
+ const [focusedIdx, setFocusedIdx] = useState(-1);
+ const [focusedOptEl, setFocusedOptEl] = useState(null);
+ const [bookUUIDToDelete, setBookUUIDToDelete] = useState('');
+ const [isCreateBookModalOpen, setIsCreateBookModalOpen] = useState(false);
+ const inputRef = useRef(null);
+
+ const filteredBooks = filterBooks(books.data, searchValue);
+ const containerEl = document.body;
+
+ useSetFocusedOptionOnInputFocus({
+ searchValue,
+ searchFocus,
+ setFocusedIdx,
+ containerEl
+ });
+ useSearchMenuKeydown({
+ options: filteredBooks,
+ containerEl,
+ focusedIdx,
+ setFocusedIdx,
+ disabled: !searchFocus,
+ onKeydownSelect: handleMenuKeydownSelect(history)
+ });
+ useScrollToFocused({
+ shouldScroll: true,
+ focusedOptEl,
+ containerEl
+ });
+ useFocusInputOnReset(searchValue, inputRef);
+
+ const hasNoBooks = books.isFetched && filteredBooks.length === 0;
+
+ return (
+
+
+
+
+
Books
+ {
+ setIsCreateBookModalOpen(true);
+ }}
+ />
+
+
+
{
+ const val = e.target.value;
+ setSearchValue(val);
+ }}
+ wrapperClassName={styles['search-input-wrapper']}
+ inputClassName={classnames(
+ 'text-input-small',
+ styles['search-input']
+ )}
+ disabled={books.isFetching}
+ inputRef={inputRef}
+ onFocus={() => {
+ setSearchFocus(true);
+ }}
+ onBlur={() => {
+ setSearchFocus(false);
+ }}
+ onReset={() => {
+ setSearchValue('');
+ }}
+ />
+
+
+
+
+ {hasNoBooks ? (
+
+ ) : (
+ {
+ setBookUUIDToDelete(bookUUID);
+ }}
+ />
+ )}
+
+
+ {
+ setBookUUIDToDelete(null);
+ }}
+ bookUUID={bookUUIDToDelete}
+ setSuccessMessage={setSuccessMessage}
+ />
+
+ {
+ setIsCreateBookModalOpen(false);
+ }}
+ onSuccess={() => {
+ setSearchValue('');
+ }}
+ setSuccessMessage={setSuccessMessage}
+ />
+
+ );
+};
+
+export default React.memo(withRouter(Content));
diff --git a/web/src/components/Books/CreateBookButton.scss b/web/src/components/Books/CreateBookButton.scss
new file mode 100644
index 00000000..90605230
--- /dev/null
+++ b/web/src/components/Books/CreateBookButton.scss
@@ -0,0 +1,36 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/font';
+
+button.create-button {
+ padding: 0;
+ @include font-size('small');
+}
+
+.create-button-content {
+ display: flex;
+ align-items: center;
+}
+
+.create-button-text {
+ margin-left: rem(4px);
+}
diff --git a/web/src/components/Books/CreateBookButton.tsx b/web/src/components/Books/CreateBookButton.tsx
new file mode 100644
index 00000000..1eb759a6
--- /dev/null
+++ b/web/src/components/Books/CreateBookButton.tsx
@@ -0,0 +1,59 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import React from 'react';
+import BookPlusIcon from '../Icons/BookPlus';
+import styles from './CreateBookButton.scss';
+
+interface Props {
+ disabled: boolean;
+ openModal: () => void;
+ className?: string;
+ id?: string;
+}
+
+const CreateBookButton: React.FunctionComponent = ({
+ id,
+ disabled,
+ openModal,
+ className
+}) => {
+ return (
+ {
+ openModal();
+ }}
+ >
+
+
+ Create book
+
+
+ );
+};
+
+export default React.memo(CreateBookButton);
diff --git a/web/src/components/Books/CreateBookModal.scss b/web/src/components/Books/CreateBookModal.scss
new file mode 100644
index 00000000..e97115e0
--- /dev/null
+++ b/web/src/components/Books/CreateBookModal.scss
@@ -0,0 +1,36 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/responsive';
+@import '../App/theme';
+
+.input {
+ margin-top: rem(8px);
+ width: 100%;
+}
+
+.label {
+ width: 100%;
+}
+
+.actions {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: rem(8px);
+}
diff --git a/web/src/components/Books/CreateBookModal.tsx b/web/src/components/Books/CreateBookModal.tsx
new file mode 100644
index 00000000..b472800c
--- /dev/null
+++ b/web/src/components/Books/CreateBookModal.tsx
@@ -0,0 +1,178 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import classnames from 'classnames';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+
+import { checkDuplicate, validateBookName } from 'jslib/helpers/books';
+import Modal, { Header, Body } from '../Common/Modal';
+import { createBook } from '../../store/books';
+import { useSelector, useDispatch } from '../../store';
+import Button from '../Common/Button';
+import Flash from '../Common/Flash';
+
+import styles from './CreateBookModal.scss';
+
+interface Props extends RouteComponentProps {
+ isOpen: boolean;
+ onDismiss: () => void;
+ onSuccess: () => void;
+ setSuccessMessage: (string) => void;
+}
+
+const CreateBookModal: React.FunctionComponent = ({
+ isOpen,
+ onDismiss,
+ onSuccess,
+ setSuccessMessage
+}) => {
+ const [inProgress, setInProgress] = useState(false);
+ const [bookName, setBookName] = useState('');
+ const [errMessage, setErrMessage] = useState('');
+
+ const dispatch = useDispatch();
+ const { books } = useSelector(state => {
+ return {
+ books: state.books
+ };
+ });
+
+ const labelId = 'new-book-modal-label';
+ const nameInputId = 'new-book-modal-name-input';
+
+ let msgId;
+ if (errMessage) {
+ msgId = 'new-book-modal-err';
+ }
+
+ return (
+
+
+
+ {msgId && (
+ {
+ setErrMessage('');
+ }}
+ hasBorder={false}
+ id={msgId}
+ >
+ {errMessage}
+
+ )}
+
+
+ {
+ e.preventDefault();
+ setInProgress(true);
+
+ if (!bookName) {
+ setInProgress(false);
+ setErrMessage('Book label is empty');
+ return;
+ }
+
+ // Check if the book label already exists. If the client somehow posts a duplicate label,
+ // Duplicate book labels will be resolved when they are locally synced, anyway.
+ // TODO: resolve any duplicate book labels on the web as well.
+ if (checkDuplicate(books.data, bookName)) {
+ setInProgress(false);
+ setErrMessage('Duplicate book exists');
+ return;
+ }
+
+ try {
+ validateBookName(bookName);
+ } catch (err) {
+ setInProgress(false);
+ setErrMessage(err.message);
+ return;
+ }
+
+ dispatch(createBook(bookName))
+ .then(() => {
+ setInProgress(false);
+
+ setSuccessMessage(`Created a book: ${bookName}`);
+ setInProgress(false);
+ setBookName('');
+
+ onSuccess();
+ onDismiss();
+ })
+ .catch(err => {
+ setInProgress(false);
+ setErrMessage(err.message);
+ });
+ }}
+ >
+
+
+ Please enter the name of the book
+
+ {
+ const val = e.target.value;
+ setBookName(val);
+ }}
+ />
+
+
+
+
+ Cancel
+
+
+ Create
+
+
+
+
+
+ );
+};
+
+export default withRouter(CreateBookModal);
diff --git a/web/src/components/Books/DeleteBookModal.scss b/web/src/components/Books/DeleteBookModal.scss
new file mode 100644
index 00000000..4b44e711
--- /dev/null
+++ b/web/src/components/Books/DeleteBookModal.scss
@@ -0,0 +1,65 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/responsive';
+@import '../App/theme';
+
+.input {
+ margin-top: rem(8px);
+ width: 100%;
+}
+
+.label {
+ width: 100%;
+}
+
+.actions {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: rem(8px);
+}
+
+.book-label {
+ font-weight: 600;
+ margin-left: rem(4px);
+}
+
+.spinner {
+ display: none;
+
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ margin-left: auto;
+ margin-right: auto;
+ bottom: 0;
+ margin-top: auto;
+ margin-bottom: auto;
+}
+
+.in-progress {
+ .button-content {
+ visibility: hidden;
+ }
+ .spinner {
+ display: block;
+ position: absolute;
+ }
+}
diff --git a/web/src/components/Books/DeleteBookModal.tsx b/web/src/components/Books/DeleteBookModal.tsx
new file mode 100644
index 00000000..95876cd9
--- /dev/null
+++ b/web/src/components/Books/DeleteBookModal.tsx
@@ -0,0 +1,194 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useEffect } from 'react';
+import classnames from 'classnames';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+
+import operations from 'web/libs/operations';
+import Modal, { Header, Body } from '../Common/Modal';
+import Flash from '../Common/Flash';
+import { removeBook } from '../../store/books';
+import { useSelector, useDispatch } from '../../store';
+import Button from '../Common/Button';
+
+import styles from './DeleteBookModal.scss';
+
+function getBookByUUID(books, uuid) {
+ for (let i = 0; i < books.length; ++i) {
+ const book = books[i];
+
+ if (book.uuid === uuid) {
+ return book;
+ }
+ }
+
+ return {};
+}
+
+interface Props extends RouteComponentProps {
+ isOpen: boolean;
+ onDismiss: () => void;
+ setSuccessMessage: (string) => void;
+ bookUUID: string;
+}
+
+const DeleteBookModal: React.FunctionComponent = ({
+ isOpen,
+ onDismiss,
+ setSuccessMessage,
+ bookUUID
+}) => {
+ const [inProgress, setInProgress] = useState(false);
+ const [bookLabel, setBookLabel] = useState('');
+ const [errMessage, setErrMessage] = useState('');
+ const dispatch = useDispatch();
+
+ const { books } = useSelector(state => {
+ return {
+ books: state.books
+ };
+ });
+
+ const book = getBookByUUID(books.data, bookUUID);
+
+ const labelId = 'delete-book-modal-label';
+ const nameInputId = 'delete-book-modal-name-input';
+ const descId = 'delete-book-modal-desc';
+
+ useEffect(() => {
+ if (!isOpen) {
+ setBookLabel('');
+ setErrMessage('');
+ }
+ }, [isOpen]);
+
+ return (
+
+
+
+ {
+ setErrMessage('');
+ }}
+ hasBorder={false}
+ when={Boolean(errMessage)}
+ noMargin
+ >
+ {errMessage}
+
+
+
+
+ This action will permanently remove the following book including its
+ notes:
+
+ {book.label}
+
+
+
+ {
+ e.preventDefault();
+
+ setSuccessMessage('');
+ setInProgress(true);
+
+ if (bookLabel !== book.label) {
+ setErrMessage('The book label did not match');
+ setInProgress(false);
+ return;
+ }
+
+ operations.books
+ .remove(bookUUID)
+ .then(() => {
+ dispatch(removeBook(bookUUID));
+ setInProgress(false);
+ onDismiss();
+
+ // Scroll to top so that the message is visible.
+ setSuccessMessage(
+ `Successfully removed the book: ${book.label}`
+ );
+ window.scrollTo(0, 0);
+ })
+ .catch(err => {
+ console.log('Error deleting book', err);
+ setInProgress(false);
+ setErrMessage(err.message);
+ });
+ }}
+ >
+
+
+ To confirm, please enter the label of the book.
+
+ {
+ const val = e.target.value;
+ setBookLabel(val);
+ }}
+ />
+
+
+
+
+ Cancel
+
+
+ Delete
+
+
+
+
+
+ );
+};
+
+export default withRouter(DeleteBookModal);
diff --git a/web/src/components/Books/EmptyList.scss b/web/src/components/Books/EmptyList.scss
new file mode 100644
index 00000000..9119ee49
--- /dev/null
+++ b/web/src/components/Books/EmptyList.scss
@@ -0,0 +1,27 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/font';
+@import '../App/theme';
+
+.wrapper {
+ text-align: center;
+ padding: rem(48px) 0;
+ color: $gray;
+}
diff --git a/web/src/components/Books/EmptyList.tsx b/web/src/components/Books/EmptyList.tsx
new file mode 100644
index 00000000..1fa32a0a
--- /dev/null
+++ b/web/src/components/Books/EmptyList.tsx
@@ -0,0 +1,31 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import styles from './EmptyList.scss';
+
+const EmptyList: React.FunctionComponent = () => {
+ return (
+
+ );
+};
+
+export default EmptyList;
diff --git a/web/src/components/Books/HeadData.tsx b/web/src/components/Books/HeadData.tsx
new file mode 100644
index 00000000..e51b5fb1
--- /dev/null
+++ b/web/src/components/Books/HeadData.tsx
@@ -0,0 +1,32 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import Helmet from 'react-helmet';
+
+interface Props {}
+
+const HeaderData: React.FunctionComponent = () => {
+ return (
+
+ Books
+
+ );
+};
+
+export default HeaderData;
diff --git a/web/src/components/Books/index.tsx b/web/src/components/Books/index.tsx
new file mode 100644
index 00000000..25b9326e
--- /dev/null
+++ b/web/src/components/Books/index.tsx
@@ -0,0 +1,60 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect, useState, Fragment } from 'react';
+
+import { getBooks } from '../../store/books';
+import { useDispatch } from '../../store';
+import PayWall from '../Common/PayWall';
+import Content from './Content';
+import Flash from '../Common/Flash';
+import HeadData from './HeadData';
+
+const Books: React.FunctionComponent = () => {
+ const [successMessage, setSuccessMessage] = useState('');
+
+ const dispatch = useDispatch();
+ useEffect(() => {
+ dispatch(getBooks());
+ }, [dispatch]);
+
+ return (
+
+
+
+
+
+
+ {
+ setSuccessMessage('');
+ }}
+ >
+ {successMessage}
+
+
+
;
+
+
+
+ );
+};
+
+export default Books;
diff --git a/web/src/components/Common/Auth.scss b/web/src/components/Common/Auth.scss
new file mode 100644
index 00000000..a47829ca
--- /dev/null
+++ b/web/src/components/Common/Auth.scss
@@ -0,0 +1,97 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/font';
+@import '../App/rem';
+
+.page {
+ background: $lighter-gray;
+ text-align: center;
+ min-height: 100vh;
+ padding: 50px 0;
+}
+
+.heading {
+ color: $black;
+ @include font-size('2x-large');
+ font-weight: 300;
+ margin-top: rem(12px);
+ margin-bottom: 0;
+}
+
+.body {
+ max-width: rem(420px);
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: rem(20px);
+}
+
+.referrer-flash {
+ margin: rem(24px) 0;
+}
+.error-flash {
+ margin-bottom: rem(24px);
+}
+
+.footer {
+ margin-top: rem(20px);
+ line-height: rem(20px);
+}
+
+.callout {
+ color: #7c7c7c;
+ @include font-size('small');
+}
+.cta {
+ @include font-size('small');
+}
+
+.panel {
+ border: 1px solid $border-color;
+ background: $white;
+ border-radius: 2px;
+ padding: rem(20px);
+ text-align: left;
+}
+
+.form {
+}
+
+.auth-button {
+ margin-top: rem(16px);
+}
+
+.input-row {
+ & ~ .input-row {
+ margin-top: rem(12px);
+ }
+}
+.label {
+ @include font-size('small');
+ font-weight: 600;
+ width: 100%;
+ margin-bottom: 0;
+}
+
+.forgot {
+ @include font-size('small');
+ float: right;
+ font-weight: 400;
+}
diff --git a/web/src/components/Common/Button/Button.scss b/web/src/components/Common/Button/Button.scss
new file mode 100644
index 00000000..69a39c89
--- /dev/null
+++ b/web/src/components/Common/Button/Button.scss
@@ -0,0 +1,43 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/rem';
+
+.spinner {
+ display: none;
+
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ margin-left: auto;
+ margin-right: auto;
+ bottom: 0;
+ margin-top: auto;
+ margin-bottom: auto;
+}
+
+.busy {
+ .content {
+ visibility: hidden;
+ }
+ .spinner {
+ display: block;
+ position: absolute;
+ }
+}
diff --git a/web/src/components/Common/Button/index.tsx b/web/src/components/Common/Button/index.tsx
new file mode 100644
index 00000000..11d09d66
--- /dev/null
+++ b/web/src/components/Common/Button/index.tsx
@@ -0,0 +1,83 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+/* eslint-disable react/button-has-type */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import SpinnerIcon from '../../Icons/Spinner';
+import styles from './Button.scss';
+
+type ButtonType = 'button' | 'submit' | 'reset';
+
+interface Props {
+ type: ButtonType;
+ kind: string;
+ size?: string;
+ children: React.ReactNode;
+ id?: string;
+ className?: string;
+ isBusy?: boolean;
+ stretch?: boolean;
+ disabled?: boolean;
+ onClick?: () => void;
+ tabIndex?: number;
+}
+
+const Button: React.FunctionComponent = ({
+ id,
+ type,
+ kind,
+ size,
+ children,
+ className,
+ isBusy,
+ stretch,
+ disabled,
+ onClick,
+ tabIndex
+}) => {
+ return (
+
+ {children}
+
+ {isBusy && (
+
+ )}
+
+ );
+};
+
+export default Button;
diff --git a/web/src/components/Common/Editor/BookSelector/OptionItem.scss b/web/src/components/Common/Editor/BookSelector/OptionItem.scss
new file mode 100644
index 00000000..38613fc7
--- /dev/null
+++ b/web/src/components/Common/Editor/BookSelector/OptionItem.scss
@@ -0,0 +1,64 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../../App/theme';
+@import '../../../App/responsive';
+@import '../../../App/rem';
+@import '../../../App/font';
+
+.combobox-option {
+ position: relative;
+ padding: rem(4px) rem(16px) rem(4px) rem(28px);
+ flex-grow: 1;
+ color: black;
+
+ &:hover {
+ background: $third;
+ color: white;
+ text-decoration: none;
+ }
+
+ &.active {
+ background: $light;
+ }
+
+ &.focused {
+ background: $third;
+ color: white;
+
+ .check {
+ #check-core {
+ fill: white;
+ }
+ }
+ }
+}
+
+.check-icon {
+ position: absolute;
+ left: rem(8px);
+ top: 50%;
+ transform: translateY(-50%);
+}
+
+.option-label {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ max-width: rem(260px);
+}
diff --git a/web/src/components/Common/Editor/BookSelector/OptionItem.tsx b/web/src/components/Common/Editor/BookSelector/OptionItem.tsx
new file mode 100644
index 00000000..dc897585
--- /dev/null
+++ b/web/src/components/Common/Editor/BookSelector/OptionItem.tsx
@@ -0,0 +1,87 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import { Option } from 'jslib/helpers/select';
+import CheckIcon from '../../../Icons/Check';
+import styles from './OptionItem.scss';
+
+interface Props {
+ option: Option;
+ isSelected: boolean;
+ isFocused: boolean;
+ onSelect: (Option) => void;
+ isNew?: boolean;
+ id?: string;
+ className?: string;
+}
+
+function renderBody(isNew: boolean, label: string) {
+ if (isNew) {
+ return `Create book '${label}'`;
+ }
+
+ return label;
+}
+
+const OptionItem: React.FunctionComponent = ({
+ option,
+ isSelected,
+ isFocused,
+ onSelect,
+ isNew,
+ id
+}) => {
+ return (
+ {
+ onSelect(option);
+ }}
+ className={classnames(
+ 'T-book-item-option',
+ 'button-no-ui',
+ `book-item-${option.value}`,
+ styles['combobox-option'],
+ {
+ [styles.active]: isSelected,
+ [styles.focused]: isFocused
+ }
+ )}
+ >
+ {isSelected && (
+
+ )}
+
+ {renderBody(isNew, option.label)}
+
+
+ );
+};
+
+export default OptionItem;
diff --git a/web/src/components/Common/Editor/BookSelector/index.scss b/web/src/components/Common/Editor/BookSelector/index.scss
new file mode 100644
index 00000000..fc01c7fb
--- /dev/null
+++ b/web/src/components/Common/Editor/BookSelector/index.scss
@@ -0,0 +1,209 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../../App/theme';
+@import '../../../App/responsive';
+@import '../../../App/rem';
+@import '../../../App/font';
+
+.popover-wrapper {
+ position: relative;
+
+ @include breakpoint(md) {
+ width: rem(352px);
+ }
+}
+
+.book-selector-trigger {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
+.book-selector-trigger-left {
+ display: flex;
+ align-items: center;
+}
+
+.trigger {
+ width: 100%;
+ height: 100%;
+ padding: 0;
+ z-index: 1;
+
+ padding: rem(8px) rem(12px);
+ position: relative;
+ border-radius: rem(4px);
+ display: block;
+ background-color: #f7f9fa;
+ border: 1px solid $border-color;
+
+ &:focus {
+ border-color: $light-blue;
+ }
+ &:hover {
+ border-color: darken($border-color, 5%);
+ }
+
+ &:focus,
+ &:hover {
+ background-color: darken(#f7f9fa, 2%);
+ }
+}
+
+.book-label {
+ margin-left: rem(8px);
+ font-weight: 600;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ max-width: rem(260px);
+ visibility: hidden;
+
+ &.book-label-visible {
+ visibility: visible;
+ }
+}
+
+.content {
+ width: 100%;
+}
+
+.combobox-label {
+ display: none;
+}
+
+.add-book-button {
+ padding: rem(12px) rem(24px);
+
+ &:hover {
+ color: $third;
+
+ .plus {
+ path {
+ fill: $third;
+ }
+ line {
+ stroke: $third;
+ }
+ }
+ }
+}
+
+.add-book-button-content {
+ display: flex;
+ align-content: center;
+}
+
+.add-book-cta {
+ margin-left: rem(8px);
+ display: inline-block;
+}
+
+.button-label {
+}
+
+.input {
+ width: 100%;
+}
+
+.input-wrapper {
+ background: $white;
+}
+
+// searchable menu
+.content {
+ z-index: 3;
+}
+
+.caret {
+ margin-left: rem(4px);
+}
+
+.dropdown {
+ max-height: rem(200px);
+ overflow-y: auto;
+
+ @include breakpoint(md) {
+ max-height: rem(400px);
+ }
+}
+
+.combobox-item {
+ display: flex;
+
+ &:not(:first-child) {
+ border-top: 1px solid #e6e6e6;
+ }
+}
+
+.combobox-active-item {
+ background: $third;
+ color: white;
+}
+
+.combobox-option {
+ position: relative;
+ padding: rem(4px) rem(16px) rem(4px) rem(28px);
+ flex-grow: 1;
+ color: black;
+
+ &:hover {
+ background: $third;
+ color: white;
+ text-decoration: none;
+ }
+
+ &.active {
+ background: $light;
+ }
+
+ &.focused {
+ background: $third;
+ color: white;
+
+ .check {
+ #check-core {
+ fill: white;
+ }
+ }
+ }
+}
+
+.combobox-label {
+ display: block;
+ @include font-size('small');
+ font-weight: 600;
+ background: $light;
+ padding: rem(4px) rem(12px);
+ border-top-left-radius: 3px;
+ border-top-right-radius: 3px;
+ border-bottom: 1px solid #e6e6e6;
+}
+
+.combobox {
+ border-bottom: 1px solid #e6e6e6;
+ background: $light;
+}
+.textbox {
+ @include font-size('small');
+}
+
+.input-wrapper-container {
+ padding: rem(8px);
+}
diff --git a/web/src/components/Common/Editor/BookSelector/index.tsx b/web/src/components/Common/Editor/BookSelector/index.tsx
new file mode 100644
index 00000000..0436b12c
--- /dev/null
+++ b/web/src/components/Common/Editor/BookSelector/index.tsx
@@ -0,0 +1,224 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// TODO: refactor to enforce the following rule
+/* eslint-disable react/jsx-props-no-spreading */
+
+import React, { useState, useEffect } from 'react';
+import classnames from 'classnames';
+
+import { booksToOptions } from 'jslib/helpers/select';
+import { isPrintableKey } from 'jslib/helpers/keyboard';
+import Popover from '../../Popover';
+import SearchableMenu from '../../SearchableMenu';
+import BookIcon from '../../../Icons/Book';
+import CaretIcon from '../../../Icons/Caret';
+import SearchInput from '../../SearchInput';
+import { useDispatch, useSelector } from '../../../../store';
+import { updateBook, EditorSession } from '../../../../store/editor';
+import OptionItem from './OptionItem';
+import styles from './index.scss';
+
+interface Props {
+ editor: EditorSession;
+ wrapperClassName?: string;
+ triggerClassName?: string;
+ isReady: boolean;
+ defaultIsOpen?: boolean;
+ onAfterChange: () => void;
+ isOpen: boolean;
+ setIsOpen: (boolean) => void;
+ triggerRef?: React.MutableRefObject;
+}
+
+const BookSelector: React.FunctionComponent = ({
+ editor,
+ wrapperClassName,
+ triggerClassName,
+ isReady,
+ onAfterChange,
+ isOpen,
+ setIsOpen,
+ triggerRef
+}) => {
+ const { books } = useSelector(state => {
+ return {
+ books: state.books
+ };
+ });
+ const dispatch = useDispatch();
+
+ const [textboxValue, setTextboxValue] = useState('');
+
+ useEffect(() => {
+ if (!isOpen) {
+ setTextboxValue('');
+ }
+ }, [isOpen]);
+
+ const options = booksToOptions(books.data);
+ const currentValue = editor.bookUUID;
+ const currentLabel = editor.bookLabel;
+
+ let ariaExpanded;
+ if (isOpen) {
+ ariaExpanded = 'true';
+ }
+
+ function handleSelect(option) {
+ dispatch(
+ updateBook({
+ sessionKey: editor.sessionKey,
+ label: option.label,
+ uuid: option.value
+ })
+ );
+ onAfterChange();
+ }
+
+ return (
+ {
+ return (
+ {
+ if (triggerRef) {
+ // eslint-disable-next-line no-param-reassign
+ triggerRef.current = el;
+ }
+
+ // eslint-disable-next-line no-param-reassign
+ triggerProps.triggerRef.current = el;
+ }}
+ type="button"
+ className={classnames(
+ styles.trigger,
+ triggerClassName,
+ triggerProps.triggerClassName
+ )}
+ onClick={() => {
+ setIsOpen(!isOpen);
+ }}
+ onKeyDown={e => {
+ if (isPrintableKey(e.nativeEvent)) {
+ e.preventDefault();
+
+ setTextboxValue(e.key);
+ setIsOpen(true);
+ }
+ }}
+ aria-haspopup="menu"
+ aria-expanded={ariaExpanded}
+ aria-controls="book-filter"
+ disabled={!isReady}
+ >
+
+
+
+
+ {isReady ? currentLabel || 'Choose a book' : 'Loading...'}
+
+
+
+
+
+ );
+ }}
+ renderContent={() => {
+ return (
+ {
+ return (
+
+ );
+ }}
+ renderCreateOption={(option, { isFocused }) => {
+ return (
+
+ );
+ }}
+ renderInput={inputProps => {
+ return (
+
+ {
+ const val = e.target.value;
+ setTextboxValue(val);
+ }}
+ {...inputProps}
+ />
+
+ );
+ }}
+ />
+ );
+ }}
+ />
+ );
+};
+
+export default BookSelector;
diff --git a/web/src/components/Common/Editor/Editor.scss b/web/src/components/Common/Editor/Editor.scss
new file mode 100644
index 00000000..b1f142d0
--- /dev/null
+++ b/web/src/components/Common/Editor/Editor.scss
@@ -0,0 +1,97 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/responsive';
+@import '../../App/rem';
+
+$border-radius: rem(4px);
+
+.content-wrapper {
+ display: flex;
+ position: relative;
+ border-top: none;
+ padding: rem(16px);
+ flex-grow: 1;
+
+ @include breakpoint(lg) {
+ flex-grow: initial;
+ }
+}
+
+.wrapper {
+ border-bottom-left-radius: $border-radius;
+ border-bottom-right-radius: $border-radius;
+
+ display: flex;
+ flex-direction: column;
+ flex-grow: 1;
+
+ @include breakpoint(lg) {
+ display: block;
+ }
+}
+
+.actions {
+ text-align: right;
+ padding: 0 rem(16px) rem(16px) 0;
+}
+
+.row {
+ border-style: solid;
+ border-color: $border-color;
+ border-top-width: 0px;
+ border-bottom-width: 1px;
+ border-left-width: 0;
+ border-right-width: 0;
+}
+
+.editor-header {
+ padding: rem(8px) rem(16px) 0;
+}
+
+.tabs {
+ margin-bottom: -1px;
+ margin-top: rem(16px);
+}
+
+button.tab {
+ padding: rem(8px) rem(20px);
+ color: $gray;
+ @include font-size('small');
+
+ & ~ & {
+ margin-left: 0;
+ }
+
+ &:focus {
+ outline: none;
+ }
+ &:hover {
+ color: $black;
+ }
+
+ &.tab-active {
+ background: white;
+ color: $black;
+ border: 1px solid $border-color;
+ border-bottom: 0;
+ border-radius: rem(4px) rem(4px) 0 0;
+ }
+}
diff --git a/web/src/components/Common/Editor/Preview.scss b/web/src/components/Common/Editor/Preview.scss
new file mode 100644
index 00000000..a2cf036a
--- /dev/null
+++ b/web/src/components/Common/Editor/Preview.scss
@@ -0,0 +1,26 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/responsive';
+@import '../../App/rem';
+
+.wrapper {
+ min-height: rem(500px);
+}
diff --git a/web/src/components/Common/Editor/Preview.tsx b/web/src/components/Common/Editor/Preview.tsx
new file mode 100644
index 00000000..c7e4d11f
--- /dev/null
+++ b/web/src/components/Common/Editor/Preview.tsx
@@ -0,0 +1,38 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import styles from './Preview.scss';
+import { parseMarkdown } from '../../../helpers/markdown';
+
+interface Props {
+ content: string;
+}
+
+const Preview: React.FunctionComponent = ({ content }) => {
+ return (
+
+ );
+};
+
+export default Preview;
diff --git a/web/src/components/Common/Editor/Textarea.scss b/web/src/components/Common/Editor/Textarea.scss
new file mode 100644
index 00000000..19a14823
--- /dev/null
+++ b/web/src/components/Common/Editor/Textarea.scss
@@ -0,0 +1,61 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/responsive';
+@import '../../App/rem';
+
+$border-radius: rem(4px);
+
+.wrapper {
+ flex-grow: 1;
+}
+
+textarea.textarea {
+ width: 100%;
+ padding: rem(12px) rem(12px) rem(24px) rem(12px);
+ background: #fafbfd;
+ min-height: 100%;
+
+ @include breakpoint(lg) {
+ height: auto;
+ min-height: rem(500px);
+ }
+
+ @include landscape {
+ height: auto;
+ min-height: rem(500px);
+ }
+}
+
+.tip {
+ position: absolute;
+ bottom: 20px;
+ right: 32px;
+ color: $gray;
+ font-style: italic;
+ @include font-size('small');
+ display: none;
+
+ @include breakpoint(md) {
+ &.shown {
+ display: block;
+ }
+ }
+}
diff --git a/web/src/components/Common/Editor/Textarea.tsx b/web/src/components/Common/Editor/Textarea.tsx
new file mode 100644
index 00000000..a0f6bbb0
--- /dev/null
+++ b/web/src/components/Common/Editor/Textarea.tsx
@@ -0,0 +1,95 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import { KEYCODE_ENTER } from 'jslib/helpers/keyboard';
+import React, { useState } from 'react';
+import { useDispatch } from '../../../store';
+import { flushContent } from '../../../store/editor';
+import editorStyles from './Editor.scss';
+import styles from './Textarea.scss';
+
+interface Props {
+ sessionKey: string;
+ content: string;
+ onChange: (string) => void;
+ onSubmit: () => void;
+ textareaRef: React.MutableRefObject;
+ inputTimerRef: React.MutableRefObject;
+ disabled?: boolean;
+}
+
+const Textarea: React.FunctionComponent = ({
+ sessionKey,
+ content,
+ onChange,
+ onSubmit,
+ textareaRef,
+ inputTimerRef,
+ disabled
+}) => {
+ const [contentFocused, setContentFocused] = useState(false);
+ const dispatch = useDispatch();
+
+ return (
+
+ {
+ const { value } = e.target;
+ onChange(value);
+
+ // flush the draft to the data store when user stops typing
+ if (inputTimerRef.current) {
+ window.clearTimeout(inputTimerRef.current);
+ }
+ // eslint-disable-next-line no-param-reassign
+ inputTimerRef.current = window.setTimeout(() => {
+ // eslint-disable-next-line no-param-reassign
+ inputTimerRef.current = null;
+
+ dispatch(flushContent(sessionKey, value));
+ }, 1000);
+ }}
+ onFocus={() => {
+ setContentFocused(true);
+ }}
+ onKeyDown={e => {
+ if (e.shiftKey && e.keyCode === KEYCODE_ENTER) {
+ e.preventDefault();
+
+ onSubmit();
+ }
+ }}
+ onBlur={() => setContentFocused(false)}
+ className={classnames(styles.textarea, 'text-input')}
+ placeholder="What did you learn?"
+ disabled={disabled}
+ />
+
+
+ Shift + Enter to save
+
+
+ );
+};
+
+export default Textarea;
diff --git a/web/src/components/Common/Editor/index.tsx b/web/src/components/Common/Editor/index.tsx
new file mode 100644
index 00000000..fd322d5c
--- /dev/null
+++ b/web/src/components/Common/Editor/index.tsx
@@ -0,0 +1,216 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useRef } from 'react';
+import classnames from 'classnames';
+import { Link } from 'react-router-dom';
+import { Location } from 'history';
+
+import { focusTextarea } from 'web/libs/dom';
+import { getHomePath } from 'web/libs/paths';
+import BooksSelector from './BookSelector';
+import { useDispatch, useSelector } from '../../../store';
+import {
+ flushContent,
+ resetEditor,
+ EditorSession
+} from '../../../store/editor';
+import Textarea from './Textarea';
+import Preview from './Preview';
+import Button from '../Button';
+import styles from './Editor.scss';
+
+function getContentCacheKey(editorSessionKey: string) {
+ return `editor.${editorSessionKey}.content`;
+}
+
+function useEditorContent(
+ editor: EditorSession,
+ cacheKey: string
+): [string, React.Dispatch] {
+ const cached = localStorage.getItem(cacheKey);
+ return useState(cached || editor.content);
+}
+
+interface Props {
+ editor: EditorSession;
+ onSubmit: (param: { draftContent: string; draftBookUUID: string }) => void;
+ isBusy: boolean;
+ cancelPath?: Location;
+ isNew?: boolean;
+ disabled?: boolean;
+ textareaRef: React.MutableRefObject;
+ bookSelectorTriggerRef?: React.MutableRefObject;
+}
+
+enum Mode {
+ write,
+ preview
+}
+
+const Editor: React.FunctionComponent = ({
+ editor,
+ onSubmit,
+ isBusy,
+ disabled,
+ textareaRef,
+ isNew,
+ bookSelectorTriggerRef,
+ cancelPath = getHomePath()
+}) => {
+ const { books } = useSelector(state => {
+ return {
+ books: state.books
+ };
+ });
+ const dispatch = useDispatch();
+ const [bookSelectorOpen, setBookSelectorOpen] = useState(false);
+
+ const contentCacheKey = getContentCacheKey(editor.sessionKey);
+ const [content, setContent] = useEditorContent(editor, contentCacheKey);
+ const [mode, setMode] = useState(Mode.write);
+ const inputTimerRef = useRef(null);
+
+ const isWriteMode = mode === Mode.write;
+ const isPreviewMode = mode === Mode.preview;
+
+ function handleSubmit() {
+ // immediately flush the content
+ if (inputTimerRef.current) {
+ window.clearTimeout(inputTimerRef.current);
+
+ // eslint-disable-next-line no-param-reassign
+ inputTimerRef.current = null;
+ dispatch(flushContent(editor.sessionKey, content));
+ }
+
+ onSubmit({ draftContent: content, draftBookUUID: editor.bookUUID });
+ localStorage.removeItem(contentCacheKey);
+ }
+
+ if (disabled) {
+ return loading
;
+ }
+
+ return (
+ {
+ e.preventDefault();
+ handleSubmit();
+ }}
+ >
+
+
+ {
+ if (textareaRef.current) {
+ focusTextarea(textareaRef.current);
+ }
+ }}
+ />
+
+
+
+ {
+ setMode(Mode.write);
+ }}
+ >
+ Write
+
+
+ {
+ setMode(Mode.preview);
+ }}
+ >
+ Preview
+
+
+
+
+
+ {mode === Mode.write ? (
+
{
+ localStorage.setItem(contentCacheKey, c);
+ setContent(c);
+ }}
+ onSubmit={handleSubmit}
+ />
+ ) : (
+
+ )}
+
+
+
+
+ {isNew ? 'Save' : 'Update'}
+
+
+ {
+ const ok = window.confirm('Are you sure?');
+ if (!ok) {
+ e.preventDefault();
+ return;
+ }
+
+ localStorage.removeItem(contentCacheKey);
+ dispatch(resetEditor(editor.sessionKey));
+ }}
+ className="button button-second button-normal"
+ >
+ Cancel
+
+
+
+ );
+};
+
+export default Editor;
diff --git a/web/src/components/Common/Flash/Flash.scss b/web/src/components/Common/Flash/Flash.scss
new file mode 100644
index 00000000..dacc329a
--- /dev/null
+++ b/web/src/components/Common/Flash/Flash.scss
@@ -0,0 +1,79 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/rem';
+
+.wrapper {
+ position: relative;
+ padding: rem(8px) rem(16px);
+ margin-bottom: rem(20px);
+
+ &.border {
+ border: 1px solid transparent;
+ }
+
+ &.dismissable {
+ padding-right: rem(32px);
+ }
+ &.nomargin {
+ margin-bottom: 0;
+ }
+}
+
+.dismiss {
+ position: absolute;
+ right: 0;
+ top: 50%;
+ transform: translateY(-50%);
+}
+
+.success {
+ color: #155724;
+ background-color: #d4edda;
+
+ &.border {
+ border-color: #c3e6cb;
+ }
+}
+
+.info {
+ color: #0c5460;
+ background-color: #d1ecf1;
+
+ &.border {
+ border-color: #bee5eb;
+ }
+}
+
+.warning {
+ color: #856404;
+ background-color: #fff3cd;
+
+ &.border {
+ border-color: #ffeeba;
+ }
+}
+
+.danger {
+ color: #721c24;
+ background-color: #f8d7da;
+
+ &.border {
+ border-color: #f5c6cb;
+ }
+}
diff --git a/web/src/components/Common/Flash/index.tsx b/web/src/components/Common/Flash/index.tsx
new file mode 100644
index 00000000..749b6ac9
--- /dev/null
+++ b/web/src/components/Common/Flash/index.tsx
@@ -0,0 +1,104 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import CloseIcon from '../../Icons/Close';
+
+import styles from './Flash.scss';
+
+const TYPE_SUCCESS = 'success';
+const TYPE_INFO = 'info';
+const TYPE_WARNING = 'warning';
+const TYPE_DANGER = 'danger';
+
+const validTypes = [TYPE_SUCCESS, TYPE_INFO, TYPE_WARNING, TYPE_DANGER];
+
+function validateType(kind) {
+ return validTypes.indexOf(kind) > -1;
+}
+
+interface Props {
+ id?: string;
+ kind: string;
+ when?: boolean;
+ hasBorder?: boolean;
+ noMargin?: boolean;
+ onDismiss?: () => void;
+ wrapperClassName?: string;
+ contentClassName?: string;
+ children: React.ReactNode;
+}
+
+const Flash: React.FunctionComponent = ({
+ id,
+ when,
+ kind,
+ children,
+ hasBorder,
+ onDismiss,
+ noMargin,
+ wrapperClassName,
+ contentClassName
+}) => {
+ // If `when` prop is provided and is explicitly false, do not render
+ if (when === false) {
+ return null;
+ }
+
+ if (!validateType(kind)) {
+ console.log(`Invalid kind ${kind}`);
+ }
+
+ const dismissable = Boolean(onDismiss);
+
+ return (
+
+
{children}
+
+ {dismissable && (
+
+
+
+ )}
+
+ );
+};
+
+Flash.defaultProps = {
+ hasBorder: true
+};
+
+export default Flash;
diff --git a/web/src/components/Common/ItemActions/ItemActions.scss b/web/src/components/Common/ItemActions/ItemActions.scss
new file mode 100644
index 00000000..c9c7b801
--- /dev/null
+++ b/web/src/components/Common/ItemActions/ItemActions.scss
@@ -0,0 +1,72 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+
+.wrapper {
+ position: relative;
+ display: flex;
+ align-items: center;
+}
+
+.active {
+ button.trigger {
+ border-color: $border-color;
+ }
+}
+
+.is-open {
+ z-index: 1;
+}
+
+button.trigger {
+ padding: rem(12px) rem(12px);
+ transition: none;
+ border-radius: 4px;
+ border-width: 1px;
+ border-style: solid;
+ border-color: transparent;
+
+ @include breakpoint(mddown) {
+ border-color: $border-color;
+ }
+}
+
+.content {
+ background: $white;
+ z-index: 99;
+ width: rem(120px);
+}
+
+a.action,
+button.action {
+ display: block;
+ text-align: center;
+ padding: rem(4px) 0;
+ color: inherit;
+ @include font-size('small');
+}
+
+a.action {
+ &:hover {
+ color: inherit;
+ }
+}
diff --git a/web/src/components/Common/ItemActions/index.tsx b/web/src/components/Common/ItemActions/index.tsx
new file mode 100644
index 00000000..90d3c154
--- /dev/null
+++ b/web/src/components/Common/ItemActions/index.tsx
@@ -0,0 +1,73 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import React from 'react';
+import Menu, { MenuOption } from '../../Common/Menu';
+import DotsIcon from '../../Icons/Dots';
+import styles from './ItemActions.scss';
+
+interface Props {
+ id: string;
+ triggerId: string;
+ isActive: boolean;
+ options: MenuOption[];
+ optRefs: React.MutableRefObject[];
+ isOpen: boolean;
+ setIsOpen: React.Dispatch;
+ wrapperClassName?: string;
+ disabled?: boolean;
+}
+
+const ItemActions: React.FunctionComponent = ({
+ id,
+ triggerId,
+ isActive,
+ options,
+ optRefs,
+ isOpen,
+ setIsOpen,
+ wrapperClassName,
+ disabled
+}) => {
+ return (
+
+
}
+ triggerClassName={styles.trigger}
+ contentClassName={styles.content}
+ alignment="right"
+ direction="bottom"
+ disabled={disabled}
+ />
+
+ );
+};
+
+export default ItemActions;
diff --git a/web/src/components/Common/LegacyFooter.js b/web/src/components/Common/LegacyFooter.js
new file mode 100644
index 00000000..ac670f36
--- /dev/null
+++ b/web/src/components/Common/LegacyFooter.js
@@ -0,0 +1,52 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+export default () => {
+ return (
+
+
Why do I need this?
+
+ From March 2019, all data on Dnote will be encrypted to respect your
+ privacy. To benefit from this new system, you are required to login here
+ and set your credentials.
+
+
+
How long does it take?
+
It will take a minute.
+
+
What do I need to do?
+
+ After logging in, you will choose an email/password combination. If you
+ already have one, you can reuse it. Then, the page will automatically
+ encrypt all your data from the beginning of time.
+
+
+
How will the encryption work?
+
+ Dnote will use AES256 block cipher to encrypt everything before sending
+ it to the server. AES256 is considered unbreakable and is used by
+ government agencies around the world to encrypt top secrets.
+
+
+
Can I change email/password later?
+
Yes, you can.
+
+ );
+};
diff --git a/web/src/components/Common/Menu/Menu.scss b/web/src/components/Common/Menu/Menu.scss
new file mode 100644
index 00000000..d5f7abc3
--- /dev/null
+++ b/web/src/components/Common/Menu/Menu.scss
@@ -0,0 +1,27 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+.content {
+ box-shadow: 0 0 0 1px rgba(99, 114, 130, 0.16),
+ 0 8px 16px rgba(27, 39, 51, 0.08);
+ z-index: 1;
+}
+
+.wrapper {
+ position: relative;
+}
diff --git a/web/src/components/Common/Menu/index.tsx b/web/src/components/Common/Menu/index.tsx
new file mode 100644
index 00000000..34f8fa38
--- /dev/null
+++ b/web/src/components/Common/Menu/index.tsx
@@ -0,0 +1,202 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useEffect } from 'react';
+import classnames from 'classnames';
+
+import { KEYCODE_UP, KEYCODE_DOWN } from 'jslib/helpers/keyboard';
+import { useEventListener } from 'web/libs/hooks';
+import Popover from '../Popover';
+import { Direction, Alignment } from './types';
+import styles from './Menu.scss';
+
+export interface MenuOption {
+ name: string;
+ value: React.ReactElement;
+}
+
+interface ContentProps {
+ options: MenuOption[];
+ menuId: string;
+ setContentEl: (any) => void;
+ headerContent?: React.ReactNode;
+}
+
+const Content: React.FunctionComponent = ({
+ options,
+ menuId,
+ setContentEl,
+ headerContent
+}) => {
+ return (
+
+
+
+
+ );
+};
+
+interface MenuProps {
+ options: MenuOption[];
+ isOpen: boolean;
+ setIsOpen: (boolean) => void;
+ optRefs: React.MutableRefObject[];
+ triggerContent: React.ReactNode;
+ triggerClassName?: string;
+ contentClassName?: string;
+ alignment: Alignment;
+ alignmentMd?: Alignment;
+ direction: Direction;
+ headerContent?: React.ReactNode;
+ wrapperClassName?: string;
+ menuId: string;
+ triggerId: string;
+ disabled?: boolean;
+ defaultCurrentOptionIdx?: number;
+}
+
+const Menu: React.FunctionComponent = ({
+ options,
+ isOpen,
+ setIsOpen,
+ optRefs,
+ triggerContent,
+ triggerClassName,
+ contentClassName,
+ alignment,
+ alignmentMd,
+ direction,
+ headerContent,
+ wrapperClassName,
+ menuId,
+ triggerId,
+ disabled,
+ defaultCurrentOptionIdx = 0
+}) => {
+ const [currentOptionIdx, setCurrentOptionIdx] = useState(
+ defaultCurrentOptionIdx
+ );
+ const [contentEl, setContentEl] = useState(null);
+
+ useEffect(() => {
+ if (isOpen) {
+ const ref = optRefs[currentOptionIdx];
+ const el = ref.current;
+
+ if (el) {
+ el.focus();
+ }
+ } else {
+ setCurrentOptionIdx(defaultCurrentOptionIdx);
+ }
+ }, [isOpen, currentOptionIdx, defaultCurrentOptionIdx, optRefs]);
+
+ useEventListener(contentEl, 'keydown', e => {
+ const { keyCode } = e;
+
+ if (keyCode === KEYCODE_UP || keyCode === KEYCODE_DOWN) {
+ // Avoid scrolling the whole page down
+ e.preventDefault();
+ // Stop event propagation in case any parent is also listening on the same set of keys.
+ e.stopPropagation();
+
+ let nextOptionIdx;
+ if (currentOptionIdx === 0 && keyCode === KEYCODE_UP) {
+ nextOptionIdx = options.length - 1;
+ } else if (
+ currentOptionIdx === options.length - 1 &&
+ keyCode === KEYCODE_DOWN
+ ) {
+ nextOptionIdx = 0;
+ } else if (keyCode === KEYCODE_DOWN) {
+ nextOptionIdx = currentOptionIdx + 1;
+ } else if (keyCode === KEYCODE_UP) {
+ nextOptionIdx = currentOptionIdx - 1;
+ }
+
+ setCurrentOptionIdx(nextOptionIdx);
+ }
+ });
+
+ let ariaExpanded;
+ if (isOpen) {
+ ariaExpanded = 'true';
+ }
+
+ return (
+ {
+ return (
+ {
+ setIsOpen(!isOpen);
+ }}
+ aria-haspopup="menu"
+ aria-expanded={ariaExpanded}
+ aria-controls={menuId}
+ disabled={disabled}
+ >
+ {triggerContent}
+
+ );
+ }}
+ contentClassName={classnames(styles.content, contentClassName)}
+ wrapperClassName={classnames(styles.wrapper, wrapperClassName)}
+ isOpen={isOpen}
+ setIsOpen={setIsOpen}
+ alignment={alignment}
+ alignmentMd={alignmentMd}
+ direction={direction}
+ renderContent={() => {
+ return (
+
+ );
+ }}
+ />
+ );
+};
+
+export default Menu;
diff --git a/web/src/components/Common/Menu/types.ts b/web/src/components/Common/Menu/types.ts
new file mode 100644
index 00000000..389bef38
--- /dev/null
+++ b/web/src/components/Common/Menu/types.ts
@@ -0,0 +1,20 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export type Direction = 'top' | 'bottom';
+export type Alignment = 'top' | 'bottom' | 'left' | 'right';
diff --git a/web/src/components/Common/MobileMenu.scss b/web/src/components/Common/MobileMenu.scss
new file mode 100644
index 00000000..c60350bd
--- /dev/null
+++ b/web/src/components/Common/MobileMenu.scss
@@ -0,0 +1,76 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/rem';
+@import '../App/font';
+
+.wrapper {
+ position: fixed;
+ top: 0;
+ bottom: $footer-height;
+ left: 0;
+ right: 0;
+ background: $first;
+ z-index: 5;
+
+ @include breakpoint(lg) {
+ display: none;
+ }
+}
+
+.close-wrapper {
+ padding: rem(16px) rem(12px) 0;
+ text-align: right;
+}
+
+.section {
+ padding: rem(8px) rem(32px);
+}
+
+.subheading {
+ color: #a6a6a6;
+ text-transform: uppercase;
+}
+
+.list {
+ margin-top: rem(12px);
+}
+
+.logout-button {
+ width: 100%;
+}
+
+.link {
+ display: block;
+ color: $white;
+ padding: rem(12px) 0;
+
+ &:hover {
+ color: $white;
+ }
+
+ &.active {
+ color: $active;
+ }
+}
+
+.item {
+ border-top: 1px solid $gray;
+}
diff --git a/web/src/components/Common/MobileMenu.tsx b/web/src/components/Common/MobileMenu.tsx
new file mode 100644
index 00000000..a943b686
--- /dev/null
+++ b/web/src/components/Common/MobileMenu.tsx
@@ -0,0 +1,95 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+import { NavLink } from 'react-router-dom';
+
+import { SettingSections, getSettingsPath } from 'web/libs/paths';
+import services from 'web/libs/services';
+import styles from './MobileMenu.scss';
+import CloseIcon from '../Icons/Close';
+
+interface Props {
+ onDismiss: () => void;
+ isOpen: boolean;
+}
+
+const MobileMenu: React.FunctionComponent = ({ onDismiss, isOpen }) => {
+ if (!isOpen) {
+ return null;
+ }
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default MobileMenu;
diff --git a/web/src/components/Common/Modal/Body.tsx b/web/src/components/Common/Modal/Body.tsx
new file mode 100644
index 00000000..ec3d0c5d
--- /dev/null
+++ b/web/src/components/Common/Modal/Body.tsx
@@ -0,0 +1,29 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import styles from './ModalBody.scss';
+
+interface Props {}
+
+const Body: React.FunctionComponent = ({ children }) => {
+ return {children}
;
+};
+
+export default Body;
diff --git a/web/src/components/Common/Modal/Header.tsx b/web/src/components/Common/Modal/Header.tsx
new file mode 100644
index 00000000..443d3874
--- /dev/null
+++ b/web/src/components/Common/Modal/Header.tsx
@@ -0,0 +1,52 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import CloseIcon from '../../Icons/Close';
+import styles from './ModalHeader.scss';
+
+interface Props {
+ labelId: string;
+ heading: string;
+ onDismiss: () => void;
+}
+
+const Header: React.FunctionComponent = ({
+ labelId,
+ heading,
+ onDismiss
+}) => {
+ return (
+
+ {heading}
+
+
+
+
+
+ );
+};
+
+export default Header;
diff --git a/web/src/components/Common/Modal/Modal.scss b/web/src/components/Common/Modal/Modal.scss
new file mode 100644
index 00000000..b007f4b0
--- /dev/null
+++ b/web/src/components/Common/Modal/Modal.scss
@@ -0,0 +1,102 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/rem';
+@import '../../App/font';
+
+.content {
+ overflow: auto;
+ background-color: white;
+ margin-left: rem(16px);
+ margin-right: rem(16px);
+ margin-top: rem(52px);
+ box-shadow: 0 0 18px rgba(0, 0, 0, 0.4);
+ border-radius: 2px;
+
+ @include breakpoint(md) {
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+ &.small {
+ max-width: 100%;
+
+ @include breakpoint(md) {
+ max-width: rem(480px);
+ }
+ }
+ &.regular {
+ max-width: 100%;
+
+ @include breakpoint(md) {
+ max-width: rem(580px);
+ }
+
+ @include breakpoint(lg) {
+ max-width: rem(682px);
+ }
+ }
+}
+
+.overlay {
+ position: fixed;
+ top: 0px;
+ left: 0px;
+ right: 0px;
+ bottom: 0px;
+ background-color: rgba(0, 0, 0, 0.52);
+ z-index: 4;
+
+ max-height: 100%;
+ overflow-y: scroll;
+}
+
+.header {
+ background-color: #f6f8fa;
+ border-bottom: 1px solid #e7e9ec;
+ border-top-right-radius: 3px;
+ border-top-left-radius: 3px;
+
+ display: flex;
+ justify-content: space-between;
+ padding: 9px 4px 9px 16px;
+
+ .header-text {
+ @include font-size('small');
+ font-weight: 600;
+ }
+}
+
+.body {
+ border-bottom-right-radius: 3px;
+ border-bottom-left-radius: 3px;
+}
+
+.actions {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: rem(16px);
+}
+
+.input-row {
+ & ~ .input-row,
+ .input-row {
+ margin-top: rem(12px);
+ }
+}
diff --git a/web/src/components/Common/Modal/ModalBody.scss b/web/src/components/Common/Modal/ModalBody.scss
new file mode 100644
index 00000000..9d7b76a7
--- /dev/null
+++ b/web/src/components/Common/Modal/ModalBody.scss
@@ -0,0 +1,26 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+
+.wrapper {
+ padding: rem(16px) rem(16px) rem(12px);
+}
diff --git a/web/src/components/Common/Modal/ModalHeader.scss b/web/src/components/Common/Modal/ModalHeader.scss
new file mode 100644
index 00000000..2cb0e8c7
--- /dev/null
+++ b/web/src/components/Common/Modal/ModalHeader.scss
@@ -0,0 +1,39 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+
+.wrapper {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ width: 100%;
+ background: $light;
+ height: rem(48px);
+ padding-left: rem(16px);
+ border-top-right-radius: 2px;
+ border-top-left-radius: 2px;
+ border-bottom: 1px solid $border-color;
+}
+
+.button {
+ height: 100%;
+}
diff --git a/web/src/components/Common/Modal/index.tsx b/web/src/components/Common/Modal/index.tsx
new file mode 100644
index 00000000..b3aec622
--- /dev/null
+++ b/web/src/components/Common/Modal/index.tsx
@@ -0,0 +1,151 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect, useCallback, useState } from 'react';
+import ReactDOM from 'react-dom';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+import classnames from 'classnames';
+
+import { KEYCODE_ESC, KEYCODE_TAB } from 'jslib/helpers/keyboard';
+import scopeTab from 'web/libs/scopeTab';
+import { getScrollbarWidth } from 'web/libs/dom';
+import { useEventListener } from 'web/libs/hooks';
+import styles from './Modal.scss';
+
+let scrollbarWidth = 0;
+
+interface Props extends RouteComponentProps {
+ isOpen: boolean;
+ onDismiss: () => void;
+ ariaLabelledBy: string;
+ modalId?: string;
+ ariaDescribedBy?: string;
+ size?: string;
+ overlayClassName?: string;
+ modalClassName?: string;
+}
+
+const Modal: React.FunctionComponent = ({
+ isOpen,
+ onDismiss,
+ overlayClassName,
+ modalClassName,
+ ariaLabelledBy,
+ ariaDescribedBy,
+ size = 'regular',
+ children,
+ modalId
+}) => {
+ const [contentEl, setContentEl] = useState(null);
+
+ const focusContent = useCallback(() => {
+ if (!contentEl) {
+ return;
+ }
+ // check if content has focus
+ if (
+ document.activeElement === contentEl ||
+ contentEl.contains(document.activeElement)
+ ) {
+ return;
+ }
+
+ contentEl.focus();
+ }, [contentEl]);
+
+ const handleMousedown = useCallback(
+ e => {
+ if (contentEl && !contentEl.contains(e.target)) {
+ onDismiss();
+ }
+ },
+ [contentEl, onDismiss]
+ );
+
+ useEventListener(document, 'mousedown', handleMousedown);
+ useEventListener(contentEl, 'keydown', e => {
+ switch (e.keyCode) {
+ case KEYCODE_ESC: {
+ e.stopPropagation();
+
+ onDismiss();
+ break;
+ }
+ case KEYCODE_TAB: {
+ if (!contentEl) {
+ return;
+ }
+
+ scopeTab(contentEl, e);
+ break;
+ }
+ default:
+ // noop
+ }
+ });
+
+ useEffect(() => {
+ const pageEl = document.body;
+
+ if (isOpen) {
+ scrollbarWidth = getScrollbarWidth();
+ pageEl.classList.add('no-scroll');
+ // Set padding-right if scrollbar was hidden
+ pageEl.style.paddingRight = `${scrollbarWidth}px`;
+
+ focusContent();
+ } else {
+ pageEl.classList.remove('no-scroll');
+ pageEl.style.paddingRight = '';
+ }
+ }, [isOpen, focusContent]);
+
+ if (!isOpen) {
+ return null;
+ }
+
+ const modalRoot = document.getElementById('overlay-root');
+
+ return ReactDOM.createPortal(
+
+
{
+ setContentEl(el);
+ }}
+ tabIndex={-1}
+ role="dialog"
+ aria-labelledby={ariaLabelledBy}
+ aria-describedby={ariaDescribedBy}
+ aria-modal="true"
+ >
+ {children}
+
+
,
+ modalRoot
+ );
+};
+
+export default withRouter(Modal);
+
+export { default as Header } from './Header';
+export { default as Body } from './Body';
diff --git a/web/src/components/Common/MultiSelect.scss b/web/src/components/Common/MultiSelect.scss
new file mode 100644
index 00000000..90e196d9
--- /dev/null
+++ b/web/src/components/Common/MultiSelect.scss
@@ -0,0 +1,139 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/rem';
+@import '../App/font';
+@import '../App/variables';
+
+.wrapper {
+ position: relative;
+ border: 1px solid $border-color;
+ position: relative;
+ border-radius: rem(4px);
+ display: flex;
+ cursor: text;
+ user-select: none;
+
+ &.disabled {
+ cursor: not-allowed;
+ background-color: $lighter-gray;
+ }
+
+ .input:disabled {
+ background: inherit;
+ }
+}
+
+.hidden {
+ display: none;
+}
+
+.input-wrapper {
+ display: inline-block;
+}
+
+.input {
+ box-sizing: content-box;
+ background: rgba(0, 0, 0, 0) none repeat scroll 0px center;
+ border: 0px none;
+ font-size: inherit;
+ opacity: 1;
+ outline: currentcolor none 0px;
+ padding: 0px;
+ color: inherit;
+}
+.active-input {
+ margin-left: rem(8px);
+}
+
+.current-options {
+ list-style: none;
+ margin-bottom: 0;
+ padding-left: 0;
+}
+.current-option-item {
+ display: inline-flex;
+ background-color: rgb(230, 230, 230);
+ border-radius: 2px;
+ margin: rem(2px);
+ min-width: 0px;
+ box-sizing: border-box;
+ cursor: default;
+}
+.current-option-label {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: rem(2px) rem(4px) rem(2px) rem(8px);
+ @include font-size('small');
+ border-radius: 4px;
+}
+.dismiss-option {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0 rem(8px);
+}
+
+.suggestion-wrapper {
+ width: 100%;
+ z-index: 1;
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.14);
+ border: 1px solid $border-color;
+ border-radius: rem(4px);
+ display: none;
+
+ &.suggestions-wrapper-shown {
+ display: block;
+ }
+}
+
+.suggestion {
+ background: white;
+ overflow-y: auto;
+ max-height: rem(220px);
+
+ @include landscape() {
+ max-height: rem(140px);
+ }
+}
+
+.suggestion-item {
+}
+
+.suggestion-item-button {
+ padding: rem(8px) rem(12px);
+ width: 100%;
+
+ &.suggestion-item-focused,
+ &:hover {
+ background: $light-blue;
+ }
+}
+
+.placeholder {
+ color: rgb(128, 128, 128);
+ margin-left: 2px;
+ margin-right: 2px;
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ box-sizing: border-box;
+}
diff --git a/web/src/components/Common/MultiSelect.tsx b/web/src/components/Common/MultiSelect.tsx
new file mode 100644
index 00000000..783bd122
--- /dev/null
+++ b/web/src/components/Common/MultiSelect.tsx
@@ -0,0 +1,284 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect, useRef, useState } from 'react';
+import classnames from 'classnames';
+
+import { KEYCODE_BACKSPACE } from 'jslib/helpers/keyboard';
+import { filterOptions, Option } from 'jslib/helpers/select';
+import { useScrollToFocused, useSearchMenuKeydown } from 'web/libs/hooks/dom';
+import PopoverContent from '../Common/Popover/PopoverContent';
+import CloseIcon from '../Icons/Close';
+import styles from './MultiSelect.scss';
+
+function getTextInputWidth(term: string, active: boolean) {
+ if (!active && term === '') {
+ return '100%';
+ }
+
+ const val = 14 + term.length * 8;
+ return `${val}px`;
+}
+
+interface Props {
+ options: Option[];
+ currentOptions: Option[];
+ setCurrentOptions: (Option) => void;
+ placeholder?: string;
+ disabled?: boolean;
+ textInputId?: string;
+ wrapperClassName?: string;
+ inputInnerRef?: React.MutableRefObject;
+}
+
+// TODO: Make a generic Select component that works for both single and multiple selection
+// by passing of a flag
+const MultiSelect: React.FunctionComponent = ({
+ options,
+ currentOptions,
+ setCurrentOptions,
+ textInputId,
+ placeholder,
+ disabled,
+ wrapperClassName,
+ inputInnerRef
+}) => {
+ const [isOpen, setIsOpen] = useState(false);
+ const [focusedIdx, setFocusedIdx] = useState(0);
+ const [focusedOptEl, setFocusedOptEl] = useState(null);
+ const [term, setTerm] = useState('');
+
+ const wrapperRef = useRef(null);
+ const inputRef = useRef(null);
+ const listRef = useRef(null);
+
+ const currentValues = currentOptions.map(o => {
+ return o.value;
+ });
+ const possibleOptions = options.filter(o => {
+ return currentValues.indexOf(o.value) === -1;
+ });
+
+ const filteredOptions = filterOptions(possibleOptions, term, false);
+
+ function appendOption(o: Option | undefined) {
+ if (!o) {
+ return;
+ }
+
+ setTerm('');
+ const newVal = [...currentOptions, o];
+ setCurrentOptions(newVal);
+ }
+ function removeOption(o: Option) {
+ setTerm('');
+ const newVal = currentOptions.filter(opt => {
+ return opt.value !== o.value;
+ });
+ setCurrentOptions(newVal);
+ }
+ function popOption() {
+ if (currentOptions.length === 0) {
+ return;
+ }
+
+ const newVal = currentOptions.slice(0, -1);
+ setCurrentOptions(newVal);
+ }
+
+ useSearchMenuKeydown({
+ options: filteredOptions,
+ containerEl: wrapperRef.current,
+ focusedIdx,
+ setFocusedIdx,
+ onKeydownSelect: appendOption,
+ disabled: !isOpen || disabled
+ });
+ useScrollToFocused({
+ shouldScroll: true,
+ focusedOptEl,
+ containerEl: listRef.current
+ });
+
+ useEffect(() => {
+ if (!isOpen) {
+ inputRef.current.blur();
+ setTerm('');
+ }
+ }, [isOpen]);
+
+ // useEffect(() => {
+ // if (term !== '' && !isOpen) {
+ // setIsOpen(true);
+ // }
+ // }, [term, isOpen]);
+
+ const active = currentOptions.length > 0;
+ const textInputWidth = getTextInputWidth(term, active);
+
+ return (
+ {
+ if (inputRef.current) {
+ inputRef.current.focus();
+ }
+
+ // setIsOpen(!isOpen);
+ }}
+ onKeyDown={() => {}}
+ >
+
+
+
{
+ setIsOpen(false);
+ }}
+ alignment="left"
+ direction="bottom"
+ triggerEl={inputRef.current}
+ wrapperEl={wrapperRef.current}
+ contentClassName={classnames(styles['suggestion-wrapper'], {
+ [styles['suggestions-wrapper-shown']]: isOpen
+ })}
+ closeOnOutsideClick
+ closeOnEscapeKeydown
+ >
+
+ {filteredOptions.map((o, idx) => {
+ const isFocused = idx === focusedIdx;
+
+ return (
+ {
+ if (isFocused) {
+ setFocusedOptEl(el);
+ }
+ }}
+ >
+ {
+ appendOption(o);
+ }}
+ >
+ {o.label}
+
+
+ );
+ })}
+
+
+
+ );
+};
+
+export default MultiSelect;
diff --git a/web/src/components/Common/NotFound.tsx b/web/src/components/Common/NotFound.tsx
new file mode 100644
index 00000000..4e614955
--- /dev/null
+++ b/web/src/components/Common/NotFound.tsx
@@ -0,0 +1,27 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const NotFound: React.FunctionComponent = () => (
+
+
Not found
+
+);
+
+export default NotFound;
diff --git a/web/src/components/Common/Note/Content.tsx b/web/src/components/Common/Note/Content.tsx
new file mode 100644
index 00000000..1e175424
--- /dev/null
+++ b/web/src/components/Common/Note/Content.tsx
@@ -0,0 +1,89 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+/* eslint-disable react/no-danger */
+
+import React from 'react';
+
+import { NoteData } from 'jslib/operations/types';
+import { excerpt } from 'web/libs/string';
+import { tokenize, TokenKind } from 'web/libs/fts/lexer';
+import { parseMarkdown } from '../../../helpers/markdown';
+import styles from './Note.scss';
+
+function formatFTSSelection(content: string): string {
+ if (content.indexOf('') === -1) {
+ return content;
+ }
+
+ const tokens = tokenize(content);
+
+ let output = '';
+ let buf = [];
+
+ for (let i = 0; i < tokens.length; i++) {
+ const t = tokens[i];
+
+ if (t.kind === TokenKind.hlBegin || t.kind === TokenKind.eol) {
+ output += buf.join('');
+
+ buf = [];
+ } else if (t.kind === TokenKind.hlEnd) {
+ output += `
+ ${buf.join('')}
+ `;
+
+ buf = [];
+ } else {
+ buf.push(t.value);
+ }
+ }
+
+ return output;
+}
+
+function formatContent(content: string): string {
+ const formatted = formatFTSSelection(content);
+ return parseMarkdown(formatted);
+}
+
+interface Props {
+ collapsed?: boolean;
+ note: NoteData;
+}
+
+const Content: React.SFC = ({ note, collapsed }) => {
+ return (
+
+ {collapsed ? (
+
+ {excerpt(note.content, 100)}
+
+ ) : (
+
+ )}
+
+ );
+};
+
+export default Content;
diff --git a/web/src/components/Common/Note/Footer.tsx b/web/src/components/Common/Note/Footer.tsx
new file mode 100644
index 00000000..e9cc9bc8
--- /dev/null
+++ b/web/src/components/Common/Note/Footer.tsx
@@ -0,0 +1,76 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { NoteData } from 'jslib/operations/types';
+import Time from '../../Common/Time';
+import formatTime from '../../../helpers/time/format';
+import { timeAgo } from '../../../helpers/time';
+import styles from './Note.scss';
+
+function formatAddedOn(ms: number): string {
+ const d = new Date(ms);
+
+ return formatTime(d, '%MMMM %DD, %YYYY');
+}
+
+interface Props {
+ note: NoteData;
+ useTimeAgo: boolean;
+ collapsed?: boolean;
+ actions?: React.ReactElement;
+}
+
+const Footer: React.FunctionComponent = ({
+ collapsed,
+ actions,
+ note,
+ useTimeAgo
+}) => {
+ if (collapsed) {
+ return null;
+ }
+
+ const updatedAt = new Date(note.updatedAt).getTime();
+
+ let timeText;
+ if (useTimeAgo) {
+ timeText = timeAgo(updatedAt);
+ } else {
+ timeText = formatAddedOn(updatedAt);
+ }
+
+ return (
+
+
+ Last edit:
+
+
+ {actions}
+
+ );
+};
+
+export default Footer;
diff --git a/web/src/components/Common/Note/Note.scss b/web/src/components/Common/Note/Note.scss
new file mode 100644
index 00000000..a1ec7ee1
--- /dev/null
+++ b/web/src/components/Common/Note/Note.scss
@@ -0,0 +1,104 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+
+.frame {
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
+ background: white;
+
+ &.collapsed {
+ .book-label {
+ // control the coloro of ellipsis when overflown
+ color: $light-gray;
+ }
+
+ .book-label a {
+ color: $light-gray;
+ }
+ }
+}
+
+.header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: rem(12px) rem(16px);
+ border-bottom: 1px solid $border-color;
+}
+.header-left,
+.header-right {
+ display: flex;
+ align-items: center;
+}
+
+.book-icon {
+ vertical-align: middle;
+}
+
+.content-wrapper {
+ padding: rem(12px) rem(16px);
+}
+
+.collapsed-content {
+ color: $light-gray;
+}
+
+.footer {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ @include font-size('small');
+ padding: rem(12px) rem(16px);
+}
+
+.ts {
+ color: $light-gray;
+}
+.ts-lead {
+ display: none;
+ @include breakpoint(md) {
+ display: inline;
+ }
+}
+
+.match {
+ display: inline-block;
+ background: #f7f77d;
+}
+
+.book-label {
+ @include font-size('medium');
+ font-weight: 600;
+ display: inline-block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: $black;
+
+ a {
+ color: inherit;
+
+ &:hover {
+ color: inherit;
+ }
+ }
+}
diff --git a/web/src/components/Common/Note/Placeholder.scss b/web/src/components/Common/Note/Placeholder.scss
new file mode 100644
index 00000000..01c171da
--- /dev/null
+++ b/web/src/components/Common/Note/Placeholder.scss
@@ -0,0 +1,71 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+
+.title {
+ width: rem(200px);
+ height: rem(16px);
+}
+
+.line {
+ height: rem(16px);
+
+ &:not(:first-child) {
+ margin-top: rem(16px);
+ }
+}
+
+.line1 {
+ width: rem(100px);
+
+ @include breakpoint(md) {
+ width: rem(400px);
+ }
+}
+.line2 {
+ width: rem(200px);
+
+ @include breakpoint(md) {
+ width: rem(180px);
+ }
+}
+.line3 {
+ width: rem(80px);
+
+ @include breakpoint(md) {
+ width: rem(220px);
+ }
+}
+.line4 {
+ width: 100%;
+
+ @include breakpoint(md) {
+ width: rem(420px);
+ }
+}
+.line5 {
+ width: rem(120px);
+
+ @include breakpoint(md) {
+ width: rem(280px);
+ }
+}
diff --git a/web/src/components/Common/Note/Placeholder.tsx b/web/src/components/Common/Note/Placeholder.tsx
new file mode 100644
index 00000000..e092cfbe
--- /dev/null
+++ b/web/src/components/Common/Note/Placeholder.tsx
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import styles from './Placeholder.scss';
+import noteStyles from './Note.scss';
+
+interface Props {
+ wrapperClassName?: string;
+}
+
+const Placeholder: React.FunctionComponent = ({ wrapperClassName }) => {
+ return (
+
+ );
+};
+
+export default Placeholder;
diff --git a/web/src/components/Common/Note/index.tsx b/web/src/components/Common/Note/index.tsx
new file mode 100644
index 00000000..9c818e67
--- /dev/null
+++ b/web/src/components/Common/Note/index.tsx
@@ -0,0 +1,63 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import { NoteData } from 'jslib/operations/types';
+import Content from './Content';
+import Footer from './Footer';
+import styles from './Note.scss';
+
+interface Props {
+ note: NoteData;
+ header: React.ReactElement;
+ footerActions?: React.ReactElement;
+ headerRight?: React.ReactElement;
+ collapsed?: boolean;
+ footerUseTimeAgo?: boolean;
+}
+
+const Note: React.FunctionComponent = ({
+ note,
+ footerActions,
+ collapsed,
+ header,
+ footerUseTimeAgo = false
+}) => {
+ return (
+
+ {header}
+
+
+
+
+
+ );
+};
+
+export default React.memo(Note);
diff --git a/web/src/components/Common/PageToolbar/Paginator/PageLink.tsx b/web/src/components/Common/PageToolbar/Paginator/PageLink.tsx
new file mode 100644
index 00000000..63b612a9
--- /dev/null
+++ b/web/src/components/Common/PageToolbar/Paginator/PageLink.tsx
@@ -0,0 +1,89 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+import { Location } from 'history';
+import { Link } from 'react-router-dom';
+
+import CaretIcon from '../../../Icons/Caret';
+import { useFilters } from '../../../../store';
+import styles from './Paginator.scss';
+
+type Direction = 'next' | 'prev';
+
+interface Props {
+ direction: Direction;
+ disabled: boolean;
+ getPath: (page: number) => Location;
+ className?: string;
+}
+
+const renderCaret = (direction: Direction, fill: string) => {
+ return (
+
+ );
+};
+
+const PageLink: React.FunctionComponent = ({
+ direction,
+ getPath,
+ disabled,
+ className
+}) => {
+ const filters = useFilters();
+
+ if (disabled) {
+ return (
+
+ {renderCaret(direction, 'gray')}
+
+ );
+ }
+
+ let page;
+ if (direction === 'next') {
+ page = filters.page + 1;
+ } else {
+ page = filters.page - 1;
+ }
+
+ let label;
+ if (direction === 'next') {
+ label = 'Next page';
+ } else {
+ label = 'Previous page';
+ }
+
+ return (
+
+ {renderCaret(direction, 'black')}
+
+ );
+};
+
+export default PageLink;
diff --git a/web/src/components/Common/PageToolbar/Paginator/Paginator.scss b/web/src/components/Common/PageToolbar/Paginator/Paginator.scss
new file mode 100644
index 00000000..a1806643
--- /dev/null
+++ b/web/src/components/Common/PageToolbar/Paginator/Paginator.scss
@@ -0,0 +1,60 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../../App/responsive';
+@import '../../../App/font';
+@import '../../../App/theme';
+@import '../../../App/rem';
+
+.wrapper {
+ display: inline-flex;
+ align-items: center;
+}
+
+.info {
+ @include font-size('small');
+ color: $gray;
+}
+
+.link {
+ padding: rem(12px) rem(12px);
+
+ &.disabled {
+ cursor: not-allowed;
+ }
+}
+
+.link-prev {
+ margin-left: rem(8px);
+
+ @include breakpoint(md) {
+ margin-left: rem(20px);
+ }
+}
+
+.caret-next {
+ transform: rotate(-90deg);
+}
+
+.caret-prev {
+ transform: rotate(90deg);
+}
+
+.label {
+ font-weight: 600;
+}
diff --git a/web/src/components/Common/PageToolbar/Paginator/index.tsx b/web/src/components/Common/PageToolbar/Paginator/index.tsx
new file mode 100644
index 00000000..b0531d77
--- /dev/null
+++ b/web/src/components/Common/PageToolbar/Paginator/index.tsx
@@ -0,0 +1,68 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { Location } from 'history';
+
+import PageLink from './PageLink';
+import styles from './Paginator.scss';
+
+interface Props {
+ perPage: number;
+ total: number;
+ currentPage: number;
+ getPath: (page: number) => Location;
+}
+
+function getMaxPage(total: number, perPage: number): number {
+ if (total === 0) {
+ return 1;
+ }
+
+ return Math.ceil(total / perPage);
+}
+
+const Paginator: React.FunctionComponent = ({
+ perPage,
+ total,
+ currentPage,
+ getPath
+}) => {
+ const hasNext = currentPage * perPage < total;
+ const hasPrev = currentPage > 1;
+ const maxPage = getMaxPage(total, perPage);
+
+ return (
+
+
+ {currentPage} of{' '}
+ {maxPage}
+
+
+
+
+
+ );
+};
+
+export default Paginator;
diff --git a/web/src/components/Common/PageToolbar/SelectMenu.scss b/web/src/components/Common/PageToolbar/SelectMenu.scss
new file mode 100644
index 00000000..68815bf8
--- /dev/null
+++ b/web/src/components/Common/PageToolbar/SelectMenu.scss
@@ -0,0 +1,79 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/rem';
+
+.trigger {
+ color: $dark-gray;
+
+ &:hover,
+ &.trigger-active {
+ color: $black;
+ }
+}
+
+.trigger-content {
+ display: flex;
+ align-items: center;
+ @include font-size('small');
+}
+
+.caret {
+ margin-left: rem(8px);
+}
+
+.link {
+ @include font-size('small');
+ white-space: pre;
+ padding: rem(8px) rem(14px);
+ width: 100%;
+ display: block;
+ color: black;
+
+ &:hover {
+ background: $lighter-gray;
+ text-decoration: none;
+ color: #0056b3;
+ }
+
+ &:not(.disabled):focus {
+ background: $lighter-gray;
+ color: #0056b3;
+ outline: 1px dotted gray;
+ }
+}
+
+.header {
+ font-weight: 600;
+ background: $light;
+
+ @include font-size('small');
+ padding: rem(8px) rem(12px);
+ border-bottom: 1px solid $border-color;
+}
+
+.content {
+ width: rem(240px);
+
+ @include breakpoint(md) {
+ width: rem(280px);
+ }
+}
diff --git a/web/src/components/Common/PageToolbar/SelectMenu.tsx b/web/src/components/Common/PageToolbar/SelectMenu.tsx
new file mode 100644
index 00000000..d2b03588
--- /dev/null
+++ b/web/src/components/Common/PageToolbar/SelectMenu.tsx
@@ -0,0 +1,92 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import Menu, { MenuOption } from '../../Common/Menu';
+import { Alignment, Direction } from '../../Common/Menu/types';
+import styles from './SelectMenu.scss';
+
+interface Props {
+ defaultCurrentOptionIdx: number;
+ options: MenuOption[];
+ optRefs: any[];
+ triggerText: string;
+ isOpen: boolean;
+ setIsOpen: (boolean) => void;
+ triggerId: string;
+ headerText: string;
+ menuId: string;
+ alignment: Alignment;
+ alignmentMd?: Alignment;
+ direction: Direction;
+ disabled?: boolean;
+ wrapperClassName?: string;
+ triggerClassName?: string;
+}
+
+const SelectMenu: React.FunctionComponent = ({
+ defaultCurrentOptionIdx,
+ options,
+ optRefs,
+ triggerText,
+ disabled,
+ isOpen,
+ setIsOpen,
+ headerText,
+ triggerId,
+ menuId,
+ alignment,
+ alignmentMd,
+ direction,
+ wrapperClassName,
+ triggerClassName
+}) => {
+ return (
+
+ {triggerText}
+
+
+ }
+ headerContent={{headerText}
}
+ triggerClassName={classnames(styles.trigger, triggerClassName, {
+ [styles['trigger-active']]: isOpen
+ })}
+ contentClassName={styles.content}
+ wrapperClassName={wrapperClassName}
+ alignment={alignment}
+ alignmentMd={alignmentMd}
+ direction={direction}
+ />
+ );
+};
+
+export default SelectMenu;
diff --git a/web/src/components/Common/PageToolbar/index.scss b/web/src/components/Common/PageToolbar/index.scss
new file mode 100644
index 00000000..2f403d6d
--- /dev/null
+++ b/web/src/components/Common/PageToolbar/index.scss
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/rem';
+
+.wrapper {
+ @include breakpoint(lg) {
+ height: rem(48px);
+ border-radius: rem(4px);
+ background: $light;
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.14);
+
+ &.bottom {
+ margin-top: rem(12px);
+ }
+ }
+}
diff --git a/web/src/components/Common/PageToolbar/index.tsx b/web/src/components/Common/PageToolbar/index.tsx
new file mode 100644
index 00000000..203689cb
--- /dev/null
+++ b/web/src/components/Common/PageToolbar/index.tsx
@@ -0,0 +1,47 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import styles from './index.scss';
+
+type Position = 'top' | 'bottom';
+
+interface Props {
+ position?: Position;
+ wrapperClassName?: string;
+}
+
+const PageToolbar: React.FunctionComponent = ({
+ position,
+ wrapperClassName,
+ children
+}) => {
+ return (
+
+ {children}
+
+ );
+};
+
+export default PageToolbar;
diff --git a/web/src/components/Common/PayWall.scss b/web/src/components/Common/PayWall.scss
new file mode 100644
index 00000000..5ca44378
--- /dev/null
+++ b/web/src/components/Common/PayWall.scss
@@ -0,0 +1,43 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/rem';
+@import '../App/font';
+
+.wrapper {
+ text-align: center;
+ flex-grow: 1;
+ padding: rem(40px) 0;
+
+ // landscape mode on mobile
+ @media (min-height: 600px) {
+ padding: rem(120px) 0;
+ }
+}
+
+.lead {
+ @include font-size('x-large');
+ font-weight: 400;
+ margin-top: rem(16px);
+ text-align: center;
+}
+
+.actions {
+ margin-top: rem(16px);
+}
diff --git a/web/src/components/Common/PayWall.tsx b/web/src/components/Common/PayWall.tsx
new file mode 100644
index 00000000..c34b04d3
--- /dev/null
+++ b/web/src/components/Common/PayWall.tsx
@@ -0,0 +1,60 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { Fragment } from 'react';
+import classnames from 'classnames';
+
+import LockIcon from '../Icons/Lock';
+import { useSelector } from '../../store';
+
+import styles from './PayWall.scss';
+
+interface Props {
+ wrapperClassName?: string;
+}
+
+const PayWall: React.FunctionComponent = ({
+ wrapperClassName,
+ children
+}) => {
+ const { user } = useSelector(state => {
+ return {
+ user: state.auth.user
+ };
+ });
+
+ if (user.data.pro) {
+ return {children} ;
+ }
+
+ return (
+
+
+
+
Please unlock Dnote Cloud to use.
+
+
+
+ );
+};
+
+export default PayWall;
diff --git a/web/src/components/Common/Popover/Popover.scss b/web/src/components/Common/Popover/Popover.scss
new file mode 100644
index 00000000..5c81c3b7
--- /dev/null
+++ b/web/src/components/Common/Popover/Popover.scss
@@ -0,0 +1,58 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/responsive';
+@import '../../App/rem';
+
+.wrapper {
+ @include breakpoint(md) {
+ // position: relative;
+ }
+}
+
+.trigger {
+ position: relative;
+ font-weight: 600;
+}
+
+.is-open.has-arrow {
+ &:before {
+ border: 6px solid transparent;
+ border-bottom-color: $black;
+ position: absolute;
+ display: inline-block;
+ content: '';
+ left: 50%;
+ margin-left: -8px;
+ }
+
+ &.top {
+ &:before {
+ bottom: 90%;
+ transform: rotate(180deg);
+ }
+ }
+
+ &.bottom {
+ &:before {
+ top: 90%;
+ }
+ }
+}
diff --git a/web/src/components/Common/Popover/PopoverContent.scss b/web/src/components/Common/Popover/PopoverContent.scss
new file mode 100644
index 00000000..d95672e2
--- /dev/null
+++ b/web/src/components/Common/Popover/PopoverContent.scss
@@ -0,0 +1,112 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/responsive';
+@import '../../App/rem';
+
+.content {
+ position: absolute;
+
+ &.border {
+ background: #fff;
+ border: 1px solid $border-color;
+ border-radius: 4px;
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
+ }
+
+ @include breakpoint(md) {
+ left: auto;
+ right: auto;
+ }
+}
+
+/* alignment */
+.left-align {
+ left: 0;
+ right: auto;
+ top: auto;
+ bottom: auto;
+}
+.right-align {
+ right: 0;
+ left: auto;
+ top: auto;
+ bottom: auto;
+}
+.top-align {
+ top: 0;
+ left: auto;
+ right: auto;
+ bottom: auto;
+}
+.bottom-align {
+ bottom: 0;
+ left: auto;
+ right: auto;
+ top: auto;
+}
+// md
+.left-align-md {
+ @include breakpoint(md) {
+ left: 0;
+ right: auto;
+ top: auto;
+ bottom: auto;
+ }
+}
+.right-align-md {
+ @include breakpoint(md) {
+ right: 0;
+ left: auto;
+ top: auto;
+ bottom: auto;
+ }
+}
+.top-align-md {
+ @include breakpoint(md) {
+ top: 0;
+ left: auto;
+ right: auto;
+ bottom: auto;
+ }
+}
+.bottom-align-md {
+ @include breakpoint(md) {
+ bottom: 0;
+ left: auto;
+ right: auto;
+ top: auto;
+ }
+}
+
+/* direction */
+.top-direction {
+ bottom: calc(100% + 4px);
+}
+.bottom-direction {
+ top: calc(100% + 4px);
+}
+.left-direction {
+ right: calc(100% + 4px);
+}
+
+.right-direction {
+ left: calc(100% + 4px);
+}
diff --git a/web/src/components/Common/Popover/PopoverContent.tsx b/web/src/components/Common/Popover/PopoverContent.tsx
new file mode 100644
index 00000000..841f70a7
--- /dev/null
+++ b/web/src/components/Common/Popover/PopoverContent.tsx
@@ -0,0 +1,161 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect, useRef } from 'react';
+import classnames from 'classnames';
+
+import { KEYCODE_ESC } from 'jslib/helpers/keyboard';
+import styles from './PopoverContent.scss';
+import { Alignment, Direction } from './types';
+
+interface Props {
+ contentId: string;
+ onDismiss: () => void;
+ children: React.ReactNode;
+ direction: Direction;
+ closeOnOutsideClick?: boolean;
+ closeOnEscapeKeydown?: boolean;
+ contentClassName?: string;
+ alignment?: Alignment;
+ alignmentMd?: Alignment;
+ triggerEl?: HTMLElement;
+ wrapperEl?: any;
+ hasBorder?: boolean;
+}
+
+const PopoverContent: React.FunctionComponent = ({
+ contentId,
+ contentClassName,
+ onDismiss,
+ triggerEl,
+ wrapperEl,
+ children,
+ alignment,
+ alignmentMd,
+ direction,
+ hasBorder,
+ closeOnOutsideClick,
+ closeOnEscapeKeydown
+}) => {
+ const contentRef = useRef(null);
+
+ useEffect(() => {
+ function handleOutsideClick(e) {
+ const contentEl = contentRef.current;
+
+ if (!contentEl) {
+ return;
+ }
+
+ if (triggerEl && triggerEl.contains(e.target)) {
+ return;
+ }
+
+ if (!contentEl.contains(e.target)) {
+ onDismiss();
+ }
+ }
+
+ // addLinkListeners adds event listeners to all links to handle outside click
+ // because click events on react-router's Link elements do not bubble up to document
+ function addLinkListeners() {
+ const links = document.links;
+ for (let i = 0, linksLength = links.length; i < linksLength; i++) {
+ const link = links[i];
+
+ link.addEventListener('click', handleOutsideClick);
+ }
+ }
+
+ // removeLinkListeners cleans up any event listeners for handling outside click attached to links
+ function removeLinkListeners() {
+ const links = document.links;
+ for (let i = 0, linksLength = links.length; i < linksLength; i++) {
+ const link = links[i];
+
+ link.removeEventListener('click', handleOutsideClick);
+ }
+ }
+
+ if (closeOnOutsideClick) {
+ document.addEventListener('click', handleOutsideClick);
+ document.addEventListener('touchstart', handleOutsideClick);
+ addLinkListeners();
+ }
+
+ return () => {
+ document.removeEventListener('click', handleOutsideClick);
+ document.removeEventListener('touchstart', handleOutsideClick);
+ removeLinkListeners();
+ };
+ }, [closeOnOutsideClick, onDismiss, triggerEl, wrapperEl]);
+
+ useEffect(() => {
+ function handleKeydown(e: KeyboardEvent) {
+ if (e.keyCode === KEYCODE_ESC) {
+ e.stopPropagation();
+ onDismiss();
+ }
+ }
+
+ let targetEl;
+ if (wrapperEl) {
+ targetEl = wrapperEl;
+ } else {
+ targetEl = document;
+ }
+
+ if (closeOnEscapeKeydown) {
+ targetEl.addEventListener('keyup', handleKeydown);
+ }
+
+ return () => {
+ targetEl.removeEventListener('keyup', handleKeydown);
+ };
+ }, [closeOnEscapeKeydown, onDismiss, wrapperEl]);
+
+ return (
+
+ {children}
+
+ );
+};
+
+export default PopoverContent;
diff --git a/web/src/components/Common/Popover/index.tsx b/web/src/components/Common/Popover/index.tsx
new file mode 100644
index 00000000..7c3dbb56
--- /dev/null
+++ b/web/src/components/Common/Popover/index.tsx
@@ -0,0 +1,109 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useRef } from 'react';
+import classnames from 'classnames';
+
+import PopoverContent from './PopoverContent';
+import styles from './Popover.scss';
+import { Alignment, Direction } from './types';
+
+interface Props {
+ isOpen: boolean;
+ setIsOpen: (boolean) => void;
+ renderTrigger: (any) => React.ReactNode;
+ renderContent: () => any;
+ alignment: Alignment;
+ alignmentMd?: Alignment;
+ direction: Direction;
+ contentHasBorder?: boolean;
+ hasArrow?: boolean;
+ contentClassName?: string;
+ wrapperClassName?: string;
+ contentId?: string;
+ closeOnEscapeKeydown?: boolean;
+ closeOnOutsideClick?: boolean;
+}
+
+const Popover: React.FunctionComponent = ({
+ contentClassName,
+ wrapperClassName,
+ renderContent,
+ isOpen,
+ setIsOpen,
+ alignment,
+ alignmentMd,
+ direction,
+ renderTrigger,
+ contentId,
+ closeOnOutsideClick,
+ closeOnEscapeKeydown,
+ contentHasBorder,
+ hasArrow
+}) => {
+ const triggerRef = useRef(null);
+ const wrapperRef = useRef(null);
+
+ return (
+
+ {renderTrigger({
+ triggerClassName: classnames({
+ [styles['is-open']]: isOpen,
+ [styles['has-arrow']]: hasArrow,
+ [styles.bottom]: direction === 'bottom',
+ [styles.top]: direction === 'top',
+ [styles.left]: direction === 'left',
+ [styles.right]: direction === 'right'
+ }),
+ triggerRef
+ })}
+
+ {isOpen && (
+
{
+ setIsOpen(false);
+ }}
+ contentClassName={contentClassName}
+ wrapperEl={wrapperRef.current}
+ triggerEl={triggerRef.current}
+ alignment={alignment}
+ alignmentMd={alignmentMd}
+ direction={direction}
+ contentId={contentId}
+ hasBorder={contentHasBorder}
+ closeOnOutsideClick={closeOnOutsideClick}
+ closeOnEscapeKeydown={closeOnEscapeKeydown}
+ >
+ {renderContent()}
+
+ )}
+
+ );
+};
+
+Popover.defaultProps = {
+ closeOnOutsideClick: true,
+ closeOnEscapeKeydown: true,
+ contentHasBorder: true,
+ hasArrow: false
+};
+
+export default Popover;
diff --git a/web/src/components/Common/Popover/types.ts b/web/src/components/Common/Popover/types.ts
new file mode 100644
index 00000000..229ada76
--- /dev/null
+++ b/web/src/components/Common/Popover/types.ts
@@ -0,0 +1,20 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export type Alignment = 'left' | 'right' | 'top' | 'bottom' | 'center';
+export type Direction = 'left' | 'right' | 'top' | 'bottom';
diff --git a/web/src/components/Common/SearchInput/Actions.tsx b/web/src/components/Common/SearchInput/Actions.tsx
new file mode 100644
index 00000000..ffe9babc
--- /dev/null
+++ b/web/src/components/Common/SearchInput/Actions.tsx
@@ -0,0 +1,72 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import CloseIcon from '../../Icons/Close';
+import CaretIcon from '../../Icons/CaretSolid';
+import styles from './SearchInput.scss';
+
+interface Props {
+ onReset?: (Event) => void;
+ resetShown?: boolean;
+ expanded?: boolean;
+ setExpanded?: (boolean) => void;
+}
+
+const Actions: React.FunctionComponent = ({
+ onReset,
+ resetShown,
+ setExpanded,
+ expanded
+}) => {
+ const resettable = Boolean(onReset);
+ const expandable = Boolean(setExpanded);
+
+ return (
+
+ {resettable && (
+
+
+
+ )}
+ {expandable && (
+ {
+ setExpanded(!expanded);
+ }}
+ >
+
+
+ )}
+
+ );
+};
+
+export default Actions;
diff --git a/web/src/components/Common/SearchInput/SearchInput.scss b/web/src/components/Common/SearchInput/SearchInput.scss
new file mode 100644
index 00000000..a9ab2be3
--- /dev/null
+++ b/web/src/components/Common/SearchInput/SearchInput.scss
@@ -0,0 +1,84 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/rem';
+@import '../../App/responsive';
+@import '../../App/theme';
+
+.wrapper {
+ position: relative;
+}
+
+.search-icon {
+ position: absolute;
+ right: 16px;
+ top: 50%;
+ transform: translateY(-50%);
+ z-index: 1;
+
+ path {
+ fill: $gray;
+ }
+}
+
+input.input {
+ &.resettable:not(.expandable) {
+ padding-right: rem(40px);
+ }
+ &.expandable:not(.resettable) {
+ padding-right: rem(40px);
+ }
+ &.expandable.resettable {
+ padding-right: rem(80px);
+ }
+}
+
+.focused {
+ .input {
+ padding-left: rem(12px);
+ }
+
+ .search-icon {
+ position: absolute;
+ left: -25px;
+ }
+}
+
+.actions {
+ position: absolute;
+ right: 0;
+ top: 0;
+ bottom: 0;
+ display: flex;
+}
+
+.expand {
+ padding: 0 rem(12px);
+}
+
+.reset {
+ display: none;
+
+ &:hover {
+ color: $black;
+ }
+
+ &.reset-shown {
+ display: block;
+ }
+}
diff --git a/web/src/components/Common/SearchInput/index.tsx b/web/src/components/Common/SearchInput/index.tsx
new file mode 100644
index 00000000..7c5bbb85
--- /dev/null
+++ b/web/src/components/Common/SearchInput/index.tsx
@@ -0,0 +1,107 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import Actions from './Actions';
+import styles from './SearchInput.scss';
+
+interface Props {
+ value: string;
+ onChange: (Event) => void;
+ placeholder: string;
+ inputClassName?: string;
+ wrapperClassName?: string;
+ autoFocus?: boolean;
+ disabled?: boolean;
+ inputRef?: React.MutableRefObject;
+ onFocus?: (Event) => void;
+ onBlur?: (Event) => void;
+ onReset?: (Event) => void;
+ expanded?: boolean;
+ setExpanded?: (boolean) => void;
+ inputId?: string;
+}
+
+const SearchInput: React.FunctionComponent = ({
+ value,
+ onChange,
+ inputClassName,
+ wrapperClassName,
+ placeholder,
+ onFocus,
+ onBlur,
+ autoFocus,
+ disabled,
+ inputRef,
+ onReset,
+ expanded,
+ setExpanded,
+ inputId
+}: Props) => {
+ const resettable = Boolean(onReset);
+ const expandable = Boolean(setExpanded);
+
+ return (
+
+
+ {placeholder}
+
+
+
{
+ if (onFocus) {
+ onFocus(e);
+ }
+ }}
+ onBlur={e => {
+ if (onBlur) {
+ onBlur(e);
+ }
+ }}
+ autoFocus={autoFocus}
+ />
+
+
+
+ );
+};
+
+export default SearchInput;
diff --git a/web/src/components/Common/SearchableMenu/Item.tsx b/web/src/components/Common/SearchableMenu/Item.tsx
new file mode 100644
index 00000000..7c436364
--- /dev/null
+++ b/web/src/components/Common/SearchableMenu/Item.tsx
@@ -0,0 +1,76 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+interface Props {
+ id: string;
+ value: string;
+ itemClassName: string;
+ children: React.ReactNode;
+ disabled: boolean;
+ setIsOpen: (boolean) => void;
+ selectedOptRef: React.MutableRefObject;
+ setFocusedOptEl: (HTMLElement) => void;
+ isFocused: boolean;
+ isSelected?: boolean;
+}
+
+const Item: React.FunctionComponent = ({
+ children,
+ id,
+ value,
+ disabled,
+ itemClassName,
+ setIsOpen,
+ selectedOptRef,
+ setFocusedOptEl,
+ isSelected,
+ isFocused
+}) => {
+ return (
+ {
+ if (disabled) {
+ return;
+ }
+
+ setIsOpen(false);
+ }}
+ ref={el => {
+ if (isSelected) {
+ // eslint-disable-next-line no-param-reassign
+ selectedOptRef.current = el;
+ }
+
+ if (isFocused) {
+ setFocusedOptEl(el);
+ }
+ }}
+ >
+ {children}
+
+ );
+};
+
+export default Item;
diff --git a/web/src/components/Common/SearchableMenu/Result.tsx b/web/src/components/Common/SearchableMenu/Result.tsx
new file mode 100644
index 00000000..05a21fdb
--- /dev/null
+++ b/web/src/components/Common/SearchableMenu/Result.tsx
@@ -0,0 +1,84 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { Fragment } from 'react';
+
+import { Option } from 'jslib/helpers/select';
+import { makeOptionId } from '../../../helpers/accessibility';
+import Item from './Item';
+
+interface Props {
+ options: Option[];
+ menuId: string;
+ currentValue: string;
+ focusedIdx: number;
+ disabled: boolean;
+ itemClassName: string;
+ setIsOpen: (boolean) => void;
+ selectedOptRef: React.MutableRefObject;
+ setFocusedOptEl: (HTMLElement) => void;
+ renderOption: (Option, OptionParams) => React.ReactNode;
+ renderCreateOption: (Option, OptionParams) => React.ReactNode;
+}
+
+const Result: React.FunctionComponent = ({
+ options,
+ menuId,
+ currentValue,
+ focusedIdx,
+ disabled,
+ itemClassName,
+ setIsOpen,
+ selectedOptRef,
+ renderOption,
+ renderCreateOption,
+ setFocusedOptEl
+}) => {
+ return (
+
+ {options.map((option, idx) => {
+ const id = makeOptionId(menuId, option.value);
+
+ const isSelected = option.value === currentValue;
+ const isFocused = idx === focusedIdx;
+
+ return (
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
+ -
+ {option.value === ''
+ ? renderCreateOption(option, { isFocused })
+ : renderOption(option, { isSelected, isFocused })}
+
+ );
+ })}
+
+ );
+};
+
+export default Result;
diff --git a/web/src/components/Common/SearchableMenu/SearchableMenu.scss b/web/src/components/Common/SearchableMenu/SearchableMenu.scss
new file mode 100644
index 00000000..b16df6db
--- /dev/null
+++ b/web/src/components/Common/SearchableMenu/SearchableMenu.scss
@@ -0,0 +1,43 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/theme';
+@import '../../App/rem';
+
+.content {
+ z-index: 1;
+ right: 0;
+ left: 0;
+}
+
+.item {
+ cursor: pointer;
+}
+
+.dropdown {
+ overflow-y: auto;
+ outline: 0;
+}
+
+.search-container {
+ padding: rem(12px);
+}
+
+.search-input {
+ width: 100%;
+}
diff --git a/web/src/components/Common/SearchableMenu/index.tsx b/web/src/components/Common/SearchableMenu/index.tsx
new file mode 100644
index 00000000..aa82faa2
--- /dev/null
+++ b/web/src/components/Common/SearchableMenu/index.tsx
@@ -0,0 +1,205 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useRef, useEffect } from 'react';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+import classnames from 'classnames';
+
+import { Option, filterOptions } from 'jslib/helpers/select';
+import {
+ useScrollToFocused,
+ useScrollToSelected,
+ useSearchMenuKeydown
+} from 'web/libs/hooks/dom';
+import Result from './Result';
+import { makeOptionId, getOptIdxByValue } from '../../../helpers/accessibility';
+import styles from './SearchableMenu.scss';
+
+function useFocusedIdx(options: Option[], currentValue) {
+ const initialValue = getOptIdxByValue(options, currentValue);
+
+ return useState(initialValue);
+}
+
+function getScrollOffset(headerEl) {
+ let ret = 0;
+ if (headerEl) {
+ ret = headerEl.offsetHeight;
+ }
+
+ return ret;
+}
+
+interface OptionParms {
+ isSelected: boolean;
+ isFocused: boolean;
+}
+
+interface Props extends RouteComponentProps {
+ menuId: string;
+ isOpen: boolean;
+ setIsOpen: (boolean) => void;
+ options: Option[];
+ label: string;
+ currentValue: string;
+ textboxValue: string;
+ renderOption: (Option, OptionParams) => React.ReactNode;
+ renderCreateOption: (Option, OptionParams) => React.ReactNode;
+ onKeydownSelect: (Option) => void;
+ renderInput: (any) => React.ReactNode;
+ listboxClassName?: string;
+ itemClassName?: string;
+ labelClassName?: string;
+ textboxWrapperClassName?: string;
+ textboxClassName?: string;
+ disabled?: boolean;
+}
+
+function useSetFocus({
+ filteredOptions,
+ currentValue,
+ setFocusedIdx,
+ textboxValue
+}) {
+ const currentIdx = getOptIdxByValue(filteredOptions, currentValue);
+
+ let targetIdx;
+ if (currentIdx === -1) {
+ targetIdx = 0;
+ } else {
+ targetIdx = currentIdx;
+ }
+
+ useEffect(() => {
+ setFocusedIdx(targetIdx);
+ }, [textboxValue, setFocusedIdx, targetIdx]);
+}
+
+const SearchableMenu: React.FunctionComponent = ({
+ menuId,
+ isOpen,
+ setIsOpen,
+ options,
+ label,
+ listboxClassName,
+ currentValue,
+ textboxValue,
+ itemClassName,
+ labelClassName,
+ textboxWrapperClassName,
+ textboxClassName,
+ renderOption,
+ onKeydownSelect,
+ renderInput,
+ disabled,
+ renderCreateOption
+}) => {
+ const [containerEl, setContainerEl] = useState(null);
+ const [wrapperEl, setWrapperEl] = useState(null);
+ const [focusedOptEl, setFocusedOptEl] = useState(null);
+ const headerRef = useRef(null);
+ const selectedOptRef = useRef(null);
+
+ const creatable = Boolean(renderCreateOption);
+
+ const filteredOptions = filterOptions(options, textboxValue, creatable);
+ const [focusedIdx, setFocusedIdx] = useFocusedIdx(
+ filteredOptions,
+ currentValue
+ );
+
+ useSetFocus({
+ filteredOptions,
+ currentValue,
+ setFocusedIdx,
+ textboxValue
+ });
+
+ const offset = getScrollOffset(headerRef.current);
+ useScrollToSelected({
+ shouldScroll: isOpen,
+ offset,
+ containerEl,
+ selectedOptEl: selectedOptRef.current
+ });
+ useScrollToFocused({
+ shouldScroll: isOpen,
+ focusedOptEl,
+ containerEl,
+ offset
+ });
+ useSearchMenuKeydown({
+ options: filteredOptions,
+ containerEl: wrapperEl,
+ focusedIdx,
+ setFocusedIdx,
+ setIsOpen,
+ onKeydownSelect,
+ disabled
+ });
+
+ const currentOptId = makeOptionId(menuId, currentValue);
+
+ return (
+ {
+ setWrapperEl(el);
+ }}
+ >
+
+ {label}
+
+
+ {renderInput({
+ autoFocus: true,
+ type: 'text',
+ value: textboxValue,
+ className: classnames(styles['search-input'], textboxClassName)
+ })}
+
+
+
+
{
+ setContainerEl(el);
+ }}
+ id={menuId}
+ className={classnames('list-unstyled', listboxClassName)}
+ tabIndex={0}
+ role="menu"
+ aria-activedescendant={currentOptId}
+ >
+
+
+
+ );
+};
+
+export default withRouter(SearchableMenu);
diff --git a/web/src/components/Common/Sidebar/SettingsSidebar/SettingsSidebar.module.scss b/web/src/components/Common/Sidebar/SettingsSidebar/SettingsSidebar.module.scss
new file mode 100644
index 00000000..ca4a5d96
--- /dev/null
+++ b/web/src/components/Common/Sidebar/SettingsSidebar/SettingsSidebar.module.scss
@@ -0,0 +1,61 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../../App/theme';
+@import '../../../App/responsive';
+@import '../../../App/rem';
+@import '../../../App/font';
+
+.bottom {
+ padding: 0 rem(12px);
+ text-align: center;
+}
+
+.button-wrapper {
+ margin: 0 rem(12px);
+}
+
+.button-text {
+ // text-transform: uppercase;
+ margin-left: rem(8px);
+}
+
+a.back-button {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.link {
+ font-weight: 400;
+}
+.link-active {
+ font-weight: 600;
+}
+
+.link-list {
+ margin-top: rem(8px);
+}
+
+.sidebar-heading {
+ display: block;
+ margin-top: rem(20px);
+ padding-left: rem(12px);
+ color: $gray;
+ font-weight: 600;
+}
diff --git a/web/src/components/Common/Sidebar/SettingsSidebar/index.js b/web/src/components/Common/Sidebar/SettingsSidebar/index.js
new file mode 100644
index 00000000..4abce936
--- /dev/null
+++ b/web/src/components/Common/Sidebar/SettingsSidebar/index.js
@@ -0,0 +1,200 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useCallback, useRef, useEffect } from 'react';
+import classnames from 'classnames';
+import { withRouter, Link, NavLink } from 'react-router-dom';
+import { connect } from 'react-redux';
+
+import { getHomePath, getSettingsPath } from 'web/libs/paths';
+import {
+ getWindowWidth,
+ noteSidebarThreshold,
+ sidebarOverlayThreshold
+} from 'jslib/helpers/ui';
+import { closeSidebar, closeNoteSidebar } from '../../../../actions/ui';
+import ArrowIcon from '../../../Icons/Arrow';
+import CloseIcon from '../../../Icons/Close';
+
+import styles from './SettingsSidebar.module.scss';
+import sidebarStyles from '../Sidebar.module.scss';
+
+const SettingsSidebar = ({ location, layoutData, doCloseSidebar }) => {
+ const sidebarRef = useRef(null);
+
+ const maybeCloseSidebar = useCallback(() => {
+ const width = getWindowWidth();
+
+ if (width < noteSidebarThreshold) {
+ doCloseSidebar();
+ }
+ }, [doCloseSidebar]);
+
+ useEffect(() => {
+ function handleMousedown(e) {
+ const sidebarEl = sidebarRef.current;
+
+ if (sidebarEl && !sidebarEl.contains(e.target)) {
+ doCloseSidebar();
+ }
+ }
+
+ const width = getWindowWidth();
+ if (layoutData.sidebar && width < sidebarOverlayThreshold) {
+ document.addEventListener('mousedown', handleMousedown);
+
+ return () => {
+ document.removeEventListener('mousedown', handleMousedown);
+ };
+ }
+
+ return () => null;
+ }, [layoutData.sidebar, doCloseSidebar]);
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
Settings
+
+
+
+ {
+ return location.pathname === getSettingsPath('account');
+ }}
+ >
+ {/*
+ */}
+ Account
+
+
+
+
+ {
+ return (
+ location.pathname === getSettingsPath('notification')
+ );
+ }}
+ >
+ {/*
+ */}
+
+ Notification
+
+
+
+
+
+ {
+ return location.pathname === getSettingsPath('billing');
+ }}
+ >
+ {/*
+ */}
+ Billing
+
+
+
+
+
+
+
+ );
+};
+
+function mapStateToProps(state) {
+ return {
+ layoutData: state.ui.layout,
+ booksData: state.books
+ };
+}
+
+const mapDispatchToProps = {
+ doCloseSidebar: closeSidebar,
+ doCloseNoteSidebar: closeNoteSidebar
+};
+
+export default withRouter(
+ connect(mapStateToProps, mapDispatchToProps)(SettingsSidebar)
+);
diff --git a/web/src/components/Common/Sidebar/Sidebar.module.scss b/web/src/components/Common/Sidebar/Sidebar.module.scss
new file mode 100644
index 00000000..991be720
--- /dev/null
+++ b/web/src/components/Common/Sidebar/Sidebar.module.scss
@@ -0,0 +1,152 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/theme';
+@import '../../App/variables';
+@import '../../App/responsive';
+@import '../../App/rem';
+@import '../../App/font';
+
+.wrapper {
+ background: rgba(72, 72, 72, 0.87);
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 0;
+ bottom: 0;
+ z-index: 4;
+ // transition: background 0.5s cubic-bezier(0, 0, 0, 1);
+
+ &.wrapper-hidden {
+ background: none;
+ position: relative;
+ left: auto;
+ right: auto;
+ top: auto;
+ bottom: auto;
+ }
+
+ @include overSidebarThreshold {
+ background: none;
+ position: relative;
+ left: auto;
+ right: auto;
+ top: auto;
+ bottom: auto;
+ }
+}
+
+.sidebar {
+ background: $light;
+ min-width: $sidebar-width;
+ width: $sidebar-width;
+ transition: 0.25s cubic-bezier(0, 0, 0, 1);
+ border-right: 1px solid $border-color;
+ padding-top: rem(12px);
+ height: 100%;
+
+ position: absolute;
+ transform: translateX(0);
+ z-index: 4;
+ top: 0;
+ bottom: 0;
+
+ @include breakpoint(lg) {
+ position: relative;
+ transform: initial;
+ top: auto;
+ bottom: auto;
+ }
+}
+
+.sidebar-hidden {
+ min-width: 0;
+ width: 0;
+ transform: translateX(-100%);
+
+ .sidebar-content {
+ position: absolute;
+ left: -$sidebar-width;
+ }
+}
+
+.sidebar-content {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+}
+
+.link-list {
+ margin-top: rem(12px);
+}
+
+.link {
+ @include font-size('regular');
+ color: $black;
+ flex: 1;
+ font-weight: 600;
+ display: inline-flex;
+ align-items: center;
+ height: rem(52px);
+ padding: 0 rem(12px);
+
+ @include breakpoint(md) {
+ height: rem(36px);
+ }
+
+ &:hover {
+ color: $black;
+ text-decoration: none;
+ background: darken($light, 5%);
+ }
+
+ &:focus {
+ background: darken($light, 5%);
+ outline: none;
+ }
+
+ &.link-active {
+ background: darken($light, 5%);
+ }
+}
+
+.link-label {
+ margin-left: rem(12px);
+}
+
+.link-item {
+ display: flex;
+}
+
+.close-button {
+ position: absolute;
+ top: rem(16px);
+ right: rem(24px);
+ border-radius: 100%;
+ background: white;
+ border: none;
+ width: rem(28px);
+ height: rem(28px);
+ padding: 0;
+}
+.close-button-content {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
diff --git a/web/src/components/Common/SidebarToggle.js b/web/src/components/Common/SidebarToggle.js
new file mode 100644
index 00000000..ee707594
--- /dev/null
+++ b/web/src/components/Common/SidebarToggle.js
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import MenuIcon from '../Icons/Menu';
+import ArrowIcon from '../Icons/Arrow';
+import styles from './SidebarToggle.module.scss';
+
+function SidebarToggle({ onClick, type }) {
+ return (
+
+ {type === 'arrow' ? (
+
+ ) : (
+
+ )}
+
+ );
+}
+
+SidebarToggle.defaultProps = {
+ type: 'menu'
+};
+
+export default SidebarToggle;
diff --git a/web/src/components/Common/SidebarToggle.module.scss b/web/src/components/Common/SidebarToggle.module.scss
new file mode 100644
index 00000000..2248b4e2
--- /dev/null
+++ b/web/src/components/Common/SidebarToggle.module.scss
@@ -0,0 +1,29 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/variables';
+
+.button {
+ padding: 0;
+
+ @include overSidebarThreshold {
+ display: none;
+ }
+}
diff --git a/web/src/components/Common/SystemMessage.scss b/web/src/components/Common/SystemMessage.scss
new file mode 100644
index 00000000..c766b2df
--- /dev/null
+++ b/web/src/components/Common/SystemMessage.scss
@@ -0,0 +1,28 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/variables';
+@import '../App/rem';
+
+.wrapper {
+ @include breakpoint(lg) {
+ margin-top: rem(20px);
+ }
+}
diff --git a/web/src/components/Common/SystemMessage.tsx b/web/src/components/Common/SystemMessage.tsx
new file mode 100644
index 00000000..6760fcb9
--- /dev/null
+++ b/web/src/components/Common/SystemMessage.tsx
@@ -0,0 +1,81 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+import { matchPath } from 'react-router';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+import { Location } from 'history';
+
+import Flash from './Flash';
+import { unsetMessage } from '../../store/ui';
+import { useSelector, useDispatch } from '../../store';
+import { MessageState } from '../../store/ui';
+import styles from './SystemMessage.scss';
+
+interface Props extends RouteComponentProps {}
+
+function matchMessagePath(location: Location, message: MessageState): string {
+ const paths = Object.keys(message);
+ for (let i = 0; i < paths.length; ++i) {
+ const path = paths[i];
+
+ const match = matchPath(location.pathname, {
+ path,
+ exact: true
+ });
+
+ if (match) {
+ return path;
+ }
+ }
+
+ return null;
+}
+
+const SystemMessage: React.FunctionComponent = ({ location }) => {
+ const { message } = useSelector(state => {
+ return {
+ message: state.ui.message
+ };
+ });
+ const dispatch = useDispatch();
+
+ const matchedPath = matchMessagePath(location, message);
+ if (matchedPath === null) {
+ return null;
+ }
+
+ const messageData = message[matchedPath];
+
+ return (
+
+ {
+ dispatch(unsetMessage());
+ }}
+ noMargin
+ >
+ {messageData.content}
+
+
+ );
+};
+
+export default withRouter(SystemMessage);
diff --git a/web/src/components/Common/Time.scss b/web/src/components/Common/Time.scss
new file mode 100644
index 00000000..8dbb5e7a
--- /dev/null
+++ b/web/src/components/Common/Time.scss
@@ -0,0 +1,43 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/rem';
+@import '../App/theme';
+@import '../App/font';
+
+.time {
+ // border-bottom: 1px dotted $gray;
+ //
+ // @include breakpoint(lg) {
+ // border-bottom-color: transparent;
+ // }
+}
+
+.mobile-text {
+ @include breakpoint(md) {
+ display: none;
+ }
+}
+.text {
+ display: none;
+
+ @include breakpoint(md) {
+ display: inherit;
+ }
+}
diff --git a/web/src/components/Common/Time.tsx b/web/src/components/Common/Time.tsx
new file mode 100644
index 00000000..f0458ecb
--- /dev/null
+++ b/web/src/components/Common/Time.tsx
@@ -0,0 +1,101 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { msToHTMLTimeDuration } from '../../helpers/time';
+import formatTime from '../../helpers/time/format';
+import { Alignment, Direction } from '../Common/Popover/types';
+import styles from './Time.scss';
+import Tooltip from './Tooltip';
+
+interface ContentProps {
+ text: string;
+ mobileText?: string;
+}
+
+const Content: React.FunctionComponent = ({
+ text,
+ mobileText
+}) => {
+ if (mobileText === undefined) {
+ return {text} ;
+ }
+
+ return (
+
+ {text}
+ {mobileText}
+
+ );
+};
+
+interface Props {
+ id: string;
+ text: string;
+ ms: number;
+ mobileText?: string;
+ isDuration?: boolean;
+ wrapperClassName?: string;
+ tooltipAlignment?: Alignment;
+ tooltipDirection?: Direction;
+}
+
+function getDatetimeAttr(ms: number, isDuration: boolean = false): string {
+ if (isDuration) {
+ return msToHTMLTimeDuration(ms);
+ }
+
+ const d = new Date(ms);
+ return d.toISOString();
+}
+
+function formatOverlayTimeStr(ms: number): string {
+ const date = new Date(ms);
+
+ return formatTime(date, '%MMM %DD, %YYYY, %hh:%mm %A GMT%Z');
+}
+
+const Time: React.FunctionComponent = ({
+ id,
+ text,
+ mobileText,
+ ms,
+ isDuration,
+ wrapperClassName,
+ tooltipAlignment = 'center',
+ tooltipDirection = 'bottom'
+}) => {
+ const dateTime = getDatetimeAttr(ms, isDuration);
+ const overlay = {formatOverlayTimeStr(ms)} ;
+
+ return (
+
+
+
+
+
+ );
+};
+
+export default Time;
diff --git a/web/src/components/Common/Toggle.scss b/web/src/components/Common/Toggle.scss
new file mode 100644
index 00000000..82eec8c6
--- /dev/null
+++ b/web/src/components/Common/Toggle.scss
@@ -0,0 +1,92 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/rem';
+@import '../App/theme';
+@import '../App/font';
+
+.label {
+ display: flex;
+ align-items: center;
+ margin-bottom: 0;
+
+ input[type='checkbox'] {
+ position: absolute;
+ z-index: 2;
+ opacity: 0;
+ }
+
+ input[type='checkbox']:focus + .toggle {
+ outline: #5d9dd5 solid 1px;
+ box-shadow: 0 0 8px #5e9ed6;
+ }
+
+ &.first {
+ &.enabled {
+ color: $first;
+
+ .toggle {
+ background-color: $first;
+ }
+ }
+ }
+ &.green {
+ &.enabled {
+ color: $green;
+
+ .toggle {
+ background-color: $green;
+ }
+ }
+ }
+
+ &.enabled {
+ .indicator {
+ transform: translateX(15px);
+ }
+ }
+
+ &.disabled {
+ color: $gray;
+
+ .toggle {
+ background-color: $gray;
+ }
+ .indicator {
+ transform: translateX(3px);
+ }
+ }
+}
+
+.toggle {
+ height: 20px;
+ border-radius: 16px;
+ width: 32px;
+ position: relative;
+}
+
+.indicator {
+ position: absolute;
+ top: 3px;
+ border-radius: 100%;
+ background-color: $white;
+ height: 14px;
+ width: 14px;
+ min-width: 14px;
+}
diff --git a/web/src/components/Common/Toggle.tsx b/web/src/components/Common/Toggle.tsx
new file mode 100644
index 00000000..499456e1
--- /dev/null
+++ b/web/src/components/Common/Toggle.tsx
@@ -0,0 +1,78 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import React from 'react';
+import styles from './Toggle.scss';
+
+interface Props {
+ checked: boolean;
+ onChange: (boolean) => void;
+ label?: React.ReactNode;
+ id?: string;
+ disabled?: boolean;
+ wrapperClassName?: string;
+ kind: string;
+}
+
+export enum ToggleKind {
+ first = 'first',
+ green = 'green'
+}
+
+const Toggle: React.FunctionComponent = ({
+ id,
+ checked,
+ onChange,
+ disabled,
+ label,
+ wrapperClassName,
+ kind
+}) => {
+ return (
+
+ );
+};
+
+export default Toggle;
diff --git a/web/src/components/Common/Tooltip/Overlay.tsx b/web/src/components/Common/Tooltip/Overlay.tsx
new file mode 100644
index 00000000..a3136561
--- /dev/null
+++ b/web/src/components/Common/Tooltip/Overlay.tsx
@@ -0,0 +1,276 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import ReactDOM from 'react-dom';
+import classnames from 'classnames';
+
+import { Alignment, Direction } from '../Popover/types';
+import styles from './Tooltip.scss';
+
+interface Props {
+ id: string;
+ isOpen: boolean;
+ children: React.ReactNode;
+ triggerEl: HTMLElement;
+ alignment: Alignment;
+ direction: Direction;
+ noArrow: boolean;
+}
+
+// cumulativeOffset calculates the top and left offsets of the given element
+// while taking into account all of the parents' offsets, if any.
+function cumulativeOffset(element: HTMLElement) {
+ let top = 0;
+ let left = 0;
+
+ let e = element;
+ while (e) {
+ top += e.offsetTop || 0;
+ left += e.offsetLeft || 0;
+
+ e = e.offsetParent as HTMLElement;
+ }
+
+ return {
+ top,
+ left
+ };
+}
+
+function calcOverlayY(
+ offsetY: number,
+ triggerRect: ClientRect,
+ overlayRect: ClientRect,
+ arrowRect: ClientRect,
+ alignment: Alignment,
+ direction: Direction
+): number {
+ const triggerHeight = triggerRect.height;
+ const overlayHeight = overlayRect.height;
+ const arrowHeight = arrowRect.height / 2;
+
+ if (direction === 'bottom') {
+ return offsetY + triggerHeight + arrowHeight;
+ }
+ if (direction === 'top') {
+ return offsetY - overlayHeight - arrowHeight;
+ }
+ if (alignment === 'bottom') {
+ return offsetY + (triggerHeight - overlayHeight);
+ }
+ if (alignment === 'center') {
+ return offsetY + (triggerHeight - overlayHeight) / 2;
+ }
+ if (alignment === 'top') {
+ return offsetY;
+ }
+
+ return 0;
+}
+
+function calcOverlayX(
+ offsetX: number,
+ triggerRect: ClientRect,
+ overlayRect: ClientRect,
+ arrowRect: ClientRect,
+ alignment: Alignment,
+ direction: Direction
+): number {
+ const triggerWidth = triggerRect.width;
+ const overlayWidth = overlayRect.width;
+ const arrowWidth = arrowRect.width / 2;
+
+ if (direction === 'left') {
+ return offsetX - overlayWidth - arrowWidth;
+ }
+ if (direction === 'right') {
+ return offsetX + triggerWidth + arrowWidth * 2;
+ }
+ if (alignment === 'left') {
+ return offsetX;
+ }
+ if (alignment === 'right') {
+ return offsetX + triggerWidth - overlayWidth;
+ }
+ if (alignment === 'center') {
+ return offsetX + (triggerWidth - overlayWidth) / 2;
+ }
+
+ return 0;
+}
+
+function calcOverlayPosition(
+ triggerEl: HTMLElement,
+ overlayEl: HTMLElement,
+ arrowEl: HTMLElement,
+ direction: Direction,
+ alignment: Alignment
+): { top: number; left: number } {
+ if (triggerEl === null) {
+ return null;
+ }
+ if (overlayEl === null) {
+ return { top: -999, left: -999 };
+ }
+
+ const triggerOffset = cumulativeOffset(triggerEl);
+ const triggerRect = triggerEl.getBoundingClientRect();
+ const overlayRect = overlayEl.getBoundingClientRect();
+ const arrowRect = arrowEl.getBoundingClientRect();
+
+ const x = calcOverlayX(
+ triggerOffset.left,
+ triggerRect,
+ overlayRect,
+ arrowRect,
+ alignment,
+ direction
+ );
+ const y = calcOverlayY(
+ triggerOffset.top,
+ triggerRect,
+ overlayRect,
+ arrowRect,
+ alignment,
+ direction
+ );
+
+ return { top: y, left: x };
+}
+
+function calcArrowX(
+ offsetX: number,
+ triggerRect: ClientRect,
+ arrowRect: ClientRect,
+ direction: Direction
+) {
+ const arrowWidth = arrowRect.width / 2;
+
+ if (direction === 'top' || direction === 'bottom') {
+ return offsetX + triggerRect.width / 2 - arrowWidth;
+ }
+ if (direction === 'left') {
+ return offsetX - arrowWidth;
+ }
+ if (direction === 'right') {
+ return offsetX + triggerRect.width;
+ }
+
+ return 0;
+}
+
+function calcArrowY(
+ offsetY: number,
+ triggerRect: ClientRect,
+ arrowRect: ClientRect,
+ direction: Direction
+) {
+ const arrowHeight = arrowRect.height / 2;
+
+ if (direction === 'left' || direction === 'right') {
+ return offsetY + triggerRect.height / 2 - arrowRect.height / 2;
+ }
+ if (direction === 'top') {
+ return offsetY - arrowRect.height / 2;
+ }
+ if (direction === 'bottom') {
+ return offsetY + triggerRect.height - arrowHeight;
+ }
+
+ return 0;
+}
+
+function calcArrowPosition(
+ triggerEl: HTMLElement,
+ arrowEl: HTMLElement,
+ direction: Direction
+) {
+ if (triggerEl === null) {
+ return null;
+ }
+ if (arrowEl === null) {
+ return { top: -999, left: -999 };
+ }
+
+ const triggerOffset = cumulativeOffset(triggerEl);
+ const triggerRect = triggerEl.getBoundingClientRect();
+ const arrowRect = arrowEl.getBoundingClientRect();
+
+ const x = calcArrowX(triggerOffset.left, triggerRect, arrowRect, direction);
+ const y = calcArrowY(triggerOffset.top, triggerRect, arrowRect, direction);
+
+ return { top: y, left: x };
+}
+
+const Overlay: React.FunctionComponent = ({
+ id,
+ isOpen,
+ children,
+ triggerEl,
+ alignment,
+ direction,
+ noArrow
+}) => {
+ const [overlayEl, setOverlayEl] = useState(null);
+ const [arrowEl, setArrowEl] = useState(null);
+
+ if (!isOpen) {
+ return null;
+ }
+
+ const overlayRoot = document.getElementById('overlay-root');
+ const overlayPos = calcOverlayPosition(
+ triggerEl,
+ overlayEl,
+ arrowEl,
+ direction,
+ alignment
+ );
+ const arrowPos = calcArrowPosition(triggerEl, arrowEl, direction);
+
+ return ReactDOM.createPortal(
+
+
{
+ setArrowEl(el);
+ }}
+ />
+
{
+ setOverlayEl(el);
+ }}
+ >
+ {children}
+
+
,
+ overlayRoot
+ );
+};
+
+export default Overlay;
diff --git a/web/src/components/Common/Tooltip/Tooltip.scss b/web/src/components/Common/Tooltip/Tooltip.scss
new file mode 100644
index 00000000..52f5bc44
--- /dev/null
+++ b/web/src/components/Common/Tooltip/Tooltip.scss
@@ -0,0 +1,58 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see
.
+ */
+
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+
+.overlay {
+ @include font-size('small');
+
+ pointer-events: none;
+ max-width: 100%;
+ position: absolute;
+ max-width: 100%;
+ background: $black;
+ color: white;
+ border: none;
+ padding: rem(4px) rem(8px);
+ border-radius: 4px;
+ z-index: 7;
+}
+
+.arrow {
+ border: 6px solid transparent;
+ position: absolute;
+ content: '';
+
+ &.bottom {
+ border-bottom-color: #2a2a2a;
+ }
+ &.top {
+ border-top-color: #2a2a2a;
+ }
+ &.left {
+ border-left-color: #2a2a2a;
+ }
+ &.right {
+ border-right-color: #2a2a2a;
+ }
+ &.hidden {
+ visibility: hidden;
+ }
+}
diff --git a/web/src/components/Common/Tooltip/index.tsx b/web/src/components/Common/Tooltip/index.tsx
new file mode 100644
index 00000000..03b946c0
--- /dev/null
+++ b/web/src/components/Common/Tooltip/index.tsx
@@ -0,0 +1,79 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see
.
+ */
+
+import React, { useRef, useState } from 'react';
+import { Alignment, Direction } from '../Popover/types';
+import Overlay from './Overlay';
+
+interface Props {
+ id: string;
+ alignment: Alignment;
+ direction: Direction;
+ overlay: React.ReactNode;
+ children: React.ReactChild;
+ contentClassName?: string;
+ wrapperClassName?: string;
+ triggerClassName?: string;
+ noArrow?: boolean;
+}
+
+const Tooltip: React.FunctionComponent
= ({
+ id,
+ alignment,
+ direction,
+ wrapperClassName,
+ overlay,
+ children,
+ noArrow = false
+}) => {
+ const [isOpen, setIsOpen] = useState(false);
+ const triggerRef = useRef(null);
+
+ function show() {
+ setIsOpen(true);
+ }
+
+ function hide() {
+ setIsOpen(false);
+ }
+
+ return (
+
+
+ {children}
+
+
+
+ {overlay}
+
+
+ );
+};
+
+export default Tooltip;
diff --git a/web/src/components/Edit/Content.tsx b/web/src/components/Edit/Content.tsx
new file mode 100644
index 00000000..b9b10c51
--- /dev/null
+++ b/web/src/components/Edit/Content.tsx
@@ -0,0 +1,111 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import React, { useRef, useState } from 'react';
+import { Prompt, RouteComponentProps, withRouter } from 'react-router-dom';
+import { useFocusTextarea } from 'web/libs/hooks/editor';
+import operations from 'web/libs/operations';
+import { getNotePath, notePathDef } from 'web/libs/paths';
+import { useDispatch, useSelector } from '../../store';
+import { createBook } from '../../store/books';
+import { EditorSession, resetEditor } from '../../store/editor';
+import { setMessage } from '../../store/ui';
+import Editor from '../Common/Editor';
+import styles from '../New/New.scss';
+
+interface Props extends RouteComponentProps {
+ noteUUID: string;
+ persisted: boolean;
+ editor: EditorSession;
+ setErrMessage: React.Dispatch;
+}
+
+const Edit: React.FunctionComponent = ({
+ noteUUID,
+ persisted,
+ editor,
+ history,
+ setErrMessage
+}) => {
+ const { prevLocation } = useSelector(state => {
+ return {
+ prevLocation: state.route.prevLocation
+ };
+ });
+ const dispatch = useDispatch();
+ const [submitting, setSubmitting] = useState(false);
+ const textareaRef = useRef(null);
+
+ useFocusTextarea(textareaRef.current);
+
+ return (
+
+
+
+
Edit note
+
+
+
{
+ setSubmitting(true);
+
+ try {
+ let bookUUID;
+
+ if (!draftBookUUID) {
+ const book = await dispatch(createBook(editor.bookLabel));
+ bookUUID = book.uuid;
+ } else {
+ bookUUID = draftBookUUID;
+ }
+
+ const note = await operations.notes.update(noteUUID, {
+ book_uuid: bookUUID,
+ content: draftContent
+ });
+
+ dispatch(resetEditor(editor.sessionKey));
+
+ const dest = getNotePath(note.uuid);
+ history.push(dest);
+
+ dispatch(
+ setMessage({
+ message: 'Updated the note',
+ kind: 'info',
+ path: notePathDef
+ })
+ );
+ } catch (err) {
+ setErrMessage(err.message);
+ setSubmitting(false);
+ }
+ }}
+ />
+
+
+
+ );
+};
+
+export default React.memo(withRouter(Edit));
diff --git a/web/src/components/Edit/index.tsx b/web/src/components/Edit/index.tsx
new file mode 100644
index 00000000..15fa7174
--- /dev/null
+++ b/web/src/components/Edit/index.tsx
@@ -0,0 +1,99 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import React, { useEffect, useState } from 'react';
+import Helmet from 'react-helmet';
+import { RouteComponentProps, withRouter } from 'react-router-dom';
+import { getEditorSessionkey } from 'web/libs/editor';
+import operations from 'web/libs/operations';
+import { useDispatch, useSelector } from '../../store';
+import { createSession } from '../../store/editor';
+import Flash from '../Common/Flash';
+import styles from '../New/New.scss';
+import Content from './Content';
+
+interface Match {
+ noteUUID: string;
+}
+
+interface Props extends RouteComponentProps {}
+
+const Edit: React.FunctionComponent = ({ match }) => {
+ const { noteUUID } = match.params;
+
+ const sessionKey = getEditorSessionkey(noteUUID);
+ const { editor } = useSelector(state => {
+ return {
+ editor: state.editor
+ };
+ });
+ const session = editor.sessions[sessionKey];
+
+ const dispatch = useDispatch();
+ const [errMessage, setErrMessage] = useState('');
+
+ useEffect(() => {
+ if (session === undefined) {
+ operations.notes
+ .fetchOne(noteUUID)
+ .then(note => {
+ dispatch(
+ createSession({
+ noteUUID: note.uuid,
+ bookUUID: note.book.uuid,
+ bookLabel: note.book.label,
+ content: note.content
+ })
+ );
+ })
+ .catch((err: Error) => {
+ setErrMessage(err.message);
+ });
+ }
+ }, [dispatch, noteUUID, session]);
+
+ return (
+
+
+ Edit Note
+
+
+
+ Error: {errMessage}
+
+
+ {session !== undefined && (
+
+ )}
+
+ );
+};
+
+export default React.memo(withRouter(Edit));
diff --git a/web/src/components/EmailPreference/EmailPreference.scss b/web/src/components/EmailPreference/EmailPreference.scss
new file mode 100644
index 00000000..15df58d0
--- /dev/null
+++ b/web/src/components/EmailPreference/EmailPreference.scss
@@ -0,0 +1,60 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/rem';
+@import '../App/font';
+
+.wrapper {
+ text-align: center;
+ height: 100vh;
+ padding: rem(52px) 0;
+ background: $lighter-gray;
+}
+
+.heading {
+ @include font-size('2x-large');
+ color: $black;
+ font-weight: 300;
+ margin-top: rem(16px);
+}
+
+.body {
+ text-align: left;
+ padding: rem(20px) rem(28px);
+ margin-top: rem(20px);
+ max-width: rem(700px);
+ margin-left: auto;
+ margin-right: auto;
+ background-color: #fff;
+}
+
+.footer {
+ @include font-size('small');
+ text-align: center;
+ margin-top: rem(20px);
+
+ a {
+ color: $gray;
+ }
+}
+
+.flash {
+ margin-bottom: rem(8px);
+}
diff --git a/web/src/components/EmailPreference/index.tsx b/web/src/components/EmailPreference/index.tsx
new file mode 100644
index 00000000..baedec99
--- /dev/null
+++ b/web/src/components/EmailPreference/index.tsx
@@ -0,0 +1,112 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useEffect } from 'react';
+import classnames from 'classnames';
+import { RouteComponentProps } from 'react-router';
+import { Link, withRouter } from 'react-router-dom';
+import Helmet from 'react-helmet';
+
+import { parseSearchString } from 'jslib/helpers/url';
+import { getHomePath, getLoginPath } from 'web/libs/paths';
+import Form from '../Settings/Notifications/Form';
+import { getEmailPreference } from '../../store/auth';
+import Logo from '../Icons/Logo';
+import { useSelector, useDispatch } from '../../store';
+import Flash from '../Common/Flash';
+import styles from './EmailPreference.scss';
+
+interface Props extends RouteComponentProps {}
+
+const EmailPreference: React.FunctionComponent = ({ location }) => {
+ const { token } = parseSearchString(location.search);
+
+ const [successMsg, setSuccessMsg] = useState('');
+ const [failureMsg, setFailureMsg] = useState('');
+
+ const dispatch = useDispatch();
+
+ const { emailPreference } = useSelector(state => {
+ return {
+ emailPreference: state.auth.emailPreference
+ };
+ });
+
+ useEffect(() => {
+ if (!emailPreference.isFetched) {
+ dispatch(getEmailPreference(token));
+ }
+ }, [dispatch, emailPreference.isFetched, token]);
+
+ return (
+
+
+ Email Preferences
+
+
+
+
+
+
Dnote email preferences
+
+
+
+
+ Error fetching email preference: {emailPreference.errorMessage}.
+ Please try again after logging in.
+
+
+
+ {successMsg}
+
+
+
+ {failureMsg}
+
+
+ {emailPreference.isFetched && (
+
+ )}
+
+
+ Back to Dnote home
+
+
+
+ );
+};
+
+export default withRouter(EmailPreference);
diff --git a/web/src/components/Header/AccountMenu.scss b/web/src/components/Header/AccountMenu.scss
new file mode 100644
index 00000000..7f4104ef
--- /dev/null
+++ b/web/src/components/Header/AccountMenu.scss
@@ -0,0 +1,120 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/font';
+@import '../App/theme';
+@import '../App/rem';
+@import '../App/responsive';
+
+.wrapper {
+ display: none;
+ margin-left: rem(20px);
+ align-self: stretch;
+
+ @include breakpoint(lg) {
+ display: flex;
+ }
+}
+
+.trigger {
+ align-self: stretch;
+}
+
+.account-circle {
+ border-radius: 100%;
+ // background: white;
+ background: $third;
+ width: rem(8px);
+ height: rem(8px);
+ display: inline-block;
+ //border: 1px solid gray;
+}
+
+.account-label {
+ margin-left: rem(8px);
+ font-weight: 600;
+}
+
+.content {
+ width: rem(200px);
+
+ @include breakpoint(md) {
+ width: rem(240px);
+ }
+}
+
+.header {
+ padding: rem(8px) rem(12px);
+ display: block;
+ margin-bottom: 0;
+ font-size: 1.4rem;
+ color: #868e96;
+ white-space: nowrap;
+ @include font-size('small');
+
+ svg {
+ fill: #868e96;
+ }
+}
+
+.divider {
+ height: 0;
+ overflow: hidden;
+ border-top: 1px solid #e9ecef;
+}
+
+.link {
+ @include font-size('small');
+ white-space: pre;
+ padding: rem(8px) rem(14px);
+ width: 100%;
+ display: block;
+ color: black;
+
+ &:hover {
+ background: $lighter-gray;
+ text-decoration: none;
+ color: #0056b3;
+ }
+
+ &.disabled {
+ color: #d4d4d4;
+ cursor: not-allowed;
+ }
+
+ &:not(.disabled):focus {
+ background: $lighter-gray;
+ color: #0056b3;
+ outline: 1px dotted gray;
+ }
+}
+
+.email {
+ font-weight: 600;
+ white-space: normal;
+ word-break: break-all;
+}
+
+.session-notice-wrapper {
+ display: flex;
+ align-items: center;
+}
+
+.session-notice {
+ margin-left: rem(4px);
+}
diff --git a/web/src/components/Header/AccountMenu.tsx b/web/src/components/Header/AccountMenu.tsx
new file mode 100644
index 00000000..e8c35dee
--- /dev/null
+++ b/web/src/components/Header/AccountMenu.tsx
@@ -0,0 +1,139 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { Fragment, useState, useRef } from 'react';
+import classnames from 'classnames';
+import { Link } from 'react-router-dom';
+import { connect } from 'react-redux';
+
+import services from 'web/libs/services';
+import { SettingSections, getSettingsPath, getHomePath } from 'web/libs/paths';
+import Lock from '../Icons/Lock';
+import Menu from '../Common/Menu';
+import UserIcon from '../Icons/User';
+import { AppState } from '../../store';
+import { UserData } from '../../store/auth';
+
+import styles from './AccountMenu.scss';
+
+interface Props {
+ user: UserData;
+}
+
+const AccountMenu: React.FunctionComponent = ({ user }) => {
+ const [isOpen, setIsOpen] = useState(false);
+ const optRefs = [useRef(null), useRef(null), useRef(null)];
+
+ const options = [
+ {
+ name: 'home',
+ value: (
+ {
+ setIsOpen(false);
+ }}
+ ref={optRefs[0]}
+ tabIndex={-1}
+ >
+ Home
+
+ )
+ },
+ {
+ name: 'settings',
+ value: (
+ {
+ setIsOpen(false);
+ }}
+ innerRef={optRefs[1]}
+ tabIndex={-1}
+ >
+ Settings
+
+ )
+ },
+ {
+ name: 'logout',
+ value: (
+ {
+ e.preventDefault();
+
+ services.users.signout().then(() => {
+ window.location.href = '/';
+ });
+ }}
+ >
+
+
+ )
+ }
+ ];
+
+ return (
+ }
+ headerContent={
+
+
+
+
+ }
+ wrapperClassName={styles.wrapper}
+ triggerClassName={styles.trigger}
+ contentClassName={styles.content}
+ alignment="right"
+ direction="bottom"
+ />
+ );
+};
+
+function mapStateToProps(state: AppState) {
+ return {
+ user: state.auth.user.data
+ };
+}
+
+export default connect(mapStateToProps)(AccountMenu);
diff --git a/web/src/components/Header/DemoHeader.js b/web/src/components/Header/DemoHeader.js
new file mode 100644
index 00000000..97410fd9
--- /dev/null
+++ b/web/src/components/Header/DemoHeader.js
@@ -0,0 +1,83 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+import { Link } from 'react-router-dom';
+import { connect } from 'react-redux';
+
+import { getSubscriptionPath, getJoinPath } from 'web/libs/paths';
+
+import styles from './DemoHeader.module.scss';
+
+function getPricingPath(user) {
+ if (user) {
+ return getSubscriptionPath();
+ }
+
+ return getJoinPath({ referrer: getSubscriptionPath() });
+}
+
+function DemoHeader({ user }) {
+ return (
+
+
+
Live Demo
+
+
+
+ Get your own encrypted repository of knowledge.
+
+
+
+
+
+
+
+ Quit demo
+
+
+ );
+}
+
+function mapStateToProps(state) {
+ return {
+ user: state.auth.user
+ };
+}
+
+export default connect(mapStateToProps)(DemoHeader);
diff --git a/web/src/components/Header/DemoHeader.module.scss b/web/src/components/Header/DemoHeader.module.scss
new file mode 100644
index 00000000..8303c60a
--- /dev/null
+++ b/web/src/components/Header/DemoHeader.module.scss
@@ -0,0 +1,138 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/rem';
+@import '../App/font';
+
+.wrapper {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: rem(20px) rem(16px);
+ background: $first;
+ z-index: 3;
+ position: relative;
+
+ @include breakpoint(lg) {
+ flex-direction: row;
+ justify-content: center;
+ }
+}
+
+.content {
+}
+
+.left {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ width: 100%;
+
+ @include breakpoint(md) {
+ flex-direction: row;
+ width: auto;
+ }
+
+ @include breakpoint(lg) {
+ align-items: center;
+ }
+}
+
+.right {
+ width: 100%;
+ display: flex;
+ align-items: center;
+ margin-top: rem(16px);
+
+ @include breakpoint(md) {
+ width: auto;
+ }
+
+ @include breakpoint(lg) {
+ margin-top: 0;
+ }
+}
+
+.heading {
+ @include font-size('medium');
+ font-weight: 600;
+ color: $white;
+}
+
+.subheading {
+ @include font-size('regular');
+ font-weight: 400;
+ color: $white;
+
+ @include breakpoint(md) {
+ margin-left: rem(8px);
+ }
+}
+
+.colon {
+ margin-right: rem(8px);
+}
+
+.support {
+ display: block;
+
+ @include breakpoint(md) {
+ display: inline-block;
+ }
+}
+
+.cta {
+ width: 100%;
+ flex: 1;
+
+ @include breakpoint(lg) {
+ width: auto;
+ flex: auto;
+ margin-left: rem(16px);
+ }
+}
+
+.quit {
+ color: $white;
+ @include font-size('small');
+ display: none;
+
+ &:hover {
+ color: #e3e3e3;
+ }
+
+ @include breakpoint(lg) {
+ display: block;
+ position: absolute;
+ right: rem(16px);
+ }
+}
+
+a.quit-mobile {
+ color: white;
+ font-size: 1.4rem;
+ flex: 1;
+ padding: 5px 14px;
+
+ @include breakpoint(lg) {
+ display: none;
+ }
+}
diff --git a/web/src/components/Header/Nav/Item.scss b/web/src/components/Header/Nav/Item.scss
new file mode 100644
index 00000000..3c38a1ad
--- /dev/null
+++ b/web/src/components/Header/Nav/Item.scss
@@ -0,0 +1,43 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/variables';
+
+.wrapper {
+ display: flex;
+ align-items: stretch;
+}
+
+.link {
+ @include font-size('small');
+ display: flex;
+ font-weight: 600;
+ align-items: center;
+ padding: 0 rem(16px);
+ color: $white;
+
+ &:hover {
+ color: $white;
+ text-decoration: none;
+ background: lighten($first, 10%);
+ }
+}
diff --git a/web/src/components/Header/Nav/Item.tsx b/web/src/components/Header/Nav/Item.tsx
new file mode 100644
index 00000000..9b9993e0
--- /dev/null
+++ b/web/src/components/Header/Nav/Item.tsx
@@ -0,0 +1,40 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { Link } from 'react-router-dom';
+import { Location } from 'history';
+
+import styles from './Item.scss';
+
+interface Props {
+ to: Location;
+ label: string;
+}
+
+const Item: React.FunctionComponent = ({ to, label }) => {
+ return (
+
+
+ {label}
+
+
+ );
+};
+
+export default Item;
diff --git a/web/src/components/Header/Nav/Nav.scss b/web/src/components/Header/Nav/Nav.scss
new file mode 100644
index 00000000..b69d35d7
--- /dev/null
+++ b/web/src/components/Header/Nav/Nav.scss
@@ -0,0 +1,36 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/variables';
+
+.wrapper {
+ margin-left: rem(32px);
+ display: none;
+
+ @include breakpoint(lg) {
+ display: flex;
+ }
+}
+
+.list {
+ display: flex;
+}
diff --git a/web/src/components/Header/Nav/index.tsx b/web/src/components/Header/Nav/index.tsx
new file mode 100644
index 00000000..76c2a740
--- /dev/null
+++ b/web/src/components/Header/Nav/index.tsx
@@ -0,0 +1,44 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import { getNewPath, getBooksPath } from 'web/libs/paths';
+import { Filters, toSearchObj } from 'jslib/helpers/filters';
+import Item from './Item';
+import styles from './Nav.scss';
+
+interface Props {
+ filters: Filters;
+}
+
+const Nav: React.FunctionComponent = ({ filters }) => {
+ const searchObj = toSearchObj(filters);
+
+ return (
+
+
+
+ );
+};
+
+export default Nav;
diff --git a/web/src/components/Header/Normal.scss b/web/src/components/Header/Normal.scss
new file mode 100644
index 00000000..10a8c9cf
--- /dev/null
+++ b/web/src/components/Header/Normal.scss
@@ -0,0 +1,110 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/rem';
+@import '../App/font';
+@import '../App/variables';
+
+.wrapper {
+ padding: 0;
+ z-index: 2;
+ position: relative;
+ display: flex;
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
+ background: $first;
+ align-items: stretch;
+ justify-content: space-between;
+ flex: 1;
+ flex-direction: column;
+ position: sticky;
+ top: 0;
+ z-index: 4;
+ height: $header-height;
+
+ @include breakpoint(md) {
+ flex-direction: row;
+ }
+}
+
+.content-wrapper {
+ display: flex;
+ padding: 0;
+}
+
+.content {
+ display: flex;
+ flex-grow: 1;
+ justify-content: space-between;
+}
+
+.left {
+ display: flex;
+ align-items: stretch;
+ height: $header-height;
+ display: flex;
+ justify-content: space-between;
+
+ @include breakpoint(md) {
+ padding: 0;
+ height: auto;
+ }
+}
+
+.right {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ flex: 1;
+ margin-left: rem(24px);
+
+ @include breakpoint(lg) {
+ flex: auto;
+ margin-left: 0;
+ }
+}
+
+.brand {
+ display: flex;
+ align-items: center;
+
+ &:hover {
+ text-decoration: none;
+ }
+}
+
+.logo {
+ margin: 0 auto;
+ display: none;
+
+ @include breakpoint(md) {
+ display: block;
+ }
+}
+
+.logosm {
+ @include breakpoint(md) {
+ display: none;
+ }
+}
+
+.email {
+ @include font-size('regular');
+ color: $gray;
+}
diff --git a/web/src/components/Header/Normal.tsx b/web/src/components/Header/Normal.tsx
new file mode 100644
index 00000000..8e669572
--- /dev/null
+++ b/web/src/components/Header/Normal.tsx
@@ -0,0 +1,84 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { Link, withRouter, RouteComponentProps } from 'react-router-dom';
+import classnames from 'classnames';
+import { Location } from 'history';
+
+import { getHomePath, checkCurrentPath, homePathDef } from 'web/libs/paths';
+import { toSearchObj } from 'jslib/helpers/filters';
+import LogoWithText from '../Icons/LogoWithText';
+import Logo from '../Icons/Logo';
+import AccountMenu from './AccountMenu';
+import Nav from './Nav';
+import SearchBar from './SearchBar';
+import { useFilters } from '../../store';
+import { FiltersState } from '../../store/filters';
+import styles from './Normal.scss';
+
+interface Props extends RouteComponentProps {}
+
+function getHomeDest(location: Location, filters: FiltersState) {
+ if (checkCurrentPath(location, homePathDef)) {
+ return getHomePath();
+ }
+
+ return getHomePath(filters);
+}
+
+const NormalHeader: React.FunctionComponent = ({ location }) => {
+ const filters = useFilters();
+ const searchObj = toSearchObj(filters);
+
+ return (
+
+ );
+};
+
+export default withRouter(NormalHeader);
diff --git a/web/src/components/Header/Note/Guest.scss b/web/src/components/Header/Note/Guest.scss
new file mode 100644
index 00000000..32bdea1e
--- /dev/null
+++ b/web/src/components/Header/Note/Guest.scss
@@ -0,0 +1,79 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/variables';
+
+.wrapper {
+ background: $lighter-gray;
+ padding: rem(12px) rem(20px);
+ height: $header-height;
+ z-index: 2;
+ position: relative;
+ display: flex;
+}
+
+.content {
+ display: flex;
+ flex: 1;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.brand {
+ display: flex;
+ align-items: center;
+
+ &:hover {
+ text-decoration: none;
+ }
+}
+
+.brand-name {
+ @include font-size('regular');
+ color: #909090;
+ letter-spacing: 1px;
+ margin-left: rem(12px);
+ vertical-align: middle;
+}
+
+.logo {
+ margin: 0 auto;
+ display: none;
+
+ @include breakpoint(md) {
+ display: block;
+ }
+}
+
+.logosm {
+ @include breakpoint(md) {
+ display: none;
+ }
+}
+
+.cta {
+ @include font-size('small', false);
+
+ @include breakpoint(lg) {
+ @include font-size('regular', false);
+ }
+}
diff --git a/web/src/components/Header/Note/Guest.tsx b/web/src/components/Header/Note/Guest.tsx
new file mode 100644
index 00000000..7deeedf0
--- /dev/null
+++ b/web/src/components/Header/Note/Guest.tsx
@@ -0,0 +1,42 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { Link } from 'react-router-dom';
+
+import { getHomePath } from 'web/libs/paths';
+import LogoWithText from '../../Icons/LogoWithText';
+import styles from './Guest.scss';
+
+const UserNoteHeader: React.FunctionComponent = () => {
+ return (
+
+ );
+};
+
+export default UserNoteHeader;
diff --git a/web/src/components/Header/Note/Placeholder.scss b/web/src/components/Header/Note/Placeholder.scss
new file mode 100644
index 00000000..48bd6fe8
--- /dev/null
+++ b/web/src/components/Header/Note/Placeholder.scss
@@ -0,0 +1,30 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/variables';
+
+.wrapper {
+ background: $lighter-gray;
+ height: $header-height;
+ width: 100%;
+ position: relative;
+}
diff --git a/web/src/components/Header/Note/Placeholder.tsx b/web/src/components/Header/Note/Placeholder.tsx
new file mode 100644
index 00000000..bc3e9cb6
--- /dev/null
+++ b/web/src/components/Header/Note/Placeholder.tsx
@@ -0,0 +1,29 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import styles from './Placeholder.scss';
+
+interface Props {}
+
+const Placeholder: React.FunctionComponent = () => {
+ return
;
+};
+
+export default Placeholder;
diff --git a/web/src/components/Header/Note/index.scss b/web/src/components/Header/Note/index.scss
new file mode 100644
index 00000000..51508f84
--- /dev/null
+++ b/web/src/components/Header/Note/index.scss
@@ -0,0 +1,56 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/variables';
+
+.wrapper {
+ background: $lighter-gray;
+ padding: rem(12px) rem(20px);
+ height: $header-height;
+ z-index: 2;
+ position: relative;
+ display: flex;
+}
+
+.content {
+ display: flex;
+ flex: 1;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.brand {
+ display: flex;
+ align-items: center;
+
+ &:hover {
+ text-decoration: none;
+ }
+}
+
+.brand-name {
+ @include font-size('regular');
+ color: #909090;
+ letter-spacing: 1px;
+ margin-left: rem(12px);
+ vertical-align: middle;
+}
diff --git a/web/src/components/Header/Note/index.tsx b/web/src/components/Header/Note/index.tsx
new file mode 100644
index 00000000..4f5cbade
--- /dev/null
+++ b/web/src/components/Header/Note/index.tsx
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { useSelector } from '../../../store';
+
+import NormalHeader from '../Normal';
+import GuestHeader from './Guest';
+import Placeholder from './Placeholder';
+
+interface Props {}
+
+const NoteHeader: React.FunctionComponent = () => {
+ const { user } = useSelector(state => {
+ return {
+ user: state.auth.user
+ };
+ });
+
+ if (!user.isFetched) {
+ return ;
+ }
+
+ if (user.data.uuid === '') {
+ return ;
+ }
+
+ return ;
+};
+
+export default React.memo(NoteHeader);
diff --git a/web/src/components/Header/SearchBar/AdvancedPanel/AdvancedPanel.scss b/web/src/components/Header/SearchBar/AdvancedPanel/AdvancedPanel.scss
new file mode 100644
index 00000000..c27245f4
--- /dev/null
+++ b/web/src/components/Header/SearchBar/AdvancedPanel/AdvancedPanel.scss
@@ -0,0 +1,102 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../../App/responsive';
+@import '../../../App/theme';
+@import '../../../App/rem';
+@import '../../../App/font';
+@import '../../../App/variables';
+
+.wrapper {
+ background-color: $white;
+ border: 1px solid $border-color;
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.14);
+ border-radius: 0 0 4px 4px;
+ top: 100%;
+ left: 0;
+ right: 0;
+}
+
+.section {
+ & ~ & {
+ margin-top: rem(12px);
+ }
+}
+
+.label {
+ width: 100%;
+ font-weight: 600;
+ margin-bottom: 0;
+}
+
+.input {
+ margin-top: rem(4px);
+}
+
+.submit {
+ margin-top: rem(20px);
+}
+
+.form {
+ padding: rem(12px);
+}
+
+// book search
+.book-search--wrapper {
+ position: relative;
+}
+
+.book-suggestion-wrapper {
+ width: 100%;
+ z-index: 1;
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.14);
+ border: 1px solid $border-color;
+ border-radius: rem(4px);
+ display: none;
+
+ @include breakpoint(md) {
+ width: 50%;
+ }
+
+ &.book-suggestions-wrapper-shown {
+ display: block;
+ }
+}
+
+.book-suggestion {
+ background: white;
+ overflow-y: auto;
+ max-height: rem(220px);
+
+ @include landscape() {
+ max-height: rem(140px);
+ }
+}
+
+.book-item {
+}
+
+.book-item-button {
+ padding: rem(8px) rem(12px);
+ width: 100%;
+
+ &.book-item-focused,
+ &:hover {
+ background: $light-blue;
+ }
+}
diff --git a/web/src/components/Header/SearchBar/AdvancedPanel/BookSearch.tsx b/web/src/components/Header/SearchBar/AdvancedPanel/BookSearch.tsx
new file mode 100644
index 00000000..54137007
--- /dev/null
+++ b/web/src/components/Header/SearchBar/AdvancedPanel/BookSearch.tsx
@@ -0,0 +1,240 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useRef, useEffect } from 'react';
+import classnames from 'classnames';
+
+import { booksToOptions, filterOptions, Option } from 'jslib/helpers/select';
+import { usePrevious } from 'web/libs/hooks';
+import { useScrollToFocused, useSearchMenuKeydown } from 'web/libs/hooks/dom';
+import { useSelector } from '../../../../store';
+import PopoverContent from '../../../Common/Popover/PopoverContent';
+import styles from './AdvancedPanel.scss';
+
+interface Props {
+ value: string;
+ setValue: (string) => void;
+ disabled: boolean;
+}
+
+// getCurrentTerm returns the current term in the comma separated
+// value from the text input
+function getCurrentTerm(searchValue: string): string {
+ const parts = searchValue.split(',');
+ const last = parts[parts.length - 1];
+
+ return last.trim();
+}
+
+// getNewValue returns a new comma separated input string by appending the
+// given label to the current value
+function getNewValue(currentValue: string, label: string): string {
+ let ret = '';
+
+ const parts = currentValue.split(',');
+ for (let i = 0; i < parts.length - 1; i++) {
+ const p = parts[i].trim();
+
+ if (p !== '') {
+ ret += `${p}, `;
+ }
+ }
+
+ ret += `${label},`;
+
+ return ret;
+}
+
+// suggestionActiveRegex is the regex that matches the input value for which
+// book name suggestion should be active
+const suggestionActiveRegex = /.*,((?!,).)+$/;
+
+function shouldSuggestOptions(val: string): boolean {
+ if (val.trim() === '') {
+ return true;
+ }
+
+ return suggestionActiveRegex.test(val);
+}
+
+function useFilteredOptions(inputValue: string) {
+ const { books } = useSelector(state => {
+ return {
+ books: state.books.data
+ };
+ });
+
+ const options = booksToOptions(books);
+ const term = getCurrentTerm(inputValue);
+
+ return filterOptions(options, term, false);
+}
+
+function useSetSuggestionVisibility(
+ inputValue: string,
+ setIsOpen: (boolean) => void,
+ triggerRef: React.MutableRefObject
+) {
+ const prevInputValue = usePrevious(inputValue);
+
+ useEffect(() => {
+ const triggerEl = triggerRef.current;
+
+ if (
+ shouldSuggestOptions(inputValue) &&
+ document.activeElement === triggerEl
+ ) {
+ setIsOpen(true);
+ } else if (/.*,$/.test(inputValue)) {
+ setIsOpen(false);
+
+ // focus on the input and move the cursor to the end
+ if (triggerEl) {
+ triggerEl.focus();
+ triggerEl.selectionStart = triggerEl.value.length;
+ triggerEl.selectionEnd = triggerEl.value.length;
+ }
+ }
+ }, [setIsOpen, triggerRef, inputValue, prevInputValue]);
+}
+
+const BookSearch: React.FunctionComponent = ({
+ value,
+ setValue,
+ disabled
+}) => {
+ const [isOpen, setIsOpen] = useState(false);
+ const [focusedIdx, setFocusedIdx] = useState(0);
+ const [focusedOptEl, setFocusedOptEl] = useState(null);
+
+ const wrapperRef = useRef(null);
+ const triggerRef = useRef(null);
+ const listRef = useRef(null);
+
+ const filteredOptions = useFilteredOptions(value);
+
+ function appendBook(o: Option) {
+ const newVal = getNewValue(value, o.label);
+
+ setFocusedIdx(0);
+ setValue(newVal);
+ }
+
+ useSearchMenuKeydown({
+ options: filteredOptions,
+ containerEl: wrapperRef.current,
+ focusedIdx,
+ setFocusedIdx,
+ onKeydownSelect: appendBook,
+ disabled: !isOpen || disabled
+ });
+ useScrollToFocused({
+ shouldScroll: true,
+ focusedOptEl,
+ containerEl: listRef.current
+ });
+ useSetSuggestionVisibility(value, setIsOpen, triggerRef);
+
+ return (
+
+ );
+};
+
+export default BookSearch;
diff --git a/web/src/components/Header/SearchBar/AdvancedPanel/WordsSearch.tsx b/web/src/components/Header/SearchBar/AdvancedPanel/WordsSearch.tsx
new file mode 100644
index 00000000..a940edbf
--- /dev/null
+++ b/web/src/components/Header/SearchBar/AdvancedPanel/WordsSearch.tsx
@@ -0,0 +1,58 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import styles from './AdvancedPanel.scss';
+
+interface Props {
+ words: string;
+ setWords: (string) => void;
+ disabled: boolean;
+}
+
+const WordsSearch: React.FunctionComponent = ({
+ words,
+ setWords,
+ disabled
+}) => {
+ return (
+
+ );
+};
+
+export default WordsSearch;
diff --git a/web/src/components/Header/SearchBar/AdvancedPanel/index.tsx b/web/src/components/Header/SearchBar/AdvancedPanel/index.tsx
new file mode 100644
index 00000000..fb50ec1a
--- /dev/null
+++ b/web/src/components/Header/SearchBar/AdvancedPanel/index.tsx
@@ -0,0 +1,161 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useCallback } from 'react';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+
+import * as queriesLib from 'jslib/helpers/queries';
+import { getSearchDest } from 'web/libs/search';
+import { useFilters } from '../../../../store';
+import Button from '../../../Common/Button';
+import PopoverContent from '../../../Common/Popover/PopoverContent';
+import BookSearch from './BookSearch';
+import WordsSearch from './WordsSearch';
+import styles from './AdvancedPanel.scss';
+
+interface Props extends RouteComponentProps {
+ onDismiss: () => void;
+ disabled: boolean;
+}
+
+// quoteFilters surrounds a filter term with a pair of double quotation marks, effectively
+// making it a text term.
+function quoteFilters(s: string): string {
+ let ret = '';
+
+ const terms = s.split(' ');
+ for (let i = 0; i < terms.length; ++i) {
+ const term = terms[i];
+
+ if (i > 0) {
+ ret += ' ';
+ }
+
+ const parts = term.split(':');
+
+ if (parts.length === 2 && queriesLib.keywords.indexOf(parts[0]) > -1) {
+ ret += `"${term}"`;
+ } else {
+ ret += `${term}`;
+ }
+ }
+
+ return ret;
+}
+
+const quotedRegex = /"(.*)"/;
+
+// unquoteFilters removes surrounding double quotation marks for a valid filter term
+function unquoteFilters(s: string): string {
+ let ret = '';
+
+ const terms = s.split(' ');
+ for (let i = 0; i < terms.length; ++i) {
+ const term = terms[i];
+
+ if (i > 0) {
+ ret += ' ';
+ }
+
+ const matchGroup = term.match(quotedRegex);
+ if (matchGroup !== null) {
+ const match = matchGroup[1];
+ const parts = match.split(':');
+
+ if (parts.length === 2 && queriesLib.keywords.indexOf(parts[0]) > -1) {
+ ret += match;
+ }
+ } else {
+ ret += term;
+ }
+ }
+
+ return ret;
+}
+
+function encodeBookStr(s: string): string[] {
+ const ret = [];
+
+ const parts = s.split(',');
+ for (let i = 0; i < parts.length; i++) {
+ const p = parts[i];
+ const candidate = p.trim();
+
+ if (candidate !== '') {
+ ret.push(candidate);
+ }
+ }
+
+ return ret;
+}
+
+const AdvancedPanel: React.FunctionComponent = ({
+ onDismiss,
+ disabled,
+ history,
+ location
+}) => {
+ const filters = useFilters();
+ const { queries } = filters;
+
+ const [words, setWords] = useState(unquoteFilters(queries.q));
+ const [books, setBooks] = useState(queries.book.join(', '));
+
+ const handleSubmit = useCallback(() => {
+ const q: queriesLib.Queries = {
+ q: quoteFilters(words),
+ book: encodeBookStr(books)
+ };
+
+ const dest = getSearchDest(location, q);
+ history.push(dest);
+
+ onDismiss();
+ }, [history, onDismiss, location, words, books]);
+
+ return (
+
+
+
+
+
+
+
+ Search
+
+
+
+ );
+};
+
+export default withRouter(AdvancedPanel);
diff --git a/web/src/components/Header/SearchBar/SearchBar.scss b/web/src/components/Header/SearchBar/SearchBar.scss
new file mode 100644
index 00000000..5e8fba96
--- /dev/null
+++ b/web/src/components/Header/SearchBar/SearchBar.scss
@@ -0,0 +1,59 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/variables';
+
+.wrapper {
+ display: flex;
+ align-items: stretch;
+ width: 100%;
+ position: relative;
+
+ @include breakpoint(md) {
+ width: 88%;
+ }
+ @include breakpoint(lg) {
+ width: auto;
+ }
+}
+
+input.input {
+ width: 100%;
+
+ // Use custom breakpoint to optimize input width depending on the screen size
+ @media screen and (min-width: 1280px) {
+ width: rem(480px);
+ }
+}
+
+.input-wrapper {
+ width: 100%;
+}
+
+button.button {
+ border: 1px solid $border-color;
+ display: none;
+}
+
+.form {
+ width: 100%;
+}
diff --git a/web/src/components/Header/SearchBar/index.tsx b/web/src/components/Header/SearchBar/index.tsx
new file mode 100644
index 00000000..95607817
--- /dev/null
+++ b/web/src/components/Header/SearchBar/index.tsx
@@ -0,0 +1,122 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useRef, useCallback, useState, useEffect } from 'react';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+import classnames from 'classnames';
+
+import * as filtersLib from 'jslib/helpers/filters';
+import * as queriesLib from 'jslib/helpers/queries';
+import { getSearchDest } from 'web/libs/search';
+import { usePrevious } from 'web/libs/hooks';
+import { useFilters, useSelector } from '../../../store';
+import SearchInput from '../../Common/SearchInput';
+import AdvancedPanel from './AdvancedPanel';
+import styles from './SearchBar.scss';
+
+const searchDelay = 930;
+
+interface Props extends RouteComponentProps {}
+
+const SearchBar: React.FunctionComponent = ({ location, history }) => {
+ const searchTimerRef = useRef(null);
+ const filters = useFilters();
+
+ const initialValue = queriesLib.stringify(filters.queries);
+ const [value, setValue] = useState(initialValue);
+ const [expanded, setExpanded] = useState(false);
+
+ const handleSearch = useCallback(
+ (queryText: string) => {
+ const queries = queriesLib.parse(queryText);
+ const dest = getSearchDest(location, queries);
+ history.push(dest);
+ },
+ [history, location]
+ );
+
+ const prevFilters = usePrevious(filters);
+ useEffect(() => {
+ if (prevFilters && filtersLib.checkFilterEqual(filters, prevFilters)) {
+ return () => null;
+ }
+
+ const newVal = queriesLib.stringify(filters.queries);
+ setValue(newVal);
+
+ return () => null;
+ }, [prevFilters, filters]);
+
+ const onDismiss = () => {
+ setExpanded(false);
+ };
+
+ const { user } = useSelector(state => {
+ return {
+ user: state.auth.user.data
+ };
+ });
+
+ return (
+
+
{
+ e.preventDefault();
+
+ handleSearch(value);
+ }}
+ className={styles.form}
+ >
+ {
+ const val = e.target.value;
+ setValue(val);
+
+ if (searchTimerRef.current) {
+ window.clearTimeout(searchTimerRef.current);
+ }
+ searchTimerRef.current = window.setTimeout(() => {
+ handleSearch(val);
+ }, searchDelay);
+ }}
+ onReset={() => {
+ if (searchTimerRef.current) {
+ window.clearTimeout(searchTimerRef.current);
+ }
+
+ handleSearch('');
+ }}
+ expanded={expanded}
+ setExpanded={setExpanded}
+ />
+
+ Search
+
+
+
+ {expanded &&
}
+
+ );
+};
+
+export default withRouter(SearchBar);
diff --git a/web/src/components/Home/HeadData.tsx b/web/src/components/Home/HeadData.tsx
new file mode 100644
index 00000000..2260d182
--- /dev/null
+++ b/web/src/components/Home/HeadData.tsx
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import Helmet from 'react-helmet';
+
+import { Filters } from 'jslib/helpers/filters';
+
+interface Props {
+ filters: Filters;
+}
+
+function getTitle(filters: Filters): string {
+ if (filters.queries.book.length === 1) {
+ return `Notes in ${filters.queries.book}`;
+ }
+
+ return 'Notes';
+}
+
+const HeaderData: React.FunctionComponent = ({ filters }) => {
+ const title = getTitle(filters);
+
+ return (
+
+ {title}
+
+ );
+};
+
+export default HeaderData;
diff --git a/web/src/components/Home/Home.scss b/web/src/components/Home/Home.scss
new file mode 100644
index 00000000..517c050f
--- /dev/null
+++ b/web/src/components/Home/Home.scss
@@ -0,0 +1,24 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/rem';
+
+.toolbar {
+ text-align: right;
+}
diff --git a/web/src/components/Home/NoteGroup/Header.scss b/web/src/components/Home/NoteGroup/Header.scss
new file mode 100644
index 00000000..59a263ab
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/Header.scss
@@ -0,0 +1,40 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/rem';
+
+.wrapper {
+ @include font-size('small');
+ display: flex;
+ justify-content: space-between;
+ color: white;
+ padding: rem(12px) rem(16px);
+ background: $light;
+ color: $black;
+ border-bottom: 1px solid $border-color;
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+}
+
+.date {
+ font-weight: 600;
+ @include font-size('small');
+}
diff --git a/web/src/components/Home/NoteGroup/Header.tsx b/web/src/components/Home/NoteGroup/Header.tsx
new file mode 100644
index 00000000..f531ba5a
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/Header.tsx
@@ -0,0 +1,55 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { monthNumToFullName } from '../../../helpers/time';
+import styles from './Header.scss';
+
+interface Props {
+ year: number;
+ month: number;
+}
+
+function toDatetime(year: number, month: number) {
+ let monthStr;
+ if (month < 10) {
+ monthStr = `0${month}`;
+ } else {
+ monthStr = String(month);
+ }
+
+ return `${year}-${monthStr}`;
+}
+
+const Header: React.FunctionComponent = ({ year, month }) => {
+ const monthName = monthNumToFullName(month);
+ const datetime = toDatetime(year, month);
+
+ return (
+
+
+
+ {monthName} {year}
+
+
+
+ );
+};
+
+export default Header;
diff --git a/web/src/components/Home/NoteGroup/List.scss b/web/src/components/Home/NoteGroup/List.scss
new file mode 100644
index 00000000..d4646901
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/List.scss
@@ -0,0 +1,36 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/rem';
+
+.wrapper {
+ flex-grow: 1;
+
+ @include breakpoint(lg) {
+ margin-top: rem(16px);
+ }
+}
+
+.content {
+ padding: rem(40px) rem(16px);
+ text-align: center;
+ color: $gray;
+}
diff --git a/web/src/components/Home/NoteGroup/List.tsx b/web/src/components/Home/NoteGroup/List.tsx
new file mode 100644
index 00000000..0c378792
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/List.tsx
@@ -0,0 +1,76 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { Filters } from 'jslib/helpers/filters';
+import { NotesGroupData } from 'web/libs/notes';
+import NoteGroup from './index';
+import Placeholder from './Placeholder';
+import styles from './List.scss';
+
+function renderResult({
+ groups,
+ isFetched,
+ filters
+}: {
+ groups: NotesGroupData[];
+ isFetched: boolean;
+ filters: Filters;
+}) {
+ if (!isFetched) {
+ return ;
+ }
+
+ if (groups.length === 0) {
+ return No notes found.
;
+ }
+
+ return groups.map((group, idx) => {
+ const isFirst = idx === 0;
+
+ return (
+
+ );
+ });
+}
+
+interface Props {
+ isFetched: boolean;
+ groups: NotesGroupData[];
+ filters: Filters;
+}
+
+const NoteGroupList: React.FunctionComponent = ({
+ groups,
+ filters,
+ isFetched
+}) => {
+ return (
+
+ {renderResult({ groups, isFetched, filters })}
+
+ );
+};
+
+export default NoteGroupList;
diff --git a/web/src/components/Home/NoteGroup/NoteGroup.scss b/web/src/components/Home/NoteGroup/NoteGroup.scss
new file mode 100644
index 00000000..1d70bcc7
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/NoteGroup.scss
@@ -0,0 +1,74 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/rem';
+
+.wrapper {
+ position: relative;
+ border-radius: 4px;
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.14);
+
+ &:not(.first) {
+ margin-top: rem(20px);
+
+ @include breakpoint(md) {
+ margin-top: rem(24px);
+ }
+ }
+}
+
+.mask {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ background: white;
+ z-index: 1;
+ opacity: 0.8;
+}
+
+.header {
+ @include font-size('small');
+ display: flex;
+ justify-content: space-between;
+ color: white;
+ padding: rem(12px) rem(16px);
+ background: $light;
+ color: $black;
+ border-bottom: 1px solid $border-color;
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+}
+
+.header-date {
+ font-weight: 600;
+ @include font-size('regular');
+}
+.header-count {
+ font-weight: 300;
+}
+
+.list {
+ list-style: none;
+ padding-left: 0;
+ margin-bottom: 0;
+}
diff --git a/web/src/components/Home/NoteGroup/NoteItem.scss b/web/src/components/Home/NoteGroup/NoteItem.scss
new file mode 100644
index 00000000..cf2d3f22
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/NoteItem.scss
@@ -0,0 +1,89 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/font';
+@import '../../App/responsive';
+@import '../../App/rem';
+@import '../../App/theme';
+
+.wrapper {
+ background: white;
+ position: relative;
+
+ border-bottom: 1px solid $border-color;
+}
+
+.link {
+ color: $black;
+ display: block;
+ padding: rem(12px) rem(16px);
+ border: 2px solid transparent;
+
+ &:hover {
+ text-decoration: none;
+ background: $light-blue;
+ color: inherit;
+ }
+}
+
+.meta {
+ line-height: rem(16px);
+}
+
+.ts {
+ color: $gray;
+ @include font-size('small');
+}
+
+.body {
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.header {
+ display: flex;
+ justify-content: space-between;
+}
+
+.content {
+ margin-top: rem(12px);
+ line-height: 1.6rem;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ color: $gray;
+}
+
+.book-label {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-weight: 700;
+ @include font-size('small');
+
+ width: 212px;
+
+ @include breakpoint('md') {
+ width: 320px;
+ }
+}
+
+.match {
+ display: inline-block;
+ background: #f7f77d;
+ padding: rem(4px) rem(4px);
+}
diff --git a/web/src/components/Home/NoteGroup/NoteItem.tsx b/web/src/components/Home/NoteGroup/NoteItem.tsx
new file mode 100644
index 00000000..52eb221a
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/NoteItem.tsx
@@ -0,0 +1,104 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { Link } from 'react-router-dom';
+import classnames from 'classnames';
+
+import { getNotePath } from 'web/libs/paths';
+import { tokenize, TokenKind } from 'web/libs/fts/lexer';
+import { NoteData } from 'jslib/operations/types';
+import { excerpt } from 'web/libs/string';
+import { Filters } from 'jslib/helpers/filters';
+import { timeAgo } from '../../../helpers/time';
+import Time from '../../Common/Time';
+import styles from './NoteItem.scss';
+
+function formatFTSSnippet(content: string): React.ReactNode[] {
+ const tokens = tokenize(content);
+
+ const output: React.ReactNode[] = [];
+ let buf = [];
+
+ for (let i = 0; i < tokens.length; i++) {
+ const t = tokens[i];
+
+ if (t.kind === TokenKind.hlBegin || t.kind === TokenKind.eol) {
+ output.push(buf.join(''));
+
+ buf = [];
+ } else if (t.kind === TokenKind.hlEnd) {
+ const comp = (
+
+ {buf.join('')}
+
+ );
+ output.push(comp);
+
+ buf = [];
+ } else {
+ buf.push(t.value);
+ }
+ }
+
+ return output;
+}
+
+function renderContent(content: string): React.ReactNode[] {
+ if (content.indexOf('') > -1) {
+ return formatFTSSnippet(content);
+ }
+
+ return excerpt(content, 160);
+}
+
+interface Props {
+ note: NoteData;
+ filters: Filters;
+}
+
+const NoteItem: React.FunctionComponent = ({ note, filters }) => {
+ const updatedAt = new Date(note.updatedAt).getTime();
+
+ return (
+
+
+
+
+
{note.book.label}
+
+
+
+
{renderContent(note.content)}
+
+
+
+ );
+};
+
+export default NoteItem;
diff --git a/web/src/components/Home/NoteGroup/Placeholder.scss b/web/src/components/Home/NoteGroup/Placeholder.scss
new file mode 100644
index 00000000..6a007f56
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/Placeholder.scss
@@ -0,0 +1,76 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/responsive';
+@import '../../App/font';
+@import '../../App/theme';
+@import '../../App/rem';
+
+.note-wrapper {
+ background: white;
+ height: rem(96px);
+ position: relative;
+ border-bottom: 1px solid #cecece;
+
+ .book {
+ position: absolute;
+ top: 19px;
+ left: 20px;
+ height: 14px;
+ width: 120px;
+ }
+
+ .ts {
+ position: absolute;
+ top: 36px;
+ left: 20px;
+ height: 14px;
+ width: 100px;
+ }
+
+ .content {
+ position: absolute;
+ top: 58px;
+ left: 20px;
+ height: 15px;
+ width: 50%;
+
+ @include breakpoint(lg) {
+ width: 200px;
+ right: auto;
+ }
+ }
+}
+
+.header-wrapper {
+ background: $light;
+ height: rem(46px);
+ position: relative;
+ border-bottom: 1px solid $border-color;
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+
+ .heading {
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ left: 20px;
+ height: 15px;
+ width: 100px;
+ }
+}
diff --git a/web/src/components/Home/NoteGroup/Placeholder.tsx b/web/src/components/Home/NoteGroup/Placeholder.tsx
new file mode 100644
index 00000000..c70f8a57
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/Placeholder.tsx
@@ -0,0 +1,58 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { Fragment } from 'react';
+import classnames from 'classnames';
+
+import styles from './Placeholder.scss';
+
+const NoteHolder = () => {
+ return (
+
+ );
+};
+
+const HeaderHolder = () => {
+ return (
+
+ );
+};
+
+const Placeholder: React.FunctionComponent = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default Placeholder;
diff --git a/web/src/components/Home/NoteGroup/index.tsx b/web/src/components/Home/NoteGroup/index.tsx
new file mode 100644
index 00000000..603c36c2
--- /dev/null
+++ b/web/src/components/Home/NoteGroup/index.tsx
@@ -0,0 +1,60 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import { NotesGroupData } from 'web/libs/notes';
+import { Filters } from 'jslib/helpers/filters';
+import NoteItem from './NoteItem';
+import Header from './Header';
+import styles from './NoteGroup.scss';
+
+function renderItems(group: NotesGroupData, filters: Filters) {
+ return group.data.map(item => {
+ return ;
+ });
+}
+
+interface Props {
+ group: NotesGroupData;
+ isFirst: boolean;
+ filters: Filters;
+}
+
+const NoteGroup: React.FunctionComponent = ({
+ group,
+ isFirst,
+ filters
+}) => {
+ const { year, month } = group;
+
+ return (
+
+
+
+
+ {renderItems(group, filters)}
+
+
+ );
+};
+
+export default NoteGroup;
diff --git a/web/src/components/Home/index.tsx b/web/src/components/Home/index.tsx
new file mode 100644
index 00000000..a1b5a7e9
--- /dev/null
+++ b/web/src/components/Home/index.tsx
@@ -0,0 +1,117 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect } from 'react';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+
+import { usePrevious } from 'web/libs/hooks';
+import { groupNotes } from 'web/libs/notes';
+import {
+ getFiltersFromSearchStr,
+ Filters,
+ checkFilterEqual
+} from 'jslib/helpers/filters';
+import { getHomePath } from 'web/libs/paths';
+import NoteGroupList from './NoteGroup/List';
+import HeadData from './HeadData';
+import { useDispatch, useSelector } from '../../store';
+import { getNotes } from '../../store/notes';
+import PageToolbar from '../Common/PageToolbar';
+import Paginator from '../Common/PageToolbar/Paginator';
+import Flash from '../Common/Flash';
+import PayWall from '../Common/PayWall';
+import styles from './Home.scss';
+
+// PER_PAGE is the number of results per page in the response from the backend implementation's API.
+// Currently it is fixed.
+const PER_PAGE = 30;
+
+interface Props extends RouteComponentProps {}
+
+function useFetchNotes(filters: Filters) {
+ const dispatch = useDispatch();
+ const { user } = useSelector(state => {
+ return {
+ user: state.auth.user.data,
+ notes: state.notes
+ };
+ });
+ const prevFilters = usePrevious(filters);
+
+ useEffect(() => {
+ if (prevFilters && checkFilterEqual(filters, prevFilters)) {
+ return () => null;
+ }
+
+ dispatch(getNotes(filters));
+
+ return () => null;
+ }, [dispatch, filters, prevFilters, user]);
+}
+
+const Home: React.FunctionComponent = ({ location }) => {
+ const { notes } = useSelector(state => {
+ return {
+ notes: state.notes
+ };
+ });
+
+ const filters = getFiltersFromSearchStr(location.search);
+ useFetchNotes(filters);
+
+ const groups = groupNotes(notes.data);
+
+ return (
+
+
+
+
Notes
+
+
+ Error getting notes: {notes.errorMessage}
+
+
+
+ {
+ return getHomePath({
+ ...filters.queries,
+ page
+ });
+ }}
+ />
+
+
+
+
+
+
+ );
+};
+
+export default withRouter(Home);
diff --git a/web/src/components/Icons/Arrow.js b/web/src/components/Icons/Arrow.js
new file mode 100644
index 00000000..5d15b22d
--- /dev/null
+++ b/web/src/components/Icons/Arrow.js
@@ -0,0 +1,47 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Atom.js b/web/src/components/Icons/Atom.js
new file mode 100644
index 00000000..adba58b2
--- /dev/null
+++ b/web/src/components/Icons/Atom.js
@@ -0,0 +1,64 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 131,
+ height: 120
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Book.tsx b/web/src/components/Icons/Book.tsx
new file mode 100644
index 00000000..89138569
--- /dev/null
+++ b/web/src/components/Icons/Book.tsx
@@ -0,0 +1,53 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+ Book
+ Icon depicting a book
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000101',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/BookPlus.tsx b/web/src/components/Icons/BookPlus.tsx
new file mode 100644
index 00000000..f98d1b63
--- /dev/null
+++ b/web/src/components/Icons/BookPlus.tsx
@@ -0,0 +1,84 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+interface Props extends IconProps {
+ id: string;
+}
+
+const Icon = ({ fill, width, height, className, id }: Props) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+ const clipPathId = `${id}-clip0`;
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000101',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Books.js b/web/src/components/Icons/Books.js
new file mode 100644
index 00000000..37a9f151
--- /dev/null
+++ b/web/src/components/Icons/Books.js
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Box.tsx b/web/src/components/Icons/Box.tsx
new file mode 100644
index 00000000..6a2d506c
--- /dev/null
+++ b/web/src/components/Icons/Box.tsx
@@ -0,0 +1,74 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+/*
+MIT License
+
+Copyright (c) 2019 GitHub Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+import React from 'react';
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Caret.tsx b/web/src/components/Icons/Caret.tsx
new file mode 100644
index 00000000..729e9605
--- /dev/null
+++ b/web/src/components/Icons/Caret.tsx
@@ -0,0 +1,60 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#a2a2a2',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/CaretSolid.tsx b/web/src/components/Icons/CaretSolid.tsx
new file mode 100644
index 00000000..ef2a2ad6
--- /dev/null
+++ b/web/src/components/Icons/CaretSolid.tsx
@@ -0,0 +1,45 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#231F20',
+ width: 12,
+ height: 8
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Check.js b/web/src/components/Icons/Check.js
new file mode 100644
index 00000000..5482a8dc
--- /dev/null
+++ b/web/src/components/Icons/Check.js
@@ -0,0 +1,53 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 18,
+ height: 15
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/CheckCircle.tsx b/web/src/components/Icons/CheckCircle.tsx
new file mode 100644
index 00000000..99c0d0b4
--- /dev/null
+++ b/web/src/components/Icons/CheckCircle.tsx
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#0FA040',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Chrome.js b/web/src/components/Icons/Chrome.js
new file mode 100644
index 00000000..ee73be3f
--- /dev/null
+++ b/web/src/components/Icons/Chrome.js
@@ -0,0 +1,52 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 64,
+ height: 64
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Close.tsx b/web/src/components/Icons/Close.tsx
new file mode 100644
index 00000000..b940b84d
--- /dev/null
+++ b/web/src/components/Icons/Close.tsx
@@ -0,0 +1,42 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+const Icon = ({ width, height, className, fill }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Cloud.js b/web/src/components/Icons/Cloud.js
new file mode 100644
index 00000000..28a70333
--- /dev/null
+++ b/web/src/components/Icons/Cloud.js
@@ -0,0 +1,51 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+export default () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/web/src/components/Icons/CreditCard.js b/web/src/components/Icons/CreditCard.js
new file mode 100644
index 00000000..3e94e6e7
--- /dev/null
+++ b/web/src/components/Icons/CreditCard.js
@@ -0,0 +1,47 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Dashboard.tsx b/web/src/components/Icons/Dashboard.tsx
new file mode 100644
index 00000000..c5e22d1f
--- /dev/null
+++ b/web/src/components/Icons/Dashboard.tsx
@@ -0,0 +1,44 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Dots.tsx b/web/src/components/Icons/Dots.tsx
new file mode 100644
index 00000000..8e723df8
--- /dev/null
+++ b/web/src/components/Icons/Dots.tsx
@@ -0,0 +1,48 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#2F3435',
+ width: 20,
+ height: 4
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Email.js b/web/src/components/Icons/Email.js
new file mode 100644
index 00000000..4cf375d0
--- /dev/null
+++ b/web/src/components/Icons/Email.js
@@ -0,0 +1,44 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Firefox.js b/web/src/components/Icons/Firefox.js
new file mode 100644
index 00000000..6c1ea008
--- /dev/null
+++ b/web/src/components/Icons/Firefox.js
@@ -0,0 +1,78 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 64,
+ height: 64
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Globe.tsx b/web/src/components/Icons/Globe.tsx
new file mode 100644
index 00000000..b5784753
--- /dev/null
+++ b/web/src/components/Icons/Globe.tsx
@@ -0,0 +1,81 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+/*
+MIT License
+
+Copyright (c) 2019 GitHub Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+interface Props extends IconProps {
+ ariaLabel?: string;
+}
+
+const Icon = ({ fill, width, height, className, ariaLabel }: Props) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Home.tsx b/web/src/components/Icons/Home.tsx
new file mode 100644
index 00000000..73e88894
--- /dev/null
+++ b/web/src/components/Icons/Home.tsx
@@ -0,0 +1,58 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#2a2a2a',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Link.js b/web/src/components/Icons/Link.js
new file mode 100644
index 00000000..6a25b041
--- /dev/null
+++ b/web/src/components/Icons/Link.js
@@ -0,0 +1,65 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ className, width, height }) => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ width: 16,
+ height: 16
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Loading.js b/web/src/components/Icons/Loading.js
new file mode 100644
index 00000000..a5be9a97
--- /dev/null
+++ b/web/src/components/Icons/Loading.js
@@ -0,0 +1,72 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#a1a1a1',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Lock.js b/web/src/components/Icons/Lock.js
new file mode 100644
index 00000000..78c839e2
--- /dev/null
+++ b/web/src/components/Icons/Lock.js
@@ -0,0 +1,43 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ width, height }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Logo.tsx b/web/src/components/Icons/Logo.tsx
new file mode 100644
index 00000000..96baf588
--- /dev/null
+++ b/web/src/components/Icons/Logo.tsx
@@ -0,0 +1,49 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#2a2a2a',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/LogoWithText.tsx b/web/src/components/Icons/LogoWithText.tsx
new file mode 100644
index 00000000..5e4c8d39
--- /dev/null
+++ b/web/src/components/Icons/LogoWithText.tsx
@@ -0,0 +1,67 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+interface Props extends IconProps {
+ id: string;
+}
+
+const aspectRatio = 3.5;
+
+const Icon = ({ width, className, fill, id }: Props) => {
+ const height = width / aspectRatio;
+ const clipPathId = `${id}-clip0`;
+
+ return (
+
+ Dnote logo
+ Dnote logo
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#2a2a2a',
+ width: 91
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Menu.js b/web/src/components/Icons/Menu.js
new file mode 100644
index 00000000..0889b3d2
--- /dev/null
+++ b/web/src/components/Icons/Menu.js
@@ -0,0 +1,42 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#686868',
+ width: 50,
+ height: 50
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Note.tsx b/web/src/components/Icons/Note.tsx
new file mode 100644
index 00000000..bf53ec71
--- /dev/null
+++ b/web/src/components/Icons/Note.tsx
@@ -0,0 +1,57 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+interface Props extends IconProps {
+ id: string;
+}
+
+const Icon = ({ fill, width, height, id }: Props) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+ const clipPathId = `${id}-clip0`;
+
+ return (
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000101',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Search.tsx b/web/src/components/Icons/Search.tsx
new file mode 100644
index 00000000..db603bf7
--- /dev/null
+++ b/web/src/components/Icons/Search.tsx
@@ -0,0 +1,43 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+const Icon = ({ width, height, className, fill }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ width: 32,
+ height: 32,
+ fill: '#f3f3f3'
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Server.tsx b/web/src/components/Icons/Server.tsx
new file mode 100644
index 00000000..8b788dd0
--- /dev/null
+++ b/web/src/components/Icons/Server.tsx
@@ -0,0 +1,75 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+/*
+MIT License
+
+Copyright (c) 2019 GitHub Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Spinner.js b/web/src/components/Icons/Spinner.js
new file mode 100644
index 00000000..50ea3aba
--- /dev/null
+++ b/web/src/components/Icons/Spinner.js
@@ -0,0 +1,228 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ width, height, className, fill }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ width: 25,
+ height: 25,
+ fill: '#28292f'
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Terminal.js b/web/src/components/Icons/Terminal.js
new file mode 100644
index 00000000..16b9e894
--- /dev/null
+++ b/web/src/components/Icons/Terminal.js
@@ -0,0 +1,47 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 14,
+ height: 16
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Trash.tsx b/web/src/components/Icons/Trash.tsx
new file mode 100644
index 00000000..f22926d2
--- /dev/null
+++ b/web/src/components/Icons/Trash.tsx
@@ -0,0 +1,52 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000101',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Unlink.js b/web/src/components/Icons/Unlink.js
new file mode 100644
index 00000000..b70e22f3
--- /dev/null
+++ b/web/src/components/Icons/Unlink.js
@@ -0,0 +1,114 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ className, width, height }) => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ width: 16,
+ height: 16
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/User.tsx b/web/src/components/Icons/User.tsx
new file mode 100644
index 00000000..32ba37a8
--- /dev/null
+++ b/web/src/components/Icons/User.tsx
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import { IconProps } from './types';
+
+const Icon = ({ fill, width, height, className }: IconProps) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 32,
+ height: 32
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Users.js b/web/src/components/Icons/Users.js
new file mode 100644
index 00000000..214e1789
--- /dev/null
+++ b/web/src/components/Icons/Users.js
@@ -0,0 +1,50 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ className }) => {
+ return (
+
+
+
+
+
+ );
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/Web.js b/web/src/components/Icons/Web.js
new file mode 100644
index 00000000..d4a53f88
--- /dev/null
+++ b/web/src/components/Icons/Web.js
@@ -0,0 +1,54 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+const Icon = ({ fill, width, height, className }) => {
+ const h = `${height}px`;
+ const w = `${width}px`;
+
+ return (
+
+
+
+
+
+
+
+
+
+ );
+};
+
+Icon.defaultProps = {
+ fill: '#000',
+ width: 64,
+ height: 64
+};
+
+export default Icon;
diff --git a/web/src/components/Icons/types.ts b/web/src/components/Icons/types.ts
new file mode 100644
index 00000000..4241f9a7
--- /dev/null
+++ b/web/src/components/Icons/types.ts
@@ -0,0 +1,25 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// IconProps is the common props that icon components receive.
+export interface IconProps {
+ fill?: string;
+ width?: number;
+ height?: number;
+ className?: string;
+}
diff --git a/web/src/components/Join/JoinForm.tsx b/web/src/components/Join/JoinForm.tsx
new file mode 100644
index 00000000..942b54d9
--- /dev/null
+++ b/web/src/components/Join/JoinForm.tsx
@@ -0,0 +1,131 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+
+import Button from '../Common/Button';
+import { useDispatch } from '../../store';
+import { updateAuthEmail } from '../../store/form';
+import authStyles from '../Common/Auth.scss';
+
+interface Props {
+ onJoin: (
+ email: string,
+ password: string,
+ passwordConfirmation: string
+ ) => void;
+ submitting: boolean;
+ email?: string;
+ cta?: string;
+}
+
+const JoinForm: React.FunctionComponent = ({
+ onJoin,
+ submitting,
+ email,
+ cta = 'Join'
+}) => {
+ const [password, setPassword] = useState('');
+ const [passwordConfirmation, setPasswordConfirmation] = useState('');
+ const dispatch = useDispatch();
+
+ return (
+ {
+ e.preventDefault();
+
+ onJoin(email, password, passwordConfirmation);
+ }}
+ id="T-join-form"
+ className={authStyles.form}
+ >
+ {email !== undefined && (
+
+
+ Your email
+ {
+ const val = e.target.value;
+
+ dispatch(updateAuthEmail(val));
+ }}
+ />
+
+
+ )}
+
+
+
+ Password
+ {
+ const val = e.target.value;
+
+ setPassword(val);
+ }}
+ />
+
+
+
+
+
+ Password confirmation
+ {
+ const val = e.target.value;
+
+ setPasswordConfirmation(val);
+ }}
+ />
+
+
+
+
+ {cta}
+
+
+ );
+};
+
+export default JoinForm;
diff --git a/web/src/components/Join/index.tsx b/web/src/components/Join/index.tsx
new file mode 100644
index 00000000..719abbcf
--- /dev/null
+++ b/web/src/components/Join/index.tsx
@@ -0,0 +1,122 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import Helmet from 'react-helmet';
+import { Link, RouteComponentProps } from 'react-router-dom';
+
+import services from 'web/libs/services';
+import { getReferrer } from 'jslib/helpers/url';
+import { getRootUrl } from 'web/libs/paths';
+import JoinForm from './JoinForm';
+import Logo from '../Icons/Logo';
+import Flash from '../Common/Flash';
+import { updateAuthEmail } from '../../store/form';
+import { getCurrentUser } from '../../store/auth';
+import authStyles from '../Common/Auth.scss';
+import { useSelector, useDispatch } from '../../store';
+
+interface Props extends RouteComponentProps {}
+
+const Join: React.FunctionComponent = ({ location }) => {
+ const [errMsg, setErrMsg] = useState('');
+ const [submitting, setSubmitting] = useState(false);
+ const { formData } = useSelector(state => {
+ return {
+ formData: state.form
+ };
+ });
+ const dispatch = useDispatch();
+
+ const referrer = getReferrer(location);
+
+ async function handleJoin(email, password, passwordConfirmation) {
+ if (!email) {
+ setErrMsg('Please enter an email.');
+ return;
+ }
+ if (!password) {
+ setErrMsg('Please enter a pasasword.');
+ return;
+ }
+ if (!passwordConfirmation) {
+ setErrMsg('The passwords do not match.');
+ return;
+ }
+
+ setErrMsg('');
+ setSubmitting(true);
+
+ try {
+ await services.users.register({ email, password });
+
+ // guestOnly HOC will redirect the user accordingly after the current user is fetched
+ await dispatch(getCurrentUser());
+ dispatch(updateAuthEmail(''));
+ } catch (err) {
+ console.log(err);
+ setErrMsg(err.message);
+ setSubmitting(false);
+ }
+ }
+
+ return (
+
+
+ Join
+
+
+
+
+
+
Join Dnote
+
+
+ {referrer && (
+
+ Please join to continue.
+
+ )}
+
+
+ {errMsg && (
+
+ {errMsg}
+
+ )}
+
+
+
+
+
+
Already have an account?
+
+ Sign in
+
+
+
+
+
+ );
+};
+
+export default Join;
diff --git a/web/src/components/Login/LoginForm.tsx b/web/src/components/Login/LoginForm.tsx
new file mode 100644
index 00000000..8a95da26
--- /dev/null
+++ b/web/src/components/Login/LoginForm.tsx
@@ -0,0 +1,109 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import { Link } from 'react-router-dom';
+
+import { getPasswordResetRequestPath } from 'web/libs/paths';
+import styles from '../Common/Auth.scss';
+import Button from '../Common/Button';
+
+interface Props {
+ email: string;
+ submitting: boolean;
+ onLogin: (email: string, password: string) => void;
+ onUpdateEmail: (string) => void;
+}
+
+const LoginForm: React.FunctionComponent = ({
+ onLogin,
+ submitting,
+ email,
+ onUpdateEmail
+}) => {
+ const [password, setPassword] = useState('');
+
+ return (
+ {
+ e.preventDefault();
+
+ onLogin(email, password);
+ }}
+ id="T-login-form"
+ className={styles.form}
+ >
+
+
+ Email
+ {
+ const val = e.target.value;
+
+ onUpdateEmail(val);
+ }}
+ autoComplete="on"
+ autoFocus
+ />
+
+
+
+
+
+ Password
+
+ Forgot?
+
+ {
+ const val = e.target.value;
+
+ setPassword(val);
+ }}
+ />
+
+
+
+
+ Sign in
+
+
+ );
+};
+
+export default LoginForm;
diff --git a/web/src/components/Login/index.tsx b/web/src/components/Login/index.tsx
new file mode 100644
index 00000000..ce3d7bcc
--- /dev/null
+++ b/web/src/components/Login/index.tsx
@@ -0,0 +1,128 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import Helmet from 'react-helmet';
+import { Link, RouteComponentProps } from 'react-router-dom';
+
+import { getReferrer } from 'jslib/helpers/url';
+import { getRootUrl } from 'web/libs/paths';
+import services from 'web/libs/services';
+import LoginForm from './LoginForm';
+import Logo from '../Icons/Logo';
+import Flash from '../Common/Flash';
+import { getCurrentUser } from '../../store/auth';
+import { updateAuthEmail } from '../../store/form';
+import authStyles from '../Common/Auth.scss';
+import { useSelector, useDispatch } from '../../store';
+
+interface Props extends RouteComponentProps {}
+
+const Login: React.FunctionComponent = ({ location }) => {
+ const [errMsg, setErrMsg] = useState('');
+ const [submitting, setSubmitting] = useState(false);
+ const dispatch = useDispatch();
+ const { formData } = useSelector(state => {
+ return {
+ formData: state.form
+ };
+ });
+
+ async function handleLogin(email, password) {
+ if (!email) {
+ setErrMsg('Please enter email');
+ return;
+ }
+ if (!password) {
+ setErrMsg('Please enter password');
+ return;
+ }
+
+ setErrMsg('');
+ setSubmitting(true);
+
+ try {
+ await services.users.signin({ email, password });
+
+ // guestOnly HOC will redirect the user accordingly after the current user is fetched
+ await dispatch(getCurrentUser());
+ dispatch(updateAuthEmail(''));
+ } catch (err) {
+ console.log(err);
+ setErrMsg(err.message);
+ setSubmitting(false);
+ }
+ }
+ const referrer = getReferrer(location);
+
+ return (
+
+
+ Sign In
+
+
+
+
+
+
Sign in to Dnote
+
+
+ {referrer && (
+
+ Please sign in to continue to that page.
+
+ )}
+
+
+ {errMsg && (
+
+ {errMsg}
+
+ )}
+
+ {
+ dispatch(updateAuthEmail(val));
+ }}
+ />
+
+
+
+
Don't have an account?
+
+ Create account
+
+
+
+
+
+ );
+};
+
+export default Login;
diff --git a/web/src/components/New/Content.tsx b/web/src/components/New/Content.tsx
new file mode 100644
index 00000000..1445fc06
--- /dev/null
+++ b/web/src/components/New/Content.tsx
@@ -0,0 +1,143 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import React, { Fragment, useEffect, useRef, useState } from 'react';
+import { Prompt, RouteComponentProps, withRouter } from 'react-router-dom';
+import { focusTextarea } from 'web/libs/dom';
+import { useFocus } from 'web/libs/hooks/dom';
+import operations from 'web/libs/operations';
+import { getNotePath, notePathDef } from 'web/libs/paths';
+import { useDispatch } from '../../store';
+import { createBook } from '../../store/books';
+import { EditorSession, resetEditor } from '../../store/editor';
+import { setMessage } from '../../store/ui';
+import Editor from '../Common/Editor';
+import Flash from '../Common/Flash';
+import styles from './New.scss';
+
+interface Props extends RouteComponentProps {
+ editor: EditorSession;
+ persisted: boolean;
+}
+
+// useInitFocus initializes the focus on HTML elements depending on the current
+// state of the editor.
+function useInitFocus({ bookLabel, content, textareaRef, setTriggerFocus }) {
+ useEffect(() => {
+ if (!bookLabel && !content) {
+ setTriggerFocus();
+ } else {
+ const textareaEl = textareaRef.current;
+
+ if (textareaEl && document.activeElement !== textareaEl) {
+ focusTextarea(textareaEl);
+ }
+ }
+ }, [setTriggerFocus, bookLabel, textareaRef, content]);
+}
+
+const New: React.FunctionComponent = ({
+ editor,
+ persisted,
+ history
+}) => {
+ const dispatch = useDispatch();
+ const [errMessage, setErrMessage] = useState('');
+ const [submitting, setSubmitting] = useState(false);
+ const textareaRef = useRef(null);
+ const [setTriggerFocus, triggerRef] = useFocus();
+
+ useInitFocus({
+ bookLabel: editor.bookLabel,
+ content: editor.content,
+ textareaRef,
+ setTriggerFocus
+ });
+
+ return (
+
+
+
+ Error: {errMessage}
+
+
+
+
+
New notes
+
+
+
{
+ setSubmitting(true);
+
+ try {
+ let bookUUID;
+
+ if (!draftBookUUID) {
+ const book = await dispatch(createBook(editor.bookLabel));
+ bookUUID = book.uuid;
+ } else {
+ bookUUID = draftBookUUID;
+ }
+
+ const res = await operations.notes.create({
+ bookUUID,
+ content: draftContent
+ });
+
+ dispatch(resetEditor(editor.sessionKey));
+
+ const dest = getNotePath(res.result.uuid);
+ history.push(dest);
+
+ dispatch(
+ setMessage({
+ message: 'Created a note',
+ kind: 'info',
+ path: notePathDef
+ })
+ );
+ } catch (err) {
+ setErrMessage(err.message);
+ setSubmitting(false);
+ }
+ }}
+ />
+
+
+
+
+
+ );
+};
+
+export default React.memo(withRouter(New));
diff --git a/web/src/components/New/New.scss b/web/src/components/New/New.scss
new file mode 100644
index 00000000..04f55fff
--- /dev/null
+++ b/web/src/components/New/New.scss
@@ -0,0 +1,62 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/theme';
+@import '../App/font';
+@import '../App/responsive';
+@import '../App/rem';
+
+$border-radius: rem(4px);
+
+.container {
+ min-height: inherit;
+
+ @include breakpoint(lg) {
+ min-height: initial;
+ }
+}
+
+.wrapper {
+ display: flex;
+ flex-direction: column;
+
+ position: relative;
+ background: $white;
+ min-height: rem(500px);
+ border-radius: $border-radius;
+ min-height: inherit;
+
+ @include breakpoint(md) {
+ border: 1px solid $border-color;
+ }
+}
+
+.header {
+ padding: rem(16px) rem(20px);
+ border-top-left-radius: $border-radius;
+ border-top-right-radius: $border-radius;
+
+ @include breakpoint(lg) {
+ background-color: #f7f9fa;
+ border-bottom: 1px solid $border-color;
+ }
+}
+
+.heading {
+ @include font-size('regular');
+}
diff --git a/web/src/components/New/index.tsx b/web/src/components/New/index.tsx
new file mode 100644
index 00000000..80dd5e0e
--- /dev/null
+++ b/web/src/components/New/index.tsx
@@ -0,0 +1,70 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { Fragment, useEffect } from 'react';
+import Helmet from 'react-helmet';
+import { RouteComponentProps, withRouter } from 'react-router-dom';
+import { getEditorSessionkey } from 'web/libs/editor';
+import { useDispatch, useSelector } from '../../store';
+import { createSession } from '../../store/editor';
+import PayWall from '../Common/PayWall';
+import Content from './Content';
+
+interface Props extends RouteComponentProps {}
+
+const New: React.FunctionComponent = () => {
+ const sessionKey = getEditorSessionkey(null);
+ const { editor } = useSelector(state => {
+ return {
+ editor: state.editor
+ };
+ });
+
+ const session = editor.sessions[sessionKey];
+
+ const dispatch = useDispatch();
+ useEffect(() => {
+ // if there is no editorSesssion session, create one
+ if (session === undefined) {
+ dispatch(
+ createSession({
+ noteUUID: null,
+ bookUUID: null,
+ bookLabel: null,
+ content: ''
+ })
+ );
+ }
+ }, [dispatch, session]);
+
+ return (
+
+
+ New
+
+
+ {session !== undefined && (
+
+
+
+ )}
+
+ );
+};
+
+export default React.memo(withRouter(New));
diff --git a/web/src/components/Note/DeleteModal.scss b/web/src/components/Note/DeleteModal.scss
new file mode 100644
index 00000000..4d3cd9fa
--- /dev/null
+++ b/web/src/components/Note/DeleteModal.scss
@@ -0,0 +1,27 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/responsive';
+@import '../App/theme';
+
+.actions {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: rem(8px);
+}
diff --git a/web/src/components/Note/DeleteModal.tsx b/web/src/components/Note/DeleteModal.tsx
new file mode 100644
index 00000000..0204a4d4
--- /dev/null
+++ b/web/src/components/Note/DeleteModal.tsx
@@ -0,0 +1,139 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+
+import { homePathDef, getHomePath } from 'web/libs/paths';
+import operations from 'web/libs/operations';
+import Modal, { Header, Body } from '../Common/Modal';
+import Flash from '../Common/Flash';
+import { setMessage } from '../../store/ui';
+import { useDispatch } from '../../store';
+import Button from '../Common/Button';
+import styles from './DeleteModal.scss';
+
+interface Props extends RouteComponentProps {
+ isOpen: boolean;
+ onDismiss: () => void;
+ noteUUID: string;
+}
+
+const DeleteModal: React.FunctionComponent = ({
+ isOpen,
+ onDismiss,
+ noteUUID,
+ history
+}) => {
+ const [inProgress, setInProgress] = useState(false);
+ const [errMessage, setErrMessage] = useState('');
+ const dispatch = useDispatch();
+
+ const labelId = 'delete-note-modal-label';
+ const descId = 'delete-note-modal-desc';
+
+ return (
+
+
+
+ {
+ setErrMessage('');
+ }}
+ hasBorder={false}
+ when={Boolean(errMessage)}
+ noMargin
+ >
+ {errMessage}
+
+
+
+ This action will permanently remove the current note.
+
+
+
+ {
+ e.preventDefault();
+
+ setInProgress(true);
+
+ operations.notes
+ .remove(noteUUID)
+ .then(() => {
+ // dispatch(removeBook(bookUUID));
+ setInProgress(false);
+ onDismiss();
+
+ // Scroll to top so that the message is visible.
+ dispatch(
+ setMessage({
+ message: `Successfully removed the note`,
+ kind: 'success',
+ path: homePathDef
+ })
+ );
+
+ history.push(getHomePath());
+ })
+ .catch(err => {
+ console.log('Error deleting note', err);
+ setInProgress(false);
+ setErrMessage(err.message);
+ });
+ }}
+ >
+
+
+ Cancel
+
+
+ Delete
+
+
+
+
+
+ );
+};
+
+export default withRouter(DeleteModal);
diff --git a/web/src/components/Note/FooterActions.scss b/web/src/components/Note/FooterActions.scss
new file mode 100644
index 00000000..81af3963
--- /dev/null
+++ b/web/src/components/Note/FooterActions.scss
@@ -0,0 +1,39 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/rem';
+@import '../App/font';
+
+.actions {
+ display: flex;
+}
+
+.action {
+ color: $light-gray;
+
+ &:hover {
+ color: $link-hover;
+ text-decoration: underline;
+ }
+
+ & ~ & {
+ margin-left: rem(12px);
+ }
+}
diff --git a/web/src/components/Note/FooterActions.tsx b/web/src/components/Note/FooterActions.tsx
new file mode 100644
index 00000000..7ae7c0fb
--- /dev/null
+++ b/web/src/components/Note/FooterActions.tsx
@@ -0,0 +1,82 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+import { Link } from 'react-router-dom';
+
+import { getNoteEditPath } from 'web/libs/paths';
+import styles from './FooterActions.scss';
+
+interface Props {
+ isOwner: boolean;
+ noteUUID: string;
+ onShareModalOpen: () => void;
+ onDeleteModalOpen: () => void;
+}
+
+const FooterActions: React.FunctionComponent = ({
+ isOwner,
+ noteUUID,
+ onShareModalOpen,
+ onDeleteModalOpen
+}) => {
+ if (!isOwner) {
+ return null;
+ }
+
+ return (
+
+ {
+ e.preventDefault();
+
+ onShareModalOpen();
+ }}
+ >
+ Share
+
+
+ {
+ e.preventDefault();
+
+ onDeleteModalOpen();
+ }}
+ >
+ Delete
+
+
+
+ Edit
+
+
+ );
+};
+
+export default FooterActions;
diff --git a/web/src/components/Note/Header.scss b/web/src/components/Note/Header.scss
new file mode 100644
index 00000000..e800e878
--- /dev/null
+++ b/web/src/components/Note/Header.scss
@@ -0,0 +1,37 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/font';
+
+.book-label {
+ max-width: rem(200px);
+ margin-left: rem(12px);
+
+ @include breakpoint(sm) {
+ max-width: rem(200px);
+ }
+ @include breakpoint(md) {
+ max-width: rem(420px);
+ }
+ @include breakpoint(lg) {
+ max-width: rem(600px);
+ }
+}
diff --git a/web/src/components/Note/Header.tsx b/web/src/components/Note/Header.tsx
new file mode 100644
index 00000000..8a0a5ab9
--- /dev/null
+++ b/web/src/components/Note/Header.tsx
@@ -0,0 +1,75 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { Link } from 'react-router-dom';
+import classnames from 'classnames';
+
+import { NoteData } from 'jslib/operations/types';
+import { getHomePath } from 'web/libs/paths';
+import BookIcon from '../Icons/Book';
+import HeaderRight from './HeaderRight';
+
+import noteStyles from '../Common/Note/Note.scss';
+import styles from './Header.scss';
+
+interface Props {
+ note: NoteData;
+ isOwner: boolean;
+ collapsed?: boolean;
+}
+
+const Header: React.FunctionComponent = ({
+ note,
+ isOwner,
+ collapsed
+}) => {
+ let fill;
+ if (collapsed) {
+ fill = '#8c8c8c';
+ } else {
+ fill = '#000000';
+ }
+
+ return (
+
+ );
+};
+
+export default Header;
diff --git a/web/src/components/Note/HeaderData.tsx b/web/src/components/Note/HeaderData.tsx
new file mode 100644
index 00000000..9ff3ec56
--- /dev/null
+++ b/web/src/components/Note/HeaderData.tsx
@@ -0,0 +1,54 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import Helmet from 'react-helmet';
+
+import { NoteState } from '../../store/note';
+import { nanosecToMillisec } from '../../helpers/time';
+import formatTime from '../../helpers/time/format';
+
+function formatAddedOn(ts: number): string {
+ const ms = nanosecToMillisec(ts);
+ const d = new Date(ms);
+
+ return formatTime(d, '%MMM %D %YYYY');
+}
+
+function getTitle(note: NoteState): string {
+ if (!note.isFetched) {
+ return 'Note';
+ }
+
+ return `Note: ${note.data.book.label} (${formatAddedOn(note.data.addedOn)})`;
+}
+
+interface Props {
+ note: NoteState;
+}
+
+const HeaderData: React.FunctionComponent = ({ note }) => {
+ const title = getTitle(note);
+ return (
+
+ {title}
+
+ );
+};
+
+export default HeaderData;
diff --git a/web/src/components/Note/HeaderRight.tsx b/web/src/components/Note/HeaderRight.tsx
new file mode 100644
index 00000000..1eae6c23
--- /dev/null
+++ b/web/src/components/Note/HeaderRight.tsx
@@ -0,0 +1,56 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import GlobeIcon from '../Icons/Globe';
+import Tooltip from '../Common/Tooltip';
+
+interface Props {
+ isOwner: boolean;
+ isPublic: boolean;
+}
+
+const HeaderRight: React.FunctionComponent = ({ isOwner, isPublic }) => {
+ if (!isOwner) {
+ return null;
+ }
+ if (!isPublic) {
+ return null;
+ }
+
+ const publicTooltip = 'Anyone on the Internet can see this note.';
+
+ return (
+
+
+
+ );
+};
+
+export default HeaderRight;
diff --git a/web/src/components/Note/ShareModal/CopyButton.tsx b/web/src/components/Note/ShareModal/CopyButton.tsx
new file mode 100644
index 00000000..dc5e09b3
--- /dev/null
+++ b/web/src/components/Note/ShareModal/CopyButton.tsx
@@ -0,0 +1,51 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import Button from '../../Common/Button';
+
+interface Props {
+ kind: string;
+ size?: string;
+ isHot: boolean;
+ onClick: () => void;
+ className?: string;
+}
+
+const CopyButton: React.FunctionComponent = ({
+ kind,
+ size,
+ isHot,
+ onClick,
+ className
+}) => {
+ return (
+
+ {isHot ? 'Copied' : 'Copy link'}
+
+ );
+};
+
+export default CopyButton;
diff --git a/web/src/components/Note/ShareModal/ShareModal.scss b/web/src/components/Note/ShareModal/ShareModal.scss
new file mode 100644
index 00000000..3243bf19
--- /dev/null
+++ b/web/src/components/Note/ShareModal/ShareModal.scss
@@ -0,0 +1,54 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/rem';
+@import '../../App/responsive';
+@import '../../App/theme';
+@import '../../App/font';
+
+.label-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
+.label {
+ margin-bottom: 0;
+}
+
+.status {
+ font-weight: 600;
+ @include font-size('small');
+ margin-left: rem(8px);
+}
+
+.help {
+ margin: rem(16px) 0;
+ @include font-size('small');
+ color: $gray;
+}
+
+.link-input {
+ margin-top: rem(8px);
+}
+
+.actions {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: rem(8px);
+}
diff --git a/web/src/components/Note/ShareModal/index.tsx b/web/src/components/Note/ShareModal/index.tsx
new file mode 100644
index 00000000..c4001acb
--- /dev/null
+++ b/web/src/components/Note/ShareModal/index.tsx
@@ -0,0 +1,201 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import classnames from 'classnames';
+import { NoteData } from 'jslib/operations/types';
+import React, { useState } from 'react';
+import { copyToClipboard, selectTextInputValue } from 'web/libs/dom';
+import operations from 'web/libs/operations';
+import { getNotePath } from 'web/libs/paths';
+import { useDispatch } from '../../../store';
+import { receiveNote } from '../../../store/note';
+import Button from '../../Common/Button';
+import Flash from '../../Common/Flash';
+import Modal, { Body, Header } from '../../Common/Modal';
+import Toggle, { ToggleKind } from '../../Common/Toggle';
+import CopyButton from './CopyButton';
+import styles from './ShareModal.scss';
+
+// getNoteURL returns the absolute URL for the note
+function getNoteURL(uuid: string): string {
+ const loc = getNotePath(uuid);
+ const path = loc.pathname;
+
+ // TODO: maybe get these values from the configuration instead of parsing
+ // current URL.
+ const { protocol, host } = window.location;
+
+ return `${protocol}//${host}${path}`;
+}
+
+function getHelpText(isPublic: boolean): string {
+ if (isPublic) {
+ return 'Anyone with this URL can view this note.';
+ }
+
+ return 'This note is private only to you.';
+}
+
+interface Props {
+ isOpen: boolean;
+ onDismiss: () => void;
+ note: NoteData;
+}
+
+const ShareModal: React.FunctionComponent = ({
+ isOpen,
+ onDismiss,
+ note
+}) => {
+ const [inProgress, setInProgress] = useState(false);
+ const [errMessage, setErrMessage] = useState('');
+ const [copyHot, setCopyHot] = useState(false);
+ const dispatch = useDispatch();
+
+ const labelId = 'share-note-modal-label';
+ const linkValue = getNoteURL(note.uuid);
+
+ function handleToggle(val: boolean) {
+ setInProgress(true);
+
+ operations.notes
+ .update(note.uuid, { public: val })
+ .then(resp => {
+ dispatch(receiveNote(resp));
+ setInProgress(false);
+ })
+ .catch(err => {
+ console.log('Error sharing note', err);
+ setInProgress(false);
+ setErrMessage(err.message);
+ });
+ }
+
+ function handleCopy() {
+ copyToClipboard(linkValue);
+ setCopyHot(true);
+
+ window.setTimeout(() => {
+ setCopyHot(false);
+ }, 1200);
+ }
+
+ return (
+
+
+
+ {
+ setErrMessage('');
+ }}
+ hasBorder={false}
+ when={Boolean(errMessage)}
+ noMargin
+ >
+ {errMessage}
+
+
+
+
+
+ Link sharing
+
+
+
+ {note.public ? 'Enabled' : 'Disabled'}
+
+ }
+ />
+
+
+ {
+ e.preventDefault();
+ }}
+ className={classnames(
+ 'form-control text-input text-input-small',
+ styles['link-input']
+ )}
+ onFocus={e => {
+ const el = e.target;
+
+ selectTextInputValue(el);
+ }}
+ onKeyDown={e => {
+ e.preventDefault();
+ }}
+ onMouseUp={e => {
+ e.preventDefault();
+
+ const el = e.target as HTMLInputElement;
+ selectTextInputValue(el);
+ }}
+ />
+
+ {getHelpText(note.public)}
+
+
+ {note.public && (
+
+ )}
+
+
+ Cancel
+
+
+
+
+ );
+};
+
+export default ShareModal;
diff --git a/web/src/components/Note/index.scss b/web/src/components/Note/index.scss
new file mode 100644
index 00000000..0c11ec33
--- /dev/null
+++ b/web/src/components/Note/index.scss
@@ -0,0 +1,40 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/rem';
+@import '../App/theme';
+
+.wrapper {
+ // min-height: calc(100vh - 57px);
+ background: $lighter-gray;
+ flex-grow: 1;
+ flex-basis: 0;
+}
+
+.inner {
+ display: flex;
+ justify-content: center;
+ padding-top: rem(40px);
+ padding-bottom: rem(40px);
+
+ @include breakpoint(md) {
+ padding-top: rem(52px);
+ padding-bottom: rem(52px);
+ }
+}
diff --git a/web/src/components/Note/index.tsx b/web/src/components/Note/index.tsx
new file mode 100644
index 00000000..ca05f5ed
--- /dev/null
+++ b/web/src/components/Note/index.tsx
@@ -0,0 +1,126 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect, useState } from 'react';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+
+import { parseSearchString } from 'jslib/helpers/url';
+import { checkOwner } from 'web/libs/notes';
+import Content from '../Common/Note';
+import Placeholder from '../Common/Note/Placeholder';
+import Flash from '../Common/Flash';
+import { getNote } from '../../store/note';
+import { useDispatch, useSelector, ReduxDispatch } from '../../store';
+import DeleteModal from './DeleteModal';
+import ShareModal from './ShareModal';
+import HeaderData from './HeaderData';
+import FooterActions from './FooterActions';
+import Header from './Header';
+import styles from './index.scss';
+
+interface Match {
+ noteUUID: string;
+}
+
+interface Props extends RouteComponentProps {}
+
+function useFetchData(
+ dispatch: ReduxDispatch,
+ noteUUID: string,
+ search: string
+) {
+ useEffect(() => {
+ const searchObj = parseSearchString(search);
+
+ dispatch(
+ getNote(noteUUID, {
+ q: searchObj.q || ''
+ })
+ );
+ }, [dispatch, noteUUID, search]);
+}
+
+const Note: React.FunctionComponent = ({ match, location }) => {
+ const { params } = match;
+ const { noteUUID } = params;
+
+ const dispatch = useDispatch();
+ const { note, user } = useSelector(state => {
+ return {
+ note: state.note,
+ user: state.auth.user
+ };
+ });
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
+ const [isShareModalOpen, setIsShareModalOpen] = useState(false);
+
+ const isOwner = checkOwner(note.data, user.data);
+
+ useFetchData(dispatch, noteUUID, location.search);
+
+ if (note.errorMessage) {
+ return Error: {note.errorMessage} ;
+ }
+
+ return (
+
+
+
+
+ {note.isFetched ? (
+
{
+ setIsDeleteModalOpen(true);
+ }}
+ onShareModalOpen={() => {
+ setIsShareModalOpen(true);
+ }}
+ />
+ }
+ header={}
+ />
+ ) : (
+
+ )}
+
+
+
{
+ setIsDeleteModalOpen(false);
+ }}
+ noteUUID={note.data.uuid}
+ />
+
+ {
+ setIsShareModalOpen(false);
+ }}
+ note={note.data}
+ />
+
+ );
+};
+
+export default React.memo(withRouter(Note));
diff --git a/web/src/components/PasswordReset/Confirm/Form.tsx b/web/src/components/PasswordReset/Confirm/Form.tsx
new file mode 100644
index 00000000..1efa2883
--- /dev/null
+++ b/web/src/components/PasswordReset/Confirm/Form.tsx
@@ -0,0 +1,98 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+
+import authStyles from '../../Common/Auth.scss';
+import Button from '../../Common/Button';
+
+interface Props {
+ onResetPassword: (password: string, passwordConfirmation: string) => void;
+ submitting: boolean;
+}
+
+const PasswordResetConfirmForm: React.FunctionComponent = ({
+ onResetPassword,
+ submitting
+}) => {
+ const [password, setPassword] = useState('');
+ const [passwordConfirmation, setPasswordConfirmation] = useState('');
+
+ return (
+ {
+ e.preventDefault();
+
+ onResetPassword(password, passwordConfirmation);
+ }}
+ className={authStyles.form}
+ >
+
+
+ Password
+ {
+ const val = e.target.value;
+
+ setPassword(val);
+ }}
+ />
+
+
+
+
+
+ Password Confirmation
+ {
+ const val = e.target.value;
+
+ setPasswordConfirmation(val);
+ }}
+ />
+
+
+
+
+ Reset password
+
+
+ );
+};
+
+export default PasswordResetConfirmForm;
diff --git a/web/src/components/PasswordReset/Confirm/index.tsx b/web/src/components/PasswordReset/Confirm/index.tsx
new file mode 100644
index 00000000..1f33b7b5
--- /dev/null
+++ b/web/src/components/PasswordReset/Confirm/index.tsx
@@ -0,0 +1,113 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import Helmet from 'react-helmet';
+import { Link, withRouter, RouteComponentProps } from 'react-router-dom';
+
+import { homePathDef } from 'web/libs/paths';
+import services from 'web/libs/services';
+import Form from './Form';
+import Logo from '../../Icons/Logo';
+import { getCurrentUser } from '../../../store/auth';
+import { setMessage } from '../../../store/ui';
+import { useDispatch } from '../../../store';
+import authStyles from '../../Common/Auth.scss';
+import Flash from '../../Common/Flash';
+
+interface Match {
+ token: string;
+}
+
+interface Props extends RouteComponentProps {}
+
+const PasswordResetConfirm: React.FunctionComponent = ({
+ match,
+ history
+}) => {
+ const [errorMsg, setErrorMsg] = useState('');
+ const [submitting, setSubmitting] = useState(false);
+ const dispatch = useDispatch();
+
+ function handleResetPassword(password: string, passwordConfirmation: string) {
+ if (!password) {
+ setErrorMsg('Please enter password');
+ return;
+ }
+ if (!passwordConfirmation) {
+ setErrorMsg('Please enter password confirmation');
+ return;
+ }
+
+ const { token } = match.params;
+
+ setSubmitting(true);
+ setErrorMsg('');
+
+ services.users
+ .resetPassword({ token, password })
+ .then(() => {
+ return dispatch(getCurrentUser());
+ })
+ .then(() => {
+ dispatch(
+ setMessage({
+ message: 'Your password was successfully reset.',
+ kind: 'info',
+ path: homePathDef
+ })
+ );
+ history.push('/');
+ })
+ .catch(err => {
+ setSubmitting(false);
+ setErrorMsg(err.message);
+ });
+ }
+
+ return (
+
+
+ Reset Password
+
+
+
+
+
+
Reset Password
+
+
+
+ Password must be at least 8 characters long.
+
+
+
+ {errorMsg &&
{errorMsg}
}
+
+
+
+
+
+
+ );
+};
+
+export default withRouter(PasswordResetConfirm);
diff --git a/web/src/components/PasswordReset/Request/Form.scss b/web/src/components/PasswordReset/Request/Form.scss
new file mode 100644
index 00000000..eeadf901
--- /dev/null
+++ b/web/src/components/PasswordReset/Request/Form.scss
@@ -0,0 +1,28 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/rem';
+@import '../../App/font';
+
+.email-input {
+ margin-top: rem(16px);
+}
+
+.label {
+ font-weight: 600;
+}
diff --git a/web/src/components/PasswordReset/Request/Form.tsx b/web/src/components/PasswordReset/Request/Form.tsx
new file mode 100644
index 00000000..fa5ff06a
--- /dev/null
+++ b/web/src/components/PasswordReset/Request/Form.tsx
@@ -0,0 +1,78 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import classnames from 'classnames';
+
+import Button from '../../Common/Button';
+import authStyles from '../../Common/Auth.scss';
+import styles from './Form.scss';
+
+interface Props {
+ onSubmit: (email: string) => void;
+ submitting: boolean;
+}
+
+const PasswordResetRequestForm: React.FunctionComponent = ({
+ onSubmit,
+ submitting
+}) => {
+ const [email, setEmail] = useState('');
+
+ return (
+ {
+ e.preventDefault();
+
+ onSubmit(email);
+ }}
+ className={authStyles.form}
+ >
+
+
+ Enter your email and we will send you a link to reset your password
+ {
+ const val = e.target.value;
+
+ setEmail(val);
+ }}
+ />
+
+
+
+
+ Send password reset email
+
+
+ );
+};
+
+export default PasswordResetRequestForm;
diff --git a/web/src/components/PasswordReset/Request/Request.scss b/web/src/components/PasswordReset/Request/Request.scss
new file mode 100644
index 00000000..04b77666
--- /dev/null
+++ b/web/src/components/PasswordReset/Request/Request.scss
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+.success-msg {
+ margin-bottom: 10px;
+}
diff --git a/web/src/components/PasswordReset/Request/index.tsx b/web/src/components/PasswordReset/Request/index.tsx
new file mode 100644
index 00000000..48f80273
--- /dev/null
+++ b/web/src/components/PasswordReset/Request/index.tsx
@@ -0,0 +1,106 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import Helmet from 'react-helmet';
+import { Link } from 'react-router-dom';
+
+import { getLoginPath } from 'web/libs/paths';
+import services from 'web/libs/services';
+import Flash from '../../Common/Flash';
+import Form from './Form';
+import Logo from '../../Icons/Logo';
+import authStyles from '../../Common/Auth.scss';
+import styles from './Request.scss';
+
+interface Props {}
+
+const PasswordResetRequest: React.FunctionComponent = () => {
+ const [errorMsg, setErrorMsg] = useState('');
+ const [submitting, setSubmitting] = useState(false);
+ const [processed, setProcessed] = useState(false);
+
+ function onSubmit(email) {
+ if (!email) {
+ setErrorMsg('Please enter email');
+ return;
+ }
+
+ setErrorMsg('');
+ setSubmitting(true);
+
+ services.users
+ .sendResetPasswordEmail({ email })
+ .then(() => {
+ setSubmitting(false);
+ setProcessed(true);
+ })
+ .catch(err => {
+ setSubmitting(false);
+ setErrorMsg(err.message);
+ });
+ }
+
+ return (
+
+
+ Reset Password
+
+
+
+
+
+
+
Reset Password
+
+
+
+
+ {errorMsg}
+
+
+ {processed ? (
+
+
+ Check your email for a link to reset your password.
+
+
+ Back to login
+
+
+ ) : (
+
+ )}
+
+
+
+
Remember your password?
+
+ Login
+
+
+
+
+
+ );
+};
+
+export default PasswordResetRequest;
diff --git a/web/src/components/Settings/About/index.tsx b/web/src/components/Settings/About/index.tsx
new file mode 100644
index 00000000..0f289423
--- /dev/null
+++ b/web/src/components/Settings/About/index.tsx
@@ -0,0 +1,60 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import Helmet from 'react-helmet';
+import config from '../../../libs/config';
+import { useSelector } from '../../../store';
+import SettingRow from '../SettingRow';
+import styles from '../Settings.scss';
+
+interface Props {}
+
+const About: React.FunctionComponent = () => {
+ const { user } = useSelector(state => {
+ return {
+ user: state.auth.user.data
+ };
+ });
+
+ return (
+
+
+ About
+
+
+
About
+
+
+
+ Software
+
+
+ {!__STANDALONE__ && user.pro && (
+ sung@getdnote.com}
+ />
+ )}
+
+
+
+ );
+};
+
+export default About;
diff --git a/web/src/components/Settings/Account/EmailModal.tsx b/web/src/components/Settings/Account/EmailModal.tsx
new file mode 100644
index 00000000..7a2cb475
--- /dev/null
+++ b/web/src/components/Settings/Account/EmailModal.tsx
@@ -0,0 +1,189 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect, useState } from 'react';
+import { connect } from 'react-redux';
+import services from 'web/libs/services';
+import { useDispatch } from '../../../store';
+import { getCurrentUser } from '../../../store/auth';
+import Button from '../../Common/Button';
+import Flash from '../../Common/Flash';
+import Modal, { Body, Header } from '../../Common/Modal';
+import modalStyles from '../../Common/Modal/Modal.scss';
+
+interface Props {
+ currentEmail: string;
+ isOpen: boolean;
+ onDismiss: () => void;
+}
+
+const EmailModal: React.FunctionComponent = ({
+ currentEmail,
+ isOpen,
+ onDismiss
+}) => {
+ const [passwordVal, setPasswordVal] = useState('');
+ const [emailVal, setEmailVal] = useState('');
+ const [inProgress, setInProgress] = useState(false);
+ const [successMsg, setSuccessMsg] = useState('');
+ const [failureMsg, setFailureMsg] = useState('');
+ const dispatch = useDispatch();
+
+ useEffect(() => {
+ if (!isOpen) {
+ setPasswordVal('');
+ setEmailVal('');
+ }
+ }, [isOpen]);
+
+ async function handleSubmit(e) {
+ e.preventDefault();
+
+ setSuccessMsg('');
+ setFailureMsg('');
+ setInProgress(true);
+
+ try {
+ if (currentEmail === emailVal) {
+ throw new Error('The new email is the same as the old email');
+ }
+
+ await services.users.updateProfile({
+ email: emailVal,
+ password: passwordVal
+ });
+
+ await dispatch(getCurrentUser({ refresh: true }));
+
+ setSuccessMsg('Updated the email');
+ setEmailVal('');
+ setPasswordVal('');
+ setInProgress(false);
+ } catch (err) {
+ setFailureMsg(`Failed to update the email. Error: ${err.message}`);
+ setInProgress(false);
+ }
+ }
+
+ const labelId = 'email-modal';
+
+ return (
+
+
+
+ {
+ setSuccessMsg('');
+ }}
+ noMargin
+ >
+ {successMsg}
+
+ {
+ setFailureMsg('');
+ }}
+ noMargin
+ >
+ {failureMsg}
+
+
+
+
+ {/* prevent browsers from automatically filling the input fields */}
+
+
+
+
+ New email
+
+
+ {
+ const val = e.target.value;
+ setEmailVal(val);
+ }}
+ className="form-control"
+ autoComplete="new-password"
+ />
+
+
+
+
+ Current password
+
+
+ {
+ const val = e.target.value;
+ setPasswordVal(val);
+ }}
+ className="form-control"
+ autoComplete="off"
+ />
+
+
+
+
+ Update
+
+
+
+ Cancel
+
+
+
+
+
+ );
+};
+
+const mapDispatchToProps = {
+ doGetCurrentUser: getCurrentUser
+};
+
+export default connect(null, mapDispatchToProps)(EmailModal);
diff --git a/web/src/components/Settings/Account/EmailVerificationRow.tsx b/web/src/components/Settings/Account/EmailVerificationRow.tsx
new file mode 100644
index 00000000..ba22c1f5
--- /dev/null
+++ b/web/src/components/Settings/Account/EmailVerificationRow.tsx
@@ -0,0 +1,95 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import classnames from 'classnames';
+
+import services from 'web/libs/services';
+import SettingRow from '../SettingRow';
+import settingsStyles from '../Settings.scss';
+
+interface Props {
+ verified: boolean;
+ setSuccessMsg: (string) => void;
+ setFailureMsg: (string) => void;
+}
+
+const EmailVerificationRow: React.FunctionComponent = ({
+ verified,
+ setSuccessMsg,
+ setFailureMsg
+}) => {
+ const [isSent, setIsSent] = useState(false);
+ const [inProgress, setInProgress] = useState(false);
+
+ let value;
+ if (verified) {
+ value = 'Yes';
+ } else {
+ value = 'No';
+ }
+
+ let actionContent = null;
+ if (!verified) {
+ actionContent = (
+ {
+ setInProgress(true);
+
+ services.users
+ .sendEmailVerificationEmail()
+ .then(() => {
+ setIsSent(true);
+ setInProgress(false);
+ setSuccessMsg(
+ 'A verification email is on the way. It might take a minute. Pleae check your inbox.'
+ );
+ })
+ .catch(err => {
+ setInProgress(false);
+ setFailureMsg(
+ `Failed to send a verification email. Error: ${err.message}`
+ );
+ });
+ }}
+ disabled={inProgress || isSent}
+ >
+ {isSent ? 'Verification sent' : 'Send verification'}
+
+ );
+ }
+
+ let desc = '';
+ if (!verified) {
+ desc = 'You need to verify the email to receive email digests';
+ }
+
+ return (
+
+ );
+};
+
+export default EmailVerificationRow;
diff --git a/web/src/components/Settings/Account/PasswordModal.tsx b/web/src/components/Settings/Account/PasswordModal.tsx
new file mode 100644
index 00000000..e1b24408
--- /dev/null
+++ b/web/src/components/Settings/Account/PasswordModal.tsx
@@ -0,0 +1,203 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect, useState } from 'react';
+import services from 'web/libs/services';
+
+import Button from '../../Common/Button';
+import Flash from '../../Common/Flash';
+import Modal, { Body, Header } from '../../Common/Modal';
+import modalStyles from '../../Common/Modal/Modal.scss';
+
+interface Props {
+ isOpen: boolean;
+ onDismiss: () => void;
+}
+
+const labelId = 'password-modal';
+
+const PasswordModal: React.FunctionComponent = ({
+ isOpen,
+ onDismiss
+}) => {
+ const [oldPassword, setOldPassword] = useState('');
+ const [newPassword, setNewPassword] = useState('');
+ const [newPasswordConfirmation, setNewPasswordConfirmation] = useState('');
+ const [inProgress, setInProgress] = useState(false);
+ const [successMsg, setSuccessMsg] = useState('');
+ const [failureMsg, setFailureMsg] = useState('');
+
+ useEffect(() => {
+ if (!isOpen) {
+ setOldPassword('');
+ setNewPassword('');
+ setNewPasswordConfirmation('');
+ }
+ }, [isOpen]);
+
+ async function handleSubmit(e) {
+ e.preventDefault();
+
+ setSuccessMsg('');
+ setFailureMsg('');
+ setInProgress(true);
+
+ try {
+ if (newPassword !== newPasswordConfirmation) {
+ throw new Error('Password and its confirmation do not match');
+ }
+
+ await services.users.updatePassword({
+ oldPassword,
+ newPassword
+ });
+
+ setSuccessMsg('Updated the password');
+ setOldPassword('');
+ setNewPassword('');
+ setNewPasswordConfirmation('');
+ setInProgress(false);
+ } catch (err) {
+ setFailureMsg(`Failed to update. ${err.message}`);
+ setInProgress(false);
+ }
+ }
+
+ return (
+
+
+
+ {
+ setSuccessMsg('');
+ }}
+ noMargin
+ >
+ {successMsg}
+
+ {
+ setFailureMsg('');
+ }}
+ noMargin
+ >
+ {failureMsg}
+
+
+
+
+ {/* prevent browsers from automatically filling the input fields */}
+
+
+
+
+ Current password
+
+ {
+ const val = e.target.value;
+
+ setOldPassword(val);
+ }}
+ className="form-control"
+ autoComplete={false.toString()}
+ />
+
+
+
+ New Password
+
+ {
+ const val = e.target.value;
+
+ setNewPassword(val);
+ }}
+ className="form-control"
+ />
+
+
+
+ New Password Confirmation
+
+ {
+ const val = e.target.value;
+
+ setNewPasswordConfirmation(val);
+ }}
+ className="form-control"
+ />
+
+
+
+
+ Update
+
+
+
+ Cancel
+
+
+
+
+
+ );
+};
+
+export default PasswordModal;
diff --git a/web/src/components/Settings/Account/index.tsx b/web/src/components/Settings/Account/index.tsx
new file mode 100644
index 00000000..efaf6ba5
--- /dev/null
+++ b/web/src/components/Settings/Account/index.tsx
@@ -0,0 +1,140 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState } from 'react';
+import Helmet from 'react-helmet';
+import classnames from 'classnames';
+
+import EmailModal from './EmailModal';
+import PasswordModal from './PasswordModal';
+import SettingRow from '../SettingRow';
+import EmailVerificationRow from './EmailVerificationRow';
+import Flash from '../../Common/Flash';
+import { useSelector } from '../../../store';
+
+import styles from '../Settings.scss';
+
+interface Props {}
+
+const Account: React.FunctionComponent = () => {
+ const [emailModalOpen, setEmailModalOpen] = useState(false);
+ const [passwordModalOpen, setPasswordModalOpen] = useState(false);
+ const [successMsg, setSuccessMsg] = useState('');
+ const [failureMsg, setFailureMsg] = useState('');
+
+ const { user } = useSelector(state => {
+ return {
+ user: state.auth.user.data
+ };
+ });
+
+ return (
+
+
+ Account
+
+
+
Account settings
+
+
{
+ setSuccessMsg('');
+ }}
+ >
+ {successMsg}
+
+
{
+ setFailureMsg('');
+ }}
+ >
+ {failureMsg}
+
+
+
+
+ Profile
+
+ {
+ setEmailModalOpen(true);
+ }}
+ >
+ Edit
+
+ }
+ />
+
+
+
+ {
+ setPasswordModalOpen(true);
+ }}
+ >
+ Edit
+
+ }
+ />
+
+
+
+
{
+ setEmailModalOpen(false);
+ }}
+ currentEmail={user.email}
+ />
+
+ {
+ setPasswordModalOpen(false);
+ }}
+ />
+
+ );
+};
+
+export default Account;
diff --git a/web/src/components/Settings/Notifications/Form.scss b/web/src/components/Settings/Notifications/Form.scss
new file mode 100644
index 00000000..3d56d1bc
--- /dev/null
+++ b/web/src/components/Settings/Notifications/Form.scss
@@ -0,0 +1,45 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/theme';
+
+.heading {
+ font-weight: 600;
+ @include font-size('regular');
+}
+
+.subtext {
+ @include font-size('small');
+ color: $gray;
+ margin-top: rem(4px);
+}
+
+.actions {
+ text-align: right;
+}
+
+.section ~ .section {
+ margin-top: rem(16px);
+}
+
+.label {
+ margin-left: rem(8px);
+ vertical-align: middle;
+}
diff --git a/web/src/components/Settings/Notifications/Form.tsx b/web/src/components/Settings/Notifications/Form.tsx
new file mode 100644
index 00000000..110a4f3d
--- /dev/null
+++ b/web/src/components/Settings/Notifications/Form.tsx
@@ -0,0 +1,155 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useReducer } from 'react';
+
+import services from 'web/libs/services';
+import { EmailPrefData } from 'jslib/operations/types';
+import Button from '../../Common/Button';
+import { receiveEmailPreference } from '../../../store/auth';
+import { useDispatch } from '../../../store';
+import styles from './Form.scss';
+
+enum Action {
+ setInactiveReminder,
+ setProductUpdate
+}
+
+function formReducer(state, action): EmailPrefData {
+ switch (action.type) {
+ case Action.setInactiveReminder:
+ return {
+ ...state,
+ inactiveReminder: action.data
+ };
+ case Action.setProductUpdate:
+ return {
+ ...state,
+ productUpdate: action.data
+ };
+ default:
+ return state;
+ }
+}
+
+interface Props {
+ emailPreference: EmailPrefData;
+ setSuccessMsg: (string) => void;
+ setFailureMsg: (string) => void;
+ token?: string;
+}
+
+const Form: React.FunctionComponent = ({
+ emailPreference,
+ setSuccessMsg,
+ setFailureMsg,
+ token
+}) => {
+ const [inProgress, setInProgress] = useState(false);
+ const dispatch = useDispatch();
+
+ const [formState, formDispatch] = useReducer(formReducer, emailPreference);
+
+ function handleSubmit(e) {
+ e.preventDefault();
+
+ setSuccessMsg('');
+ setFailureMsg('');
+ setInProgress(true);
+
+ services.users
+ .updateEmailPreference({
+ inactiveReminder: formState.inactiveReminder,
+ productUpdate: formState.productUpdate,
+ token
+ })
+ .then(updatedPreference => {
+ dispatch(receiveEmailPreference(updatedPreference));
+
+ setSuccessMsg('Updated email preference');
+ setInProgress(false);
+ })
+ .catch(err => {
+ setFailureMsg(`Failed to update. Error: ${err.message}`);
+ setInProgress(false);
+ });
+ }
+
+ return (
+
+
+
Alerts
+
Email me when:
+
+
+
+
+
News
+
+
Email me about:
+
+
+
+
+
+ Update
+
+
+
+ );
+};
+
+export default Form;
diff --git a/web/src/components/Settings/Notifications/Notifications.scss b/web/src/components/Settings/Notifications/Notifications.scss
new file mode 100644
index 00000000..202b2b43
--- /dev/null
+++ b/web/src/components/Settings/Notifications/Notifications.scss
@@ -0,0 +1,25 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../../App/rem';
+@import '../../App/font';
+@import '../../App/theme';
+
+.body {
+ padding: rem(16px) rem(20px);
+}
diff --git a/web/src/components/Settings/Notifications/index.tsx b/web/src/components/Settings/Notifications/index.tsx
new file mode 100644
index 00000000..dde37860
--- /dev/null
+++ b/web/src/components/Settings/Notifications/index.tsx
@@ -0,0 +1,110 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useState, useEffect } from 'react';
+import Helmet from 'react-helmet';
+import { withRouter, RouteComponentProps } from 'react-router';
+
+import { parseSearchString } from 'jslib/helpers/url';
+import Flash from '../../Common/Flash';
+import { useSelector } from '../../../store';
+import Form from './Form';
+import settingsStyles from '../Settings.scss';
+import { useDispatch } from '../../../store';
+import { getEmailPreference } from '../../../store/auth';
+import styles from './Notifications.scss';
+
+interface Props extends RouteComponentProps {}
+
+const Notifications: React.FunctionComponent = ({ location }) => {
+ const [successMsg, setSuccessMsg] = useState('');
+ const [failureMsg, setFailureMsg] = useState('');
+ const dispatch = useDispatch();
+
+ const { token } = parseSearchString(location.search);
+
+ const { emailPreference } = useSelector(state => {
+ return {
+ emailPreference: state.auth.emailPreference
+ };
+ });
+
+ useEffect(() => {
+ if (!emailPreference.isFetched) {
+ dispatch(getEmailPreference());
+ }
+ }, [dispatch, emailPreference.isFetched]);
+
+ return (
+
+
+ Notifications
+
+
+
Notifications
+
+
{
+ setSuccessMsg('');
+ }}
+ >
+ {successMsg}
+
+
+
{
+ setFailureMsg('');
+ }}
+ >
+ {failureMsg}
+
+
+
+ {emailPreference.errorMessage}
+
+
+
+
+
+ Email Preferences
+
+
+
+ {emailPreference.isFetched ? (
+
+ ) : (
+ Loading email preferences...
+ )}
+
+
+
+
+ );
+};
+
+export default withRouter(Notifications);
diff --git a/web/src/components/Settings/SettingRow.scss b/web/src/components/Settings/SettingRow.scss
new file mode 100644
index 00000000..e904aaf3
--- /dev/null
+++ b/web/src/components/Settings/SettingRow.scss
@@ -0,0 +1,70 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/font';
+@import '../App/theme';
+
+.row {
+ padding: rem(16px) rem(20px);
+}
+
+.wrapper {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+
+ &:not(:last-child) {
+ border-bottom: 1px solid $border-color;
+ }
+
+ @include breakpoint(md) {
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ }
+}
+
+.name {
+ font-weight: 400;
+ @include font-size('regular');
+ margin-bottom: 0;
+}
+.desc {
+ margin-bottom: 0;
+ @include font-size('small');
+ color: $gray;
+}
+.action {
+ display: flex;
+ flex-direction: column;
+
+ @include breakpoint(md) {
+ flex-direction: row;
+ }
+}
+
+.right {
+ display: flex;
+ flex-direction: column;
+ word-break: break-all;
+
+ @include breakpoint(md) {
+ flex-direction: row;
+ }
+}
diff --git a/web/src/components/Settings/SettingRow.tsx b/web/src/components/Settings/SettingRow.tsx
new file mode 100644
index 00000000..84095617
--- /dev/null
+++ b/web/src/components/Settings/SettingRow.tsx
@@ -0,0 +1,55 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+
+import styles from './SettingRow.scss';
+
+interface Props {
+ name: string;
+ actionContent?: React.ReactNode;
+ id?: string;
+ desc?: string;
+ value?: React.ReactNode;
+}
+
+const SettingRow: React.FunctionComponent = ({
+ name,
+ desc,
+ value,
+ actionContent,
+ id
+}) => {
+ return (
+
+
+
+
+ {value}
+
+ {actionContent &&
{actionContent}
}
+
+
+ );
+};
+
+export default SettingRow;
diff --git a/web/src/components/Settings/Settings.scss b/web/src/components/Settings/Settings.scss
new file mode 100644
index 00000000..6cafaaba
--- /dev/null
+++ b/web/src/components/Settings/Settings.scss
@@ -0,0 +1,90 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/rem';
+@import '../App/font';
+@import '../App/theme';
+
+.wrapper {
+ background: white;
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.14);
+}
+
+.header {
+ @include breakpoint(lg) {
+ display: none;
+ }
+}
+
+.section {
+ margin-top: rem(24px);
+
+ &:first-child {
+ margin-top: 0;
+ }
+}
+
+.section-heading {
+ @include font-size('regular');
+ font-weight: 600;
+ padding-bottom: rem(4px);
+ background: $light;
+ padding: rem(16px) rem(20px);
+}
+.section-content {
+ margin-top: rem(20px);
+}
+
+.actions {
+ margin-top: rem(18px);
+ text-align: right;
+}
+
+button.edit {
+ color: $link;
+ padding: 0;
+
+ &:hover {
+ color: $link-hover;
+ }
+ @include breakpoint(md) {
+ margin-left: rem(16px);
+ }
+}
+
+.verification-banner {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+
+ @include breakpoint(lg) {
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ }
+}
+
+.verification-banner-cta {
+ margin-top: rem(12px);
+ align-self: flex-end;
+
+ @include breakpoint(lg) {
+ margin-top: 0;
+ align-self: initial;
+ }
+}
diff --git a/web/src/components/Settings/Sidebar.scss b/web/src/components/Settings/Sidebar.scss
new file mode 100644
index 00000000..0848f81c
--- /dev/null
+++ b/web/src/components/Settings/Sidebar.scss
@@ -0,0 +1,51 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/responsive';
+@import '../App/theme';
+@import '../App/rem';
+@import '../App/font';
+
+.wrapper {
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
+ background: white;
+ margin-bottom: rem(20px);
+ margin-top: rem(20px);
+
+ @include breakpoint(lg) {
+ margin-bottom: 0;
+ margin-top: 0;
+ }
+}
+
+.item {
+ display: block;
+ padding: rem(12px) rem(16px);
+ border-left: 4px solid transparent;
+ @include font-size('regular');
+
+ &:hover {
+ text-decoration: none;
+ background: $light;
+ }
+
+ &.active {
+ font-weight: 600;
+ border-left-color: $first;
+ }
+}
diff --git a/web/src/components/Settings/Sidebar.tsx b/web/src/components/Settings/Sidebar.tsx
new file mode 100644
index 00000000..07811a01
--- /dev/null
+++ b/web/src/components/Settings/Sidebar.tsx
@@ -0,0 +1,71 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+import { NavLink } from 'react-router-dom';
+
+import { SettingSections, getSettingsPath } from 'web/libs/paths';
+import styles from './Sidebar.scss';
+
+interface Props {}
+
+const Sidebar: React.FunctionComponent = () => {
+ return (
+
+
+
+
+ Account
+
+
+ {__STANDALONE__ ? null : (
+
+
+ Billing
+
+
+ )}
+
+
+ Notifications
+
+
+
+
+ About
+
+
+
+
+ );
+};
+
+export default Sidebar;
diff --git a/web/src/components/Settings/index.tsx b/web/src/components/Settings/index.tsx
new file mode 100644
index 00000000..5837fffb
--- /dev/null
+++ b/web/src/components/Settings/index.tsx
@@ -0,0 +1,80 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import Helmet from 'react-helmet';
+import { RouteComponentProps } from 'react-router-dom';
+import classnames from 'classnames';
+
+import { SettingSections } from 'web/libs/paths';
+import Account from './Account';
+import Sidebar from './Sidebar';
+import About from './About';
+import Notifications from './Notifications';
+import styles from './Settings.scss';
+
+function renderContent(section: string): React.ReactNode {
+ if (section === SettingSections.account) {
+ return ;
+ }
+ if (section === SettingSections.about) {
+ return ;
+ }
+ if (section === SettingSections.notifications) {
+ return ;
+ }
+
+ return Not found
;
+}
+
+interface Match {
+ section: string;
+}
+
+interface Props extends RouteComponentProps {}
+
+const Settings: React.FunctionComponent = ({ match }) => {
+ const { params } = match;
+ const { section } = params;
+
+ return (
+
+
+
+
+
+
+
+
Settings
+
+
+
+
+
+
+
+
+ {renderContent(section)}
+
+
+
+
+ );
+};
+
+export default Settings;
diff --git a/web/src/components/Splash/Splash.module.scss b/web/src/components/Splash/Splash.module.scss
new file mode 100644
index 00000000..4a42b741
--- /dev/null
+++ b/web/src/components/Splash/Splash.module.scss
@@ -0,0 +1,29 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/theme';
+
+.wrapper {
+ background: $lighter-gray;
+ min-height: 100vh;
+ padding: 50px 15px;
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
diff --git a/web/src/components/Splash/index.tsx b/web/src/components/Splash/index.tsx
new file mode 100644
index 00000000..88841d7a
--- /dev/null
+++ b/web/src/components/Splash/index.tsx
@@ -0,0 +1,92 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import Logo from '../Icons/Logo';
+import styles from './Splash.module.scss';
+
+function Splash() {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default Splash;
diff --git a/web/src/components/TabBar/Item.scss b/web/src/components/TabBar/Item.scss
new file mode 100644
index 00000000..7ba11c8a
--- /dev/null
+++ b/web/src/components/TabBar/Item.scss
@@ -0,0 +1,27 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/theme';
+@import '../App/font';
+@import '../App/responsive';
+@import '../App/rem';
+
+.wrapper {
+ display: flex;
+ flex-grow: 1;
+}
diff --git a/web/src/components/TabBar/Item.tsx b/web/src/components/TabBar/Item.tsx
new file mode 100644
index 00000000..bf7f7710
--- /dev/null
+++ b/web/src/components/TabBar/Item.tsx
@@ -0,0 +1,29 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+
+import styles from './Item.scss';
+
+interface Props {}
+
+const Item: React.FunctionComponent = ({ children }) => {
+ return {children} ;
+};
+
+export default Item;
diff --git a/web/src/components/TabBar/TabBar.scss b/web/src/components/TabBar/TabBar.scss
new file mode 100644
index 00000000..1c39ddd9
--- /dev/null
+++ b/web/src/components/TabBar/TabBar.scss
@@ -0,0 +1,61 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+@import '../App/theme';
+@import '../App/responsive';
+@import '../App/rem';
+@import '../App/font';
+@import '../App/variables';
+
+.wrapper {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ height: $footer-height;
+ background-color: $first;
+ border-top: 1px solid $gray;
+
+ @include breakpoint(lg) {
+ display: none;
+ }
+}
+
+.list {
+ display: flex;
+ height: 100%;
+}
+
+.link {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ justify-content: center;
+ align-items: center;
+ padding-top: rem(8px);
+
+ &:focus {
+ outline: currentcolor none 0px;
+ }
+}
+
+.label {
+ color: #cecece;
+ margin-top: rem(4px);
+ @include font-size('x-small');
+}
diff --git a/web/src/components/TabBar/index.tsx b/web/src/components/TabBar/index.tsx
new file mode 100644
index 00000000..be9f9cc9
--- /dev/null
+++ b/web/src/components/TabBar/index.tsx
@@ -0,0 +1,118 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import classnames from 'classnames';
+import { withRouter, RouteComponentProps, Link } from 'react-router-dom';
+
+import Item from './Item';
+import NoteIcon from '../Icons/Note';
+import BookIcon from '../Icons/Book';
+import DotsIcon from '../Icons/Dots';
+import HomeIcon from '../Icons/Home';
+import styles from './TabBar.scss';
+
+interface Props extends RouteComponentProps {
+ isMobileMenuOpen: boolean;
+ setMobileMenuOpen: (boolean) => void;
+}
+
+function getFill(active: boolean): string {
+ let ret;
+ if (active) {
+ ret = '#49abfd';
+ } else {
+ ret = '#cecece';
+ }
+
+ return ret;
+}
+
+const TabBar: React.FunctionComponent = ({
+ location,
+ isMobileMenuOpen,
+ setMobileMenuOpen
+}) => {
+ const isHomeActive = !isMobileMenuOpen && location.pathname === '/';
+ const isBookActive = !isMobileMenuOpen && location.pathname === '/books';
+ const isNewActive = !isMobileMenuOpen && location.pathname === '/new';
+
+ return (
+
+
+ -
+
+
+ Home
+
+
+
+ -
+
+
+ Books
+
+
+
+ -
+
+
+ New
+
+
+
+ -
+
{
+ setMobileMenuOpen(!isMobileMenuOpen);
+ }}
+ >
+
+ More
+
+
+
+
+ );
+};
+
+export default withRouter(TabBar);
diff --git a/web/src/components/VerifyEmail/index.tsx b/web/src/components/VerifyEmail/index.tsx
new file mode 100644
index 00000000..c81c891e
--- /dev/null
+++ b/web/src/components/VerifyEmail/index.tsx
@@ -0,0 +1,68 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect } from 'react';
+import { RouteComponentProps } from 'react-router-dom';
+
+import { getHomePath, homePathDef, verifyEmailPathDef } from 'web/libs/paths';
+import services from 'web/libs/services';
+import { receiveUser } from '../../store/auth';
+import { setMessage } from '../../store/ui';
+import { useDispatch } from '../../store';
+
+interface Match {
+ token: string;
+}
+
+interface Props extends RouteComponentProps {}
+
+const VerifyEmail: React.FunctionComponent = ({ match, history }) => {
+ const dispatch = useDispatch();
+ const { token } = match.params;
+
+ useEffect(() => {
+ const homePath = getHomePath();
+
+ services.users
+ .verifyEmail({ token })
+ .then(res => {
+ dispatch(receiveUser(res));
+ dispatch(
+ setMessage({
+ message: 'Email was successfully verified',
+ kind: 'info',
+ path: homePathDef
+ })
+ );
+ history.push(homePath);
+ })
+ .catch(err => {
+ dispatch(
+ setMessage({
+ message: err.message,
+ kind: 'error',
+ path: verifyEmailPathDef
+ })
+ );
+ });
+ }, [dispatch, history, token]);
+
+ return null;
+};
+
+export default VerifyEmail;
diff --git a/web/src/helpers/accessibility.ts b/web/src/helpers/accessibility.ts
new file mode 100644
index 00000000..21d0343e
--- /dev/null
+++ b/web/src/helpers/accessibility.ts
@@ -0,0 +1,37 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// makeOptionId returns the id for an option to identify an option within
+// a given context, such as listbox, combobox, or menu.
+export function makeOptionId(contextId: string, val: string): string {
+ return `${contextId}-${val}`;
+}
+
+// getOptIdxByValue returns the index of an option by the given value.
+// If not found, it returns 0.
+export function getOptIdxByValue(options: any, val: string) {
+ for (let i = 0; i < options.length; ++i) {
+ const option = options[i];
+
+ if (option.value === val) {
+ return i;
+ }
+ }
+
+ return -1;
+}
diff --git a/web/src/helpers/browser.js b/web/src/helpers/browser.js
new file mode 100644
index 00000000..bae9cc8f
--- /dev/null
+++ b/web/src/helpers/browser.js
@@ -0,0 +1,44 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export function getBrowserType() {
+ if (
+ (navigator.userAgent.indexOf('Opera') ||
+ navigator.userAgent.indexOf('OPR')) !== -1
+ ) {
+ return 'Opera';
+ }
+ if (navigator.userAgent.indexOf('Chrome') !== -1) {
+ return 'Chrome';
+ }
+ if (navigator.userAgent.indexOf('Safari') !== -1) {
+ return 'Safari';
+ }
+ if (navigator.userAgent.indexOf('Firefox') !== -1) {
+ return 'Firefox';
+ }
+ if (
+ navigator.userAgent.indexOf('MSIE') !== -1 ||
+ !!document.documentMode === true
+ ) {
+ // IF IE > 10
+ return 'IE';
+ }
+
+ return 'unknown';
+}
diff --git a/web/src/helpers/error.js b/web/src/helpers/error.js
new file mode 100644
index 00000000..dba185e3
--- /dev/null
+++ b/web/src/helpers/error.js
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export function presentError(error) {
+ return `${error}`;
+}
diff --git a/web/src/helpers/markdown.ts b/web/src/helpers/markdown.ts
new file mode 100644
index 00000000..408c11ae
--- /dev/null
+++ b/web/src/helpers/markdown.ts
@@ -0,0 +1,59 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import markdown from 'markdown-it';
+import hljs from 'highlight.js';
+
+const md = markdown({
+ html: true,
+ linkify: true,
+ breaks: true,
+ highlight: (str, lang) => {
+ if (lang && hljs.getLanguage(lang)) {
+ return hljs.highlight(lang, str).value;
+ }
+
+ return ''; // use external default escaping
+ }
+});
+
+// open links in new tabs
+const defaultRender =
+ md.renderer.rules.link_open ||
+ function renderToken(tokens, idx, options, env, self) {
+ return self.renderToken(tokens, idx, options);
+ };
+
+md.renderer.rules.link_open = (tokens, idx, options, env, self) => {
+ // If you are sure other plugins can't add `target` - drop check below
+ const aIndex = tokens[idx].attrIndex('target');
+
+ if (aIndex < 0) {
+ tokens[idx].attrPush(['target', '_blank']); // add new attribute
+ } else {
+ // eslint-disable-next-line no-param-reassign
+ tokens[idx].attrs[aIndex][1] = '_blank'; // replace value of existing attr
+ }
+
+ // pass token to default renderer.
+ return defaultRender(tokens, idx, options, env, self);
+};
+
+export function parseMarkdown(str: string) {
+ return md.render(str);
+}
diff --git a/web/src/helpers/time/format.spec.ts b/web/src/helpers/time/format.spec.ts
new file mode 100644
index 00000000..88a874a3
--- /dev/null
+++ b/web/src/helpers/time/format.spec.ts
@@ -0,0 +1,56 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import formatTime from './format';
+
+describe('time/format.ts', () => {
+ describe('formatTime', () => {
+ const date = new Date(2017, 2, 30, 8, 30);
+ const testCases = [
+ {
+ format: '%YYYY %MM %DD %hh:%mm',
+ expected: '2017 03 30 08:30'
+ },
+ {
+ format: '%YYYY %MMM %DD %hh:%mm %A',
+ expected: '2017 Mar 30 08:30 AM'
+ },
+ {
+ format: '%YYYY %MMM %DD %h:%mm%a',
+ expected: '2017 Mar 30 8:30am'
+ },
+ {
+ format: '%dddd %M/%D',
+ expected: 'Thursday 3/30'
+ },
+ {
+ format: '%MMMM %Do',
+ expected: 'March 30th'
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; i++) {
+ const tc = testCases[i];
+
+ test(`converts the input ${tc.format}`, () => {
+ const result = formatTime(date, tc.format);
+ expect(result).toBe(tc.expected);
+ });
+ }
+ });
+});
diff --git a/web/src/helpers/time/format.ts b/web/src/helpers/time/format.ts
new file mode 100644
index 00000000..720ca7de
--- /dev/null
+++ b/web/src/helpers/time/format.ts
@@ -0,0 +1,148 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { getMonthName, getUTCOffset, pad, getDayName } from './index';
+import { addOrdinalSuffix } from '../../libs/string';
+
+// format verbs
+const YYYY = '%YYYY';
+const YY = '%YY';
+const MMMM = '%MMMM';
+const MMM = '%MMM';
+const MM = '%MM';
+const M = '%M';
+const DD = '%DD';
+const D = '%D';
+const Do = '%Do';
+const hh = '%hh';
+const h = '%h';
+const mm = '%mm';
+const m = '%m';
+const A = '%A';
+const a = '%a';
+const Z = '%Z';
+const dddd = '%dddd';
+
+// getPeriod returns the period for the time for the given date
+function getPeriod(date: Date) {
+ const hour = date.getHours();
+
+ let ret;
+ if (hour > 12) {
+ ret = 'PM';
+ } else {
+ ret = 'AM';
+ }
+
+ return ret;
+}
+
+// formatTime formats time to a human readable string based on the given format string
+export default function formatTime(date: Date, format: string): string {
+ let ret = format;
+
+ if (ret.indexOf(YYYY) > -1) {
+ ret = ret.replace(new RegExp(YYYY, 'g'), date.getFullYear().toString());
+ }
+ if (ret.indexOf(YY) > -1) {
+ const year = date.getFullYear().toString();
+ const newSubstr = year.substring(2, 4);
+
+ ret = ret.replace(new RegExp(YY, 'g'), newSubstr);
+ }
+
+ if (ret.indexOf(MMMM) > -1) {
+ ret = ret.replace(new RegExp(MMMM, 'g'), getMonthName(date));
+ }
+ if (ret.indexOf(MMM) > -1) {
+ ret = ret.replace(new RegExp(MMM, 'g'), getMonthName(date, true));
+ }
+ if (ret.indexOf(MM) > -1) {
+ const monthIdx = date.getMonth() + 1;
+ const newSubstr = pad(monthIdx);
+
+ ret = ret.replace(new RegExp(MM, 'g'), newSubstr);
+ }
+ if (ret.indexOf(M) > -1) {
+ const monthIdx = `${date.getMonth() + 1}`;
+
+ ret = ret.replace(new RegExp(M, 'g'), monthIdx);
+ }
+
+ if (ret.indexOf(DD) > -1) {
+ const day = date.getDate();
+ const newSubstr = pad(day);
+
+ ret = ret.replace(new RegExp(DD, 'g'), newSubstr);
+ }
+ if (ret.indexOf(Do) > -1) {
+ const day = date.getDate();
+ const newSubstr = addOrdinalSuffix(day);
+
+ ret = ret.replace(new RegExp(Do, 'g'), newSubstr);
+ }
+ if (ret.indexOf(D) > -1) {
+ ret = ret.replace(new RegExp(D, 'g'), date.getDate().toString());
+ }
+
+ if (ret.indexOf(hh) > -1) {
+ const hour = date.getHours();
+
+ ret = ret.replace(new RegExp(hh, 'g'), pad(hour));
+ }
+ if (ret.indexOf(h) > -1) {
+ let hour = date.getHours();
+ if (hour > 12) {
+ hour -= 12;
+ }
+
+ ret = ret.replace(new RegExp(h, 'g'), hour.toString());
+ }
+
+ if (ret.indexOf(mm) > -1) {
+ const minute = date.getMinutes();
+
+ ret = ret.replace(new RegExp(mm, 'g'), pad(minute));
+ }
+ if (ret.indexOf(m) > -1) {
+ ret = ret.replace(/m/g, date.getMinutes().toString());
+ }
+
+ if (ret.indexOf(A) > -1) {
+ const period = getPeriod(date);
+
+ ret = ret.replace(new RegExp(A, 'g'), period);
+ }
+ if (ret.indexOf(a) > -1) {
+ const period = getPeriod(date).toLowerCase();
+
+ ret = ret.replace(new RegExp(a, 'g'), period);
+ }
+
+ if (ret.indexOf(dddd) > -1) {
+ ret = ret.replace(new RegExp(dddd, 'g'), getDayName(date, false));
+ }
+
+ if (ret.indexOf(Z) > -1) {
+ const offset = getUTCOffset();
+
+ ret = ret.replace(new RegExp(Z, 'g'), offset);
+ }
+
+ return ret;
+}
diff --git a/web/src/helpers/time/index.spec.ts b/web/src/helpers/time/index.spec.ts
new file mode 100644
index 00000000..34da035f
--- /dev/null
+++ b/web/src/helpers/time/index.spec.ts
@@ -0,0 +1,44 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { daysToMs } from './index';
+
+describe('time.ts', () => {
+ describe('daysToMs', () => {
+ const testCases = [
+ {
+ input: 1,
+ expected: 86400000
+ },
+
+ {
+ input: 14,
+ expected: 1209600000
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; i++) {
+ const tc = testCases[i];
+
+ test(`converts the input ${tc.input}`, () => {
+ const result = daysToMs(tc.input);
+ expect(result).toBe(tc.expected);
+ });
+ }
+ });
+});
diff --git a/web/src/helpers/time/index.ts b/web/src/helpers/time/index.ts
new file mode 100644
index 00000000..64ad12d0
--- /dev/null
+++ b/web/src/helpers/time/index.ts
@@ -0,0 +1,302 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { pluralize } from '../../libs/string';
+
+const shortMonthNames = [
+ 'Jan',
+ 'Feb',
+ 'Mar',
+ 'Apr',
+ 'May',
+ 'Jun',
+ 'Jul',
+ 'Aug',
+ 'Sep',
+ 'Oct',
+ 'Nov',
+ 'Dec'
+];
+
+const fullMonthNames = [
+ 'January',
+ 'February',
+ 'March',
+ 'April',
+ 'May',
+ 'June',
+ 'July',
+ 'August',
+ 'September',
+ 'October',
+ 'November',
+ 'Dececember'
+];
+
+const shortDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat'];
+
+const fullDayNames = [
+ 'Sunday',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday'
+];
+
+/** ***** durations in milliseconds */
+export const SECOND = 1000;
+export const MINUTE = 60 * SECOND;
+export const HOUR = 60 * MINUTE;
+export const DAY = 24 * HOUR;
+export const WEEK = 7 * DAY;
+
+// nanosecToSec converts a given nanoseconds to seconds by dropping surplus digits
+export function nanosecToSec(t: number): number {
+ const truncated = String(t).slice(0, -9);
+
+ return parseInt(truncated, 10);
+}
+
+// nanosecToMillisec converts a given nanoseconds to milliseconds by dropping surplus digits
+export function nanosecToMillisec(t: number): number {
+ const truncated = String(t).slice(0, -6);
+
+ return parseInt(truncated, 10);
+}
+
+// getDayName returns the shortened month name of the given date
+export function getDayName(date: Date, short: boolean = false) {
+ const day = date.getDay();
+
+ if (short) {
+ return shortDayNames[day];
+ }
+
+ return fullDayNames[day];
+}
+
+// monthNumToFullName returns a full month name based on the number denoting the month,
+// ranging from 1 to 12 corresponding to each month of a year.
+export function monthNumToFullName(num: number): string {
+ if (num > 12 || num < 1) {
+ throw new Error(`invalid month number ${num}`);
+ }
+
+ return fullMonthNames[num - 1];
+}
+
+// getMonthName returns the shortened month name of the given date
+export function getMonthName(date: Date, short: boolean = false) {
+ const month = date.getMonth();
+
+ if (short) {
+ return shortMonthNames[month];
+ }
+
+ return monthNumToFullName(month + 1);
+}
+
+export function pad(value: number): string {
+ return value < 10 ? `0${value}` : `${value}`;
+}
+
+// getUTCOffset returns the UTC offset string for the client. The returned
+// value is in the format of '+08:00'
+export function getUTCOffset(): string {
+ const date = new Date();
+
+ let sign;
+ if (date.getTimezoneOffset() > 0) {
+ sign = '-';
+ } else {
+ sign = '+';
+ }
+
+ const offset = Math.abs(date.getTimezoneOffset());
+ const hours = Math.floor(offset / 60);
+
+ const rawMinutes = offset % 60;
+ if (rawMinutes === 0) {
+ return `${sign}${hours}`;
+ }
+
+ const minutes = pad(rawMinutes);
+ return `${sign}${hours}:${minutes}`;
+}
+
+// daysToMs translates the given number of days to seconds
+export function daysToMs(numDays: number) {
+ const dayInSeconds = DAY;
+
+ return dayInSeconds * numDays;
+}
+
+function parseMs(ms: number) {
+ const weeks = Math.floor(ms / WEEK);
+ const days = Math.floor((ms % WEEK) / DAY);
+ const hours = Math.floor(((ms % WEEK) % DAY) / HOUR);
+ const minutes = Math.floor((((ms % WEEK) % DAY) % HOUR) / MINUTE);
+ const seconds = (((ms % WEEK) % DAY) % HOUR) % MINUTE;
+
+ return {
+ weeks,
+ days,
+ hours,
+ minutes,
+ seconds
+ };
+}
+
+// msToHTMLTimeDuration converts the given number of seconds into a valid
+// time duration string as defined by the W3C HTML5 recommendation
+export function msToHTMLTimeDuration(ms: number): string {
+ const { weeks, days, hours, minutes, seconds } = parseMs(ms);
+
+ let ret = 'P';
+
+ const numDays = weeks * 7 + days;
+ if (numDays > 0) {
+ ret += `${numDays}D`;
+ }
+
+ if (hours > 0) {
+ ret += `${hours}H`;
+ }
+ if (minutes > 0) {
+ ret += `${minutes}M`;
+ }
+ if (seconds > 0) {
+ ret += `${seconds}S`;
+ }
+
+ return ret;
+}
+
+// msToDuration translates the given time in seconds into a human-readable duration
+export function msToDuration(ms: number): string {
+ const { weeks, days, hours, minutes } = parseMs(ms);
+
+ let ret = '';
+
+ if (weeks > 0) {
+ ret += `${weeks} ${pluralize('week', weeks)} `;
+ }
+ if (days > 0) {
+ ret += `${days} ${pluralize('day', days)} `;
+ }
+ if (hours > 0) {
+ ret += `${hours} ${pluralize('hour', hours)} `;
+ }
+ if (minutes > 0) {
+ ret += `${minutes} ${pluralize('minute', minutes)} `;
+ }
+
+ return ret.trim();
+}
+
+type TimeDiffTense = 'past' | 'future';
+
+interface TimeDiff {
+ text: string;
+ tense?: TimeDiffTense;
+}
+
+export function relativeTimeDiff(t1: number, t2: number): TimeDiff {
+ function getStr(interval: number, noun: string): string {
+ return `${interval} ${pluralize(noun, interval)}`;
+ }
+
+ const diff = t1 - t2;
+ const ts = Math.floor(Math.abs(diff));
+
+ let tense;
+ if (diff > 0) {
+ tense = 'past';
+ } else {
+ tense = 'future';
+ }
+
+ let interval = Math.floor(ts / (52 * WEEK));
+ if (interval > 1) {
+ return {
+ text: getStr(interval, 'year'),
+ tense
+ };
+ }
+
+ interval = Math.floor(ts / (4 * WEEK));
+ if (interval >= 1) {
+ return {
+ text: getStr(interval, 'month'),
+ tense
+ };
+ }
+
+ interval = Math.floor(ts / WEEK);
+ if (interval >= 1) {
+ return {
+ text: getStr(interval, 'week'),
+ tense
+ };
+ }
+
+ interval = Math.floor(ts / DAY);
+ if (interval >= 1) {
+ return {
+ text: getStr(interval, 'day'),
+ tense
+ };
+ }
+
+ interval = Math.floor(ts / HOUR);
+ if (interval >= 1) {
+ return {
+ text: getStr(interval, 'hour'),
+ tense
+ };
+ }
+
+ interval = Math.floor(ts / MINUTE);
+ if (interval >= 1) {
+ return {
+ text: getStr(interval, 'minute'),
+ tense
+ };
+ }
+
+ return {
+ text: 'Just now'
+ };
+}
+
+export function timeAgo(ms: number): string {
+ const now = new Date().getTime();
+ const diff = relativeTimeDiff(now, ms);
+
+ if (diff.tense === 'past') {
+ return `${diff.text} ago`;
+ }
+
+ if (diff.tense === 'future') {
+ return `in ${diff.text}`;
+ }
+
+ return diff.text;
+}
diff --git a/web/src/helpers/user.js b/web/src/helpers/user.js
new file mode 100644
index 00000000..c7a42bce
--- /dev/null
+++ b/web/src/helpers/user.js
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export function getAvatarURL(githubId) {
+ return `https://avatars1.githubusercontent.com/u/${githubId}`;
+}
diff --git a/web/src/hocs/guestOnly.tsx b/web/src/hocs/guestOnly.tsx
new file mode 100644
index 00000000..251ec0c5
--- /dev/null
+++ b/web/src/hocs/guestOnly.tsx
@@ -0,0 +1,68 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { Redirect, RouteComponentProps } from 'react-router-dom';
+
+import { getReferrer } from 'jslib//helpers/url';
+import { useSelector } from '../store';
+
+function renderFallback(referrer?: string) {
+ let destination;
+ if (referrer) {
+ destination = referrer;
+ } else {
+ destination = '/';
+ }
+
+ // handle special cases
+ if (destination.indexOf('subscriptions') > -1) {
+ window.location.href = destination;
+ return null;
+ }
+
+ return ;
+}
+
+// guestOnly returns a HOC that renders the given component only if user is not
+// logged in
+export default function (Component: React.ComponentType): React.ComponentType {
+ interface Props extends RouteComponentProps {}
+
+ const HOC: React.FunctionComponent = props => {
+ const { location } = props;
+
+ const { userData } = useSelector(state => {
+ return {
+ userData: state.auth.user
+ };
+ });
+
+ const loggedIn = userData.isFetched && Boolean(userData.data.uuid);
+
+ if (loggedIn) {
+ const referrer = getReferrer(location);
+ return renderFallback(referrer);
+ }
+
+ // eslint-disable-next-line react/jsx-props-no-spreading
+ return ;
+ };
+
+ return HOC;
+}
diff --git a/web/src/hocs/scrollTop.tsx b/web/src/hocs/scrollTop.tsx
new file mode 100644
index 00000000..79d83015
--- /dev/null
+++ b/web/src/hocs/scrollTop.tsx
@@ -0,0 +1,36 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React, { useEffect } from 'react';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+
+interface Props extends RouteComponentProps {}
+
+export default function (WrappedComponent: React.ComponentType) {
+ const ScrollToTop: React.FunctionComponent = ({ location }) => {
+ const { pathname } = location;
+ useEffect(() => {
+ console.log('scrolling to top');
+ window.scrollTo(0, 0);
+ }, [pathname]);
+
+ return ;
+ };
+
+ return withRouter(ScrollToTop);
+}
diff --git a/web/src/hocs/userOnly.tsx b/web/src/hocs/userOnly.tsx
new file mode 100644
index 00000000..6992e76b
--- /dev/null
+++ b/web/src/hocs/userOnly.tsx
@@ -0,0 +1,56 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { withRouter, RouteComponentProps } from 'react-router-dom';
+import { Redirect } from 'react-router-dom';
+
+import { getPathFromLocation } from 'jslib//helpers/url';
+import { useSelector } from '../store';
+
+// userOnly returns a HOC that redirects to Login page if user is not logged in
+export default function (
+ Component: React.ComponentType,
+ guestPath: string = '/login'
+) {
+ interface Props extends RouteComponentProps {}
+
+ const HOC: React.FunctionComponent = props => {
+ const { location } = props;
+
+ const { userData } = useSelector(state => {
+ return {
+ userData: state.auth.user
+ };
+ });
+
+ const isGuest = userData.isFetched && !userData.data.uuid;
+ if (isGuest) {
+ const referrer = getPathFromLocation(location);
+
+ const dest = `${guestPath}?referrer=${encodeURIComponent(referrer)}`;
+
+ return ;
+ }
+
+ // eslint-disable-next-line react/jsx-props-no-spreading
+ return ;
+ };
+
+ return withRouter(HOC);
+}
diff --git a/web/src/libs/config.ts b/web/src/libs/config.ts
new file mode 100644
index 00000000..4be40814
--- /dev/null
+++ b/web/src/libs/config.ts
@@ -0,0 +1,22 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export default {
+ cdnUrl: __CDN_URL__,
+ version: __VERSION__
+};
diff --git a/web/src/libs/countries.js b/web/src/libs/countries.js
new file mode 100644
index 00000000..8613b6d3
--- /dev/null
+++ b/web/src/libs/countries.js
@@ -0,0 +1,270 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// ISO-3166-1 alpha-3 country codes and names
+export const countries = [
+ { code: 'AFG', name: 'Afghanistan' },
+ { code: 'ALA', name: 'Åland Islands' },
+ { code: 'ALB', name: 'Albania' },
+ { code: 'DZA', name: 'Algeria' },
+ { code: 'ASM', name: 'American Samoa' },
+ { code: 'AND', name: 'Andorra' },
+ { code: 'AGO', name: 'Angola' },
+ { code: 'AIA', name: 'Anguilla' },
+ { code: 'ATA', name: 'Antarctica' },
+ { code: 'ATG', name: 'Antigua and Barbuda' },
+ { code: 'ARG', name: 'Argentina' },
+ { code: 'ARM', name: 'Armenia' },
+ { code: 'ABW', name: 'Aruba' },
+ { code: 'AUS', name: 'Australia' },
+ { code: 'AUT', name: 'Austria' },
+ { code: 'AZE', name: 'Azerbaijan' },
+ { code: 'BHS', name: 'Bahamas' },
+ { code: 'BHR', name: 'Bahrain' },
+ { code: 'BGD', name: 'Bangladesh' },
+ { code: 'BRB', name: 'Barbados' },
+ { code: 'BLR', name: 'Belarus' },
+ { code: 'BEL', name: 'Belgium' },
+ { code: 'BLZ', name: 'Belize' },
+ { code: 'BEN', name: 'Benin' },
+ { code: 'BMU', name: 'Bermuda' },
+ { code: 'BTN', name: 'Bhutan' },
+ { code: 'BOL', name: 'Bolivia, Plurinational State of' },
+ { code: 'BES', name: 'Bonaire, Sint Eustatius and Saba' },
+ { code: 'BIH', name: 'Bosnia and Herzegovina' },
+ { code: 'BWA', name: 'Botswana' },
+ { code: 'BVT', name: 'Bouvet Island' },
+ { code: 'BRA', name: 'Brazil' },
+ { code: 'IOT', name: 'British Indian Ocean Territory' },
+ { code: 'BRN', name: 'Brunei Darussalam' },
+ { code: 'BGR', name: 'Bulgaria' },
+ { code: 'BFA', name: 'Burkina Faso' },
+ { code: 'BDI', name: 'Burundi' },
+ { code: 'KHM', name: 'Cambodia' },
+ { code: 'CMR', name: 'Cameroon' },
+ { code: 'CAN', name: 'Canada' },
+ { code: 'CPV', name: 'Cape Verde' },
+ { code: 'CYM', name: 'Cayman Islands' },
+ { code: 'CAF', name: 'Central African Republic' },
+ { code: 'TCD', name: 'Chad' },
+ { code: 'CHL', name: 'Chile' },
+ { code: 'CHN', name: 'China' },
+ { code: 'CXR', name: 'Christmas Island' },
+ { code: 'CCK', name: 'Cocos (Keeling) Islands' },
+ { code: 'COL', name: 'Colombia' },
+ { code: 'COM', name: 'Comoros' },
+ { code: 'COG', name: 'Congo' },
+ { code: 'COD', name: 'Congo, the Democratic Republic of the' },
+ { code: 'COK', name: 'Cook Islands' },
+ { code: 'CRI', name: 'Costa Rica' },
+ { code: 'CIV', name: "Côte d'Ivoire" },
+ { code: 'HRV', name: 'Croatia' },
+ { code: 'CUB', name: 'Cuba' },
+ { code: 'CUW', name: 'Curaçao' },
+ { code: 'CYP', name: 'Cyprus' },
+ { code: 'CZE', name: 'Czech Republic' },
+ { code: 'DNK', name: 'Denmark' },
+ { code: 'DJI', name: 'Djibouti' },
+ { code: 'DMA', name: 'Dominica' },
+ { code: 'DOM', name: 'Dominican Republic' },
+ { code: 'ECU', name: 'Ecuador' },
+ { code: 'EGY', name: 'Egypt' },
+ { code: 'SLV', name: 'El Salvador' },
+ { code: 'GNQ', name: 'Equatorial Guinea' },
+ { code: 'ERI', name: 'Eritrea' },
+ { code: 'EST', name: 'Estonia' },
+ { code: 'ETH', name: 'Ethiopia' },
+ { code: 'FLK', name: 'Falkland Islands (Malvinas)' },
+ { code: 'FRO', name: 'Faroe Islands' },
+ { code: 'FJI', name: 'Fiji' },
+ { code: 'FIN', name: 'Finland' },
+ { code: 'FRA', name: 'France' },
+ { code: 'GUF', name: 'French Guiana' },
+ { code: 'PYF', name: 'French Polynesia' },
+ { code: 'ATF', name: 'French Southern Territories' },
+ { code: 'GAB', name: 'Gabon' },
+ { code: 'GMB', name: 'Gambia' },
+ { code: 'GEO', name: 'Georgia' },
+ { code: 'DEU', name: 'Germany' },
+ { code: 'GHA', name: 'Ghana' },
+ { code: 'GIB', name: 'Gibraltar' },
+ { code: 'GRC', name: 'Greece' },
+ { code: 'GRL', name: 'Greenland' },
+ { code: 'GRD', name: 'Grenada' },
+ { code: 'GLP', name: 'Guadeloupe' },
+ { code: 'GUM', name: 'Guam' },
+ { code: 'GTM', name: 'Guatemala' },
+ { code: 'GGY', name: 'Guernsey' },
+ { code: 'GIN', name: 'Guinea' },
+ { code: 'GNB', name: 'Guinea-Bissau' },
+ { code: 'GUY', name: 'Guyana' },
+ { code: 'HTI', name: 'Haiti' },
+ { code: 'HMD', name: 'Heard Island and McDonald Islands' },
+ { code: 'VAT', name: 'Holy See (Vatican City State)' },
+ { code: 'HND', name: 'Honduras' },
+ { code: 'HKG', name: 'Hong Kong' },
+ { code: 'HUN', name: 'Hungary' },
+ { code: 'ISL', name: 'Iceland' },
+ { code: 'IND', name: 'India' },
+ { code: 'IDN', name: 'Indonesia' },
+ { code: 'IRN', name: 'Iran, Islamic Republic of' },
+ { code: 'IRQ', name: 'Iraq' },
+ { code: 'IRL', name: 'Ireland' },
+ { code: 'IMN', name: 'Isle of Man' },
+ { code: 'ISR', name: 'Israel' },
+ { code: 'ITA', name: 'Italy' },
+ { code: 'JAM', name: 'Jamaica' },
+ { code: 'JPN', name: 'Japan' },
+ { code: 'JEY', name: 'Jersey' },
+ { code: 'JOR', name: 'Jordan' },
+ { code: 'KAZ', name: 'Kazakhstan' },
+ { code: 'KEN', name: 'Kenya' },
+ { code: 'KIR', name: 'Kiribati' },
+ { code: 'PRK', name: "Korea, Democratic People's Republic of" },
+ { code: 'KOR', name: 'Korea, Republic of' },
+ { code: 'KWT', name: 'Kuwait' },
+ { code: 'KGZ', name: 'Kyrgyzstan' },
+ { code: 'LAO', name: "Lao People's Democratic Republic" },
+ { code: 'LVA', name: 'Latvia' },
+ { code: 'LBN', name: 'Lebanon' },
+ { code: 'LSO', name: 'Lesotho' },
+ { code: 'LBR', name: 'Liberia' },
+ { code: 'LBY', name: 'Libya' },
+ { code: 'LIE', name: 'Liechtenstein' },
+ { code: 'LTU', name: 'Lithuania' },
+ { code: 'LUX', name: 'Luxembourg' },
+ { code: 'MAC', name: 'Macao' },
+ { code: 'MKD', name: 'Macedonia, the former Yugoslav Republic of' },
+ { code: 'MDG', name: 'Madagascar' },
+ { code: 'MWI', name: 'Malawi' },
+ { code: 'MYS', name: 'Malaysia' },
+ { code: 'MDV', name: 'Maldives' },
+ { code: 'MLI', name: 'Mali' },
+ { code: 'MLT', name: 'Malta' },
+ { code: 'MHL', name: 'Marshall Islands' },
+ { code: 'MTQ', name: 'Martinique' },
+ { code: 'MRT', name: 'Mauritania' },
+ { code: 'MUS', name: 'Mauritius' },
+ { code: 'MYT', name: 'Mayotte' },
+ { code: 'MEX', name: 'Mexico' },
+ { code: 'FSM', name: 'Micronesia, Federated States of' },
+ { code: 'MDA', name: 'Moldova, Republic of' },
+ { code: 'MCO', name: 'Monaco' },
+ { code: 'MNG', name: 'Mongolia' },
+ { code: 'MNE', name: 'Montenegro' },
+ { code: 'MSR', name: 'Montserrat' },
+ { code: 'MAR', name: 'Morocco' },
+ { code: 'MOZ', name: 'Mozambique' },
+ { code: 'MMR', name: 'Myanmar' },
+ { code: 'NAM', name: 'Namibia' },
+ { code: 'NRU', name: 'Nauru' },
+ { code: 'NPL', name: 'Nepal' },
+ { code: 'NLD', name: 'Netherlands' },
+ { code: 'NCL', name: 'New Caledonia' },
+ { code: 'NZL', name: 'New Zealand' },
+ { code: 'NIC', name: 'Nicaragua' },
+ { code: 'NER', name: 'Niger' },
+ { code: 'NGA', name: 'Nigeria' },
+ { code: 'NIU', name: 'Niue' },
+ { code: 'NFK', name: 'Norfolk Island' },
+ { code: 'MNP', name: 'Northern Mariana Islands' },
+ { code: 'NOR', name: 'Norway' },
+ { code: 'OMN', name: 'Oman' },
+ { code: 'PAK', name: 'Pakistan' },
+ { code: 'PLW', name: 'Palau' },
+ { code: 'PSE', name: 'Palestinian Territory, Occupied' },
+ { code: 'PAN', name: 'Panama' },
+ { code: 'PNG', name: 'Papua New Guinea' },
+ { code: 'PRY', name: 'Paraguay' },
+ { code: 'PER', name: 'Peru' },
+ { code: 'PHL', name: 'Philippines' },
+ { code: 'PCN', name: 'Pitcairn' },
+ { code: 'POL', name: 'Poland' },
+ { code: 'PRT', name: 'Portugal' },
+ { code: 'PRI', name: 'Puerto Rico' },
+ { code: 'QAT', name: 'Qatar' },
+ { code: 'REU', name: 'Réunion' },
+ { code: 'ROU', name: 'Romania' },
+ { code: 'RUS', name: 'Russian Federation' },
+ { code: 'RWA', name: 'Rwanda' },
+ { code: 'BLM', name: 'Saint Barthélemy' },
+ { code: 'SHN', name: 'Saint Helena, Ascension and Tristan da Cunha' },
+ { code: 'KNA', name: 'Saint Kitts and Nevis' },
+ { code: 'LCA', name: 'Saint Lucia' },
+ { code: 'MAF', name: 'Saint Martin (French part)' },
+ { code: 'SPM', name: 'Saint Pierre and Miquelon' },
+ { code: 'VCT', name: 'Saint Vincent and the Grenadines' },
+ { code: 'WSM', name: 'Samoa' },
+ { code: 'SMR', name: 'San Marino' },
+ { code: 'STP', name: 'Sao Tome and Principe' },
+ { code: 'SAU', name: 'Saudi Arabia' },
+ { code: 'SEN', name: 'Senegal' },
+ { code: 'SRB', name: 'Serbia' },
+ { code: 'SYC', name: 'Seychelles' },
+ { code: 'SLE', name: 'Sierra Leone' },
+ { code: 'SGP', name: 'Singapore' },
+ { code: 'SXM', name: 'Sint Maarten (Dutch part)' },
+ { code: 'SVK', name: 'Slovakia' },
+ { code: 'SVN', name: 'Slovenia' },
+ { code: 'SLB', name: 'Solomon Islands' },
+ { code: 'SOM', name: 'Somalia' },
+ { code: 'ZAF', name: 'South Africa' },
+ { code: 'SGS', name: 'South Georgia and the South Sandwich Islands' },
+ { code: 'SSD', name: 'South Sudan' },
+ { code: 'ESP', name: 'Spain' },
+ { code: 'LKA', name: 'Sri Lanka' },
+ { code: 'SDN', name: 'Sudan' },
+ { code: 'SUR', name: 'Suriname' },
+ { code: 'SJM', name: 'Svalbard and Jan Mayen' },
+ { code: 'SWZ', name: 'Swaziland' },
+ { code: 'SWE', name: 'Sweden' },
+ { code: 'CHE', name: 'Switzerland' },
+ { code: 'SYR', name: 'Syrian Arab Republic' },
+ { code: 'TWN', name: 'Taiwan, Province of China' },
+ { code: 'TJK', name: 'Tajikistan' },
+ { code: 'TZA', name: 'Tanzania, United Republic of' },
+ { code: 'THA', name: 'Thailand' },
+ { code: 'TLS', name: 'Timor-Leste' },
+ { code: 'TGO', name: 'Togo' },
+ { code: 'TKL', name: 'Tokelau' },
+ { code: 'TON', name: 'Tonga' },
+ { code: 'TTO', name: 'Trinidad and Tobago' },
+ { code: 'TUN', name: 'Tunisia' },
+ { code: 'TUR', name: 'Turkey' },
+ { code: 'TKM', name: 'Turkmenistan' },
+ { code: 'TCA', name: 'Turks and Caicos Islands' },
+ { code: 'TUV', name: 'Tuvalu' },
+ { code: 'UGA', name: 'Uganda' },
+ { code: 'UKR', name: 'Ukraine' },
+ { code: 'ARE', name: 'United Arab Emirates' },
+ { code: 'GBR', name: 'United Kingdom' },
+ { code: 'USA', name: 'United States' },
+ { code: 'UMI', name: 'United States Minor Outlying Islands' },
+ { code: 'URY', name: 'Uruguay' },
+ { code: 'UZB', name: 'Uzbekistan' },
+ { code: 'VUT', name: 'Vanuatu' },
+ { code: 'VEN', name: 'Venezuela, Bolivarian Republic of' },
+ { code: 'VNM', name: 'Viet Nam' },
+ { code: 'VGB', name: 'Virgin Islands, British' },
+ { code: 'VIR', name: 'Virgin Islands, U.S.' },
+ { code: 'WLF', name: 'Wallis and Futuna' },
+ { code: 'ESH', name: 'Western Sahara' },
+ { code: 'YEM', name: 'Yemen' },
+ { code: 'ZMB', name: 'Zambia' },
+ { code: 'ZWE', name: 'Zimbabwe' }
+];
diff --git a/web/src/libs/dom.ts b/web/src/libs/dom.ts
new file mode 100644
index 00000000..db7b6217
--- /dev/null
+++ b/web/src/libs/dom.ts
@@ -0,0 +1,126 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { mdBreakpoint } from '../components/App/_variables.scss';
+
+// catchBlur focuses rootEl if the next focused element is outside the rootEl
+export function catchBlur(event, rootEl) {
+ if (!rootEl) {
+ return;
+ }
+
+ // If the next focus was outside the content
+ if (!rootEl.contains(event.relatedTarget)) {
+ rootEl.focus();
+ }
+}
+
+// getScrollbarWidth measures the width of the browser's scroll bar in pixels and returns it
+export function getScrollbarWidth() {
+ const scrollDiv = document.createElement('div');
+ scrollDiv.className = 'scrollbar-measure';
+ document.body.appendChild(scrollDiv);
+ const scrollbarWidth =
+ scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
+ document.body.removeChild(scrollDiv);
+ return scrollbarWidth;
+}
+
+// scrollTo scrolls the given element to the given position
+export function scrollTo(element: HTMLElement, posY: number) {
+ if (document.body === element) {
+ window.scrollTo(0, posY);
+ } else {
+ // eslint-disable-next-line no-param-reassign
+ element.scrollTop = posY;
+ }
+}
+
+// focusTextarea focuses on the given text area element and moves the cursor to the last position
+export function focusTextarea(el: HTMLTextAreaElement) {
+ el.focus();
+
+ // Move the cursor to the last position
+ const len = el.value.length;
+ el.setSelectionRange(len, len);
+}
+
+export function checkVerticalScoll() {
+ if (window.innerHeight) {
+ return document.body.offsetHeight > window.innerHeight;
+ }
+
+ return (
+ document.documentElement.scrollHeight >
+ document.documentElement.offsetHeight ||
+ document.body.scrollHeight > document.body.offsetHeight
+ );
+}
+
+// getViewportDimensions returns the dimension of the viewport
+export function getViewportDimensions() {
+ const width = Math.max(
+ document.documentElement.clientWidth,
+ window.innerWidth || 0
+ );
+ const height = Math.max(
+ document.documentElement.clientHeight,
+ window.innerHeight || 0
+ );
+
+ return {
+ width,
+ height
+ };
+}
+
+function pxToNumber(px: string): number {
+ const str = px.substring(0, px.length - 2);
+
+ return Number.parseFloat(str);
+}
+
+export function isMobileWidth() {
+ const { width } = getViewportDimensions();
+
+ const mdThreshold = pxToNumber(mdBreakpoint);
+
+ return width < mdThreshold;
+}
+
+// copyToClipboard copies the given string to the user's clipboard
+export function copyToClipboard(s: string) {
+ const el = document.createElement('textarea');
+ el.value = s;
+ document.body.appendChild(el);
+ el.select();
+ document.execCommand('copy');
+ document.body.removeChild(el);
+}
+
+// selectTextInputValue visually selects the value of the given text input
+export function selectTextInputValue(
+ el: HTMLInputElement | HTMLTextAreaElement
+) {
+ const len = el.value.length;
+ el.setSelectionRange(0, len);
+}
+
+export function getScrollYPos(): number {
+ return window.pageYOffset || document.documentElement.scrollTop;
+}
diff --git a/web/src/libs/editor.spec.ts b/web/src/libs/editor.spec.ts
new file mode 100644
index 00000000..911061ef
--- /dev/null
+++ b/web/src/libs/editor.spec.ts
@@ -0,0 +1,47 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { getEditorSessionkey } from './editor';
+
+describe('editor.ts', () => {
+ describe('getEditorSessionkey', () => {
+ const testCases = [
+ {
+ noteUUID: null,
+ expected: 'new'
+ },
+ {
+ noteUUID: '0ad88090-ab44-4432-be80-09c033f4c582',
+ expected: '0ad88090-ab44-4432-be80-09c033f4c582'
+ },
+ {
+ noteUUID: '6c20d136-8a15-443b-bd58-d2d963d38938',
+ expected: '6c20d136-8a15-443b-bd58-d2d963d38938'
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; i++) {
+ const tc = testCases[i];
+
+ test(`generates a session key for input: ${tc.noteUUID}`, () => {
+ const result = getEditorSessionkey(tc.noteUUID);
+ expect(result).toBe(tc.expected);
+ });
+ }
+ });
+});
diff --git a/web/src/libs/editor.ts b/web/src/libs/editor.ts
new file mode 100644
index 00000000..9a13adb8
--- /dev/null
+++ b/web/src/libs/editor.ts
@@ -0,0 +1,31 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// sessionKeyNew is the editor session key for a new note
+const sessionKeyNew = 'new';
+
+// getEditorSessionkey returns a unique editor session key for the given noteUUID.
+// If the noteUUID is null, it returns a session key for the new note.
+// Editor session holds an editor state for a particular note.
+export function getEditorSessionkey(noteUUID: string | null): string {
+ if (noteUUID === null) {
+ return sessionKeyNew;
+ }
+
+ return noteUUID;
+}
diff --git a/web/src/libs/encoding.js b/web/src/libs/encoding.js
new file mode 100644
index 00000000..4186ab7d
--- /dev/null
+++ b/web/src/libs/encoding.js
@@ -0,0 +1,66 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// utf8ToBuf turns a given string into an ArrayBuffer
+export function utf8ToBuf(str) {
+ // convert to utf8 encoding
+ const strUtf8 = unescape(encodeURIComponent(str));
+
+ const buf = new ArrayBuffer(strUtf8.length);
+ const bufView = new Uint8Array(buf);
+ for (let i = 0; i < strUtf8.length; i++) {
+ bufView[i] = strUtf8.charCodeAt(i);
+ }
+
+ return buf;
+}
+
+// bufToUtf8 turns a given ArrayBuffer into a UTF-8 encoded string
+export function bufToUtf8(buf) {
+ const bytes = new Uint8Array(buf);
+ const encodedString = String.fromCharCode.apply(null, bytes);
+
+ return decodeURIComponent(escape(encodedString));
+}
+
+// bufToB64 encodes the given ArrayBuffer using base64
+export function bufToB64(buf) {
+ let binary = '';
+ const bytes = new Uint8Array(buf);
+ const len = bytes.byteLength;
+
+ for (let i = 0; i < len; i++) {
+ binary += String.fromCharCode(bytes[i]);
+ }
+
+ return window.btoa(binary);
+}
+
+// b64ToBuf turns a given base64 tring into an ArrayBuffer
+export function b64ToBuf(base64Str) {
+ const binary = window.atob(base64Str);
+ const len = binary.length;
+
+ const buf = new ArrayBuffer(len);
+ const bytes = new Uint8Array(buf);
+ for (let i = 0; i < len; i++) {
+ bytes[i] = binary.charCodeAt(i);
+ }
+
+ return buf;
+}
diff --git a/web/src/libs/encoding_test.js b/web/src/libs/encoding_test.js
new file mode 100644
index 00000000..3229514c
--- /dev/null
+++ b/web/src/libs/encoding_test.js
@@ -0,0 +1,72 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { expect } from 'chai';
+import { utf8ToBuf, bufToUtf8, bufToB64, b64ToBuf } from './encoding';
+
+describe('utf8ToBuf', () => {
+ it('converts a string to an ArrayBuffer', () => {
+ const result = utf8ToBuf('hi');
+ const buf = new ArrayBuffer(2);
+ const bufView = new Uint8Array(buf);
+
+ bufView[0] = 104;
+ bufView[1] = 105;
+ expect(result).to.deep.equal(buf);
+ });
+});
+
+describe('bufToUtf8', () => {
+ it('converts an ArrayBuffer to a UTF-8 string', () => {
+ const str = 'hi';
+ const buf = new ArrayBuffer(2);
+ const bufView = new Uint8Array(buf);
+ bufView[0] = str.charCodeAt(0);
+ bufView[1] = str.charCodeAt(1);
+
+ const result = bufToUtf8(buf);
+ expect(result).to.equal(str);
+ });
+});
+
+describe('bufToB64', () => {
+ it('encodes the given ArrayBuffer using base64', () => {
+ const str = 'hi';
+
+ const buf = new ArrayBuffer(2);
+ const bufView = new Uint8Array(buf);
+ bufView[0] = str.charCodeAt(0);
+ bufView[1] = str.charCodeAt(1);
+
+ const result = bufToB64(buf);
+ expect(result).to.equal('aGk=');
+ });
+});
+
+describe('b64ToBuf', () => {
+ it('converts the given base64 string into an ArrayBuffer', () => {
+ const buf = new ArrayBuffer(2);
+ const bufView = new Uint8Array(buf);
+ bufView[0] = 104;
+ bufView[1] = 105;
+
+ const str = 'aGk=';
+ const result = b64ToBuf(str);
+ expect(result).to.deep.equal(buf);
+ });
+});
diff --git a/web/src/libs/fts/lexer.spec.ts b/web/src/libs/fts/lexer.spec.ts
new file mode 100644
index 00000000..8ae1bca8
--- /dev/null
+++ b/web/src/libs/fts/lexer.spec.ts
@@ -0,0 +1,221 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { TokenKind, tokenize, scanToken } from './lexer';
+
+describe('lexer.ts', () => {
+ describe('scanToken', () => {
+ const testCases = [
+ {
+ input: 'foo bar',
+ idx: 1,
+ retTok: { value: 'o', kind: TokenKind.char },
+ retIdx: 2
+ },
+ {
+ input: 'foo bar',
+ idx: 6,
+ retTok: { value: 'r', kind: TokenKind.char },
+ retIdx: -1
+ },
+ {
+ input: 'foo ',
+ idx: 4,
+ retTok: { value: '<', kind: TokenKind.char },
+ retIdx: 5
+ },
+ {
+ input: 'foo ',
+ idx: 4,
+ retTok: { value: '<', kind: TokenKind.char },
+ retIdx: 5
+ },
+ {
+ input: 'foo bar foo bar',
+ idx: 4,
+ retTok: { kind: TokenKind.hlBegin },
+ retIdx: 13
+ },
+ {
+ input: 'foo bar foo bar',
+ idx: 4,
+ retTok: { kind: TokenKind.hlBegin },
+ retIdx: 13
+ },
+ {
+ input: 'foo bar foo bar',
+ idx: 27,
+ retTok: { kind: TokenKind.hlBegin },
+ retIdx: 36
+ },
+ {
+ input: 'foo bar foo bar',
+ idx: 13,
+ retTok: { value: 'b', kind: TokenKind.char },
+ retIdx: 14
+ },
+ {
+ input: 'foo bar foo bar',
+ idx: 16,
+ retTok: { kind: TokenKind.hlEnd },
+ retIdx: 26
+ },
+ {
+ input: 'tehl>',
+ idx: 0,
+ retTok: { value: '<', kind: TokenKind.char },
+ retIdx: 1
+ },
+ {
+ input: 'tehl>',
+ idx: 4,
+ retTok: { kind: TokenKind.hlBegin },
+ retIdx: 13
+ },
+ {
+ input: 'foo bar ',
+ idx: 16,
+ retTok: { kind: TokenKind.hlEnd },
+ retIdx: -1
+ },
+ // user writes reserved token
+ {
+ input: 'foo ',
+ idx: 4,
+ retTok: { kind: TokenKind.hlBegin },
+ retIdx: -1
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; i++) {
+ const tc = testCases[i];
+
+ test(`scans ${tc.input}`, () => {
+ const result = scanToken(tc.idx, tc.input);
+
+ expect(result.tok).toEqual(tc.retTok);
+ });
+ }
+ });
+
+ describe('tokenize', () => {
+ const testCases = [
+ {
+ input: 'abc ',
+ tokens: [
+ {
+ kind: TokenKind.char,
+ value: 'a'
+ },
+ {
+ kind: TokenKind.char,
+ value: 'b'
+ },
+ {
+ kind: TokenKind.hlBegin
+ },
+ {
+ kind: TokenKind.char,
+ value: 'c'
+ },
+ {
+ kind: TokenKind.hlEnd
+ },
+ {
+ kind: TokenKind.eol
+ }
+ ]
+ },
+ {
+ input: 'abc d',
+ tokens: [
+ {
+ kind: TokenKind.char,
+ value: 'a'
+ },
+ {
+ kind: TokenKind.char,
+ value: 'b'
+ },
+ {
+ kind: TokenKind.hlBegin
+ },
+ {
+ kind: TokenKind.char,
+ value: 'c'
+ },
+ {
+ kind: TokenKind.hlEnd
+ },
+ {
+ kind: TokenKind.char,
+ value: 'd'
+ },
+ {
+ kind: TokenKind.eol
+ }
+ ]
+ },
+ // user writes a reserved token
+ {
+ input: ' ',
+ tokens: [
+ {
+ kind: TokenKind.hlBegin
+ },
+ {
+ kind: TokenKind.hlBegin
+ },
+ {
+ kind: TokenKind.hlEnd
+ },
+ {
+ kind: TokenKind.eol
+ }
+ ]
+ },
+ {
+ input: ' ',
+ tokens: [
+ {
+ kind: TokenKind.hlBegin
+ },
+ {
+ kind: TokenKind.hlEnd
+ },
+ {
+ kind: TokenKind.hlEnd
+ },
+ {
+ kind: TokenKind.eol
+ }
+ ]
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; i++) {
+ const tc = testCases[i];
+
+ test(`tokenizes ${tc.input}`, () => {
+ const result = tokenize(tc.input);
+
+ expect(result).toEqual(tc.tokens);
+ });
+ }
+ });
+});
diff --git a/web/src/libs/fts/lexer.ts b/web/src/libs/fts/lexer.ts
new file mode 100644
index 00000000..9aaf3a73
--- /dev/null
+++ b/web/src/libs/fts/lexer.ts
@@ -0,0 +1,106 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export enum TokenKind {
+ char,
+ hlBegin,
+ hlEnd,
+ eol
+}
+
+export interface Token {
+ kind: TokenKind;
+ value?: string;
+}
+
+interface ScanTokenResult {
+ tok: Token;
+ nextIdx: number;
+}
+
+// getNextIdx validates that the given index is within the range of the given string.
+// If so, it returns the given index. Otherwise it returns -1.
+function getNextIdx(candidate: number, s: string): number {
+ if (candidate <= s.length - 1) {
+ return candidate;
+ }
+
+ return -1;
+}
+
+// scanToken scans the given string for a token at the given index. It returns
+// a token and the next index to look for a token. If the given string is exhausted,
+// the next index will be -1.
+export function scanToken(idx: number, s: string): ScanTokenResult {
+ if (s[idx] === '<') {
+ if (s.length - idx >= 9) {
+ const lookahead = 9;
+ const candidate = s.substring(idx, idx + lookahead);
+
+ if (candidate === '') {
+ return {
+ tok: {
+ kind: TokenKind.hlBegin
+ },
+ nextIdx: getNextIdx(idx + lookahead, s)
+ };
+ }
+ }
+
+ if (s.length - idx >= 10) {
+ const lookahead = 10;
+ const candidate = s.substring(idx, idx + lookahead);
+
+ if (candidate === ' ') {
+ return {
+ tok: {
+ kind: TokenKind.hlEnd
+ },
+ nextIdx: getNextIdx(idx + lookahead, s)
+ };
+ }
+ }
+ }
+
+ const nextIdx = getNextIdx(idx + 1, s);
+ return {
+ tok: {
+ value: s[idx],
+ kind: TokenKind.char
+ },
+ nextIdx
+ };
+}
+
+// tokenize lexically analyzes the given matched snippet from a full text search
+// and builds a slice of tokens
+export function tokenize(s: string): Token[] {
+ const ret: Token[] = [];
+
+ let idx = 0;
+ while (idx !== -1) {
+ const { tok, nextIdx } = scanToken(idx, s);
+
+ idx = nextIdx;
+ ret.push(tok);
+ }
+
+ ret.push({ kind: TokenKind.eol });
+
+ return ret;
+}
diff --git a/web/src/libs/hooks/dom.ts b/web/src/libs/hooks/dom.ts
new file mode 100644
index 00000000..2d03f25a
--- /dev/null
+++ b/web/src/libs/hooks/dom.ts
@@ -0,0 +1,176 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { useEffect, useCallback, useRef } from 'react';
+
+import {
+ KEYCODE_DOWN,
+ KEYCODE_UP,
+ KEYCODE_ENTER,
+ KEYCODE_ESC
+} from 'jslib/helpers/keyboard';
+import { Option } from 'jslib/helpers/select';
+import { useEventListener } from './index';
+import { scrollTo } from '../dom';
+
+interface ScrollToSelectedParams {
+ shouldScroll: boolean;
+ offset: number;
+ selectedOptEl: HTMLElement;
+ containerEl: HTMLElement;
+}
+
+export function useScrollToSelected({
+ shouldScroll,
+ offset,
+ selectedOptEl,
+ containerEl
+}: ScrollToSelectedParams) {
+ useEffect(() => {
+ if (!shouldScroll || !selectedOptEl || !containerEl) {
+ return;
+ }
+
+ const { scrollTop } = containerEl;
+ const scrollBottom = scrollTop + containerEl.offsetHeight;
+ const optionTop = selectedOptEl.offsetTop;
+ const optionBottom = optionTop + selectedOptEl.offsetHeight;
+
+ if (scrollTop > optionTop || scrollBottom < optionBottom) {
+ // eslint-disable-next-line no-param-reassign
+ containerEl.scrollTop = selectedOptEl.offsetTop - offset;
+ }
+ }, [shouldScroll, selectedOptEl, offset, containerEl]);
+}
+
+interface ScrollToFocusedParms {
+ shouldScroll: boolean;
+ offset?: number;
+ focusedOptEl: HTMLElement;
+ containerEl: HTMLElement;
+}
+
+export function useScrollToFocused({
+ shouldScroll,
+ offset = 0,
+ focusedOptEl,
+ containerEl
+}: ScrollToFocusedParms) {
+ useEffect(() => {
+ if (!shouldScroll || !focusedOptEl || !containerEl) {
+ return;
+ }
+
+ let visibleHeight;
+ if (containerEl === document.body) {
+ visibleHeight = window.innerHeight;
+ } else {
+ visibleHeight = containerEl.offsetHeight;
+ }
+
+ const posY =
+ focusedOptEl.offsetTop +
+ focusedOptEl.clientHeight -
+ visibleHeight / 2 -
+ offset;
+
+ scrollTo(containerEl, posY);
+ }, [containerEl, focusedOptEl, offset, shouldScroll]);
+}
+
+export type KeydownSelectFn = (T) => void;
+
+interface SearchMenuKeydownParams {
+ options: T[];
+ containerEl: HTMLElement;
+ focusedIdx: number;
+ setFocusedIdx: (number) => void;
+ onKeydownSelect: KeydownSelectFn;
+ setIsOpen?: (boolean) => void;
+ disabled?: boolean;
+}
+
+export function useSearchMenuKeydown({
+ options,
+ containerEl,
+ focusedIdx,
+ setFocusedIdx,
+ setIsOpen,
+ onKeydownSelect,
+ disabled
+}: SearchMenuKeydownParams) {
+ useEventListener(containerEl, 'keydown', e => {
+ if (disabled) {
+ return;
+ }
+
+ const { keyCode } = e;
+
+ if (keyCode === KEYCODE_UP || keyCode === KEYCODE_DOWN) {
+ e.preventDefault();
+
+ let nextOptionIdx;
+ if (focusedIdx === 0 && keyCode === KEYCODE_UP) {
+ nextOptionIdx = options.length - 1;
+ } else if (
+ focusedIdx === options.length - 1 &&
+ keyCode === KEYCODE_DOWN
+ ) {
+ nextOptionIdx = 0;
+ } else if (keyCode === KEYCODE_DOWN) {
+ nextOptionIdx = focusedIdx + 1;
+ } else if (keyCode === KEYCODE_UP) {
+ nextOptionIdx = focusedIdx - 1;
+ }
+
+ setFocusedIdx(nextOptionIdx);
+ } else if (keyCode === KEYCODE_ENTER) {
+ e.preventDefault();
+ const focusedOption = options[focusedIdx];
+
+ if (setIsOpen) {
+ setIsOpen(false);
+ }
+
+ if (onKeydownSelect) {
+ onKeydownSelect(focusedOption);
+ }
+ } else if (keyCode === KEYCODE_ESC) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ if (setIsOpen) {
+ setIsOpen(false);
+ }
+ }
+ });
+}
+
+export function useFocus() {
+ const elRef = useRef();
+
+ const setFocus = useCallback(() => {
+ const currentEl = elRef.current;
+
+ if (currentEl) {
+ currentEl.focus();
+ }
+ }, []);
+
+ return [setFocus, elRef] as const;
+}
diff --git a/web/src/libs/hooks/editor.ts b/web/src/libs/hooks/editor.ts
new file mode 100644
index 00000000..72ff981a
--- /dev/null
+++ b/web/src/libs/hooks/editor.ts
@@ -0,0 +1,31 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { useEffect } from 'react';
+
+import { focusTextarea } from 'web/libs/dom';
+
+// useFocusTextarea is a hook that, when the given textareaEl becomes
+// defined, focuses on it.
+export function useFocusTextarea(textareaEl: HTMLTextAreaElement) {
+ useEffect(() => {
+ if (textareaEl) {
+ focusTextarea(textareaEl);
+ }
+ }, [textareaEl]);
+}
diff --git a/web/src/libs/hooks/index.ts b/web/src/libs/hooks/index.ts
new file mode 100644
index 00000000..0ab6ba3e
--- /dev/null
+++ b/web/src/libs/hooks/index.ts
@@ -0,0 +1,92 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { useRef, useEffect, useState } from 'react';
+
+// usePrevious is a hook that saves the current value to be used later
+export function usePrevious(value: T): T | null {
+ const ref = useRef(null);
+ useEffect(() => {
+ ref.current = value;
+ });
+
+ return ref.current;
+}
+
+// useEventListener adds an event listener to the target and clears it when the
+// component unmounts
+export function useEventListener(target, type, listener) {
+ const noop = e => e;
+ const savedListener = useRef(noop);
+
+ useEffect(() => {
+ savedListener.current = listener;
+ });
+
+ useEffect(() => {
+ if (!target) {
+ return () => null;
+ }
+
+ function fn(e) {
+ savedListener.current(e);
+ }
+
+ target.addEventListener(type, fn);
+
+ return () => {
+ target.removeEventListener(type, fn);
+ };
+ }, [type, target]);
+}
+
+// useScript loads a third party script
+export function useScript(src: string): [boolean, string] {
+ const [loaded, setLoaded] = useState(false);
+ const [error, setError] = useState('');
+
+ useEffect(() => {
+ if (loaded || error) {
+ return () => null;
+ }
+
+ const script = document.createElement('script');
+ script.src = src;
+ script.async = true;
+
+ function onLoad() {
+ setLoaded(true);
+ }
+ function onError(err) {
+ setError(err.message);
+ script.remove();
+ }
+
+ script.addEventListener('load', onLoad);
+ script.addEventListener('error', onError);
+
+ document.head.appendChild(script);
+
+ return () => {
+ script.removeEventListener('load', onLoad);
+ script.removeEventListener('error', onError);
+ };
+ }, [src, loaded, error]);
+
+ return [loaded, error];
+}
diff --git a/web/src/libs/localStorage.ts b/web/src/libs/localStorage.ts
new file mode 100644
index 00000000..41341035
--- /dev/null
+++ b/web/src/libs/localStorage.ts
@@ -0,0 +1,51 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { AppState } from '../store';
+
+// stateKey is the key under which the application state is persisted. It is
+// versioned to accommodate any backward incomptaible changes to the store.
+const stateKey = 'state-v0';
+
+// loadState parses the serialized state tree stored in the localStorage
+// and returns it
+export function loadState(): Partial {
+ try {
+ const serialized = localStorage.getItem(stateKey);
+
+ if (serialized === null) {
+ return undefined;
+ }
+
+ return JSON.parse(serialized);
+ } catch (e) {
+ console.log('Unable load state from the localStorage', e.message);
+ return undefined;
+ }
+}
+
+// saveState writes the given state to localStorage
+export function saveState(state: Partial) {
+ try {
+ const serialized = JSON.stringify(state);
+
+ localStorage.setItem(stateKey, serialized);
+ } catch (e) {
+ console.log('Unable save to the localStorage', e.message);
+ }
+}
diff --git a/web/src/libs/notes.ts b/web/src/libs/notes.ts
new file mode 100644
index 00000000..dde6c5f8
--- /dev/null
+++ b/web/src/libs/notes.ts
@@ -0,0 +1,92 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { NoteData, UserData } from '../../../jslib/src/operations/types';
+
+export interface NotesGroupData {
+ year: number;
+ month: number;
+ data: NoteData[];
+}
+
+function encodeGroupKey(year: number, month: number): string {
+ return `${year}-${month}`;
+}
+
+function decodeGroupKey(key: string): { year: number; month: number } {
+ const [yearStr, monthStr] = key.split('-');
+
+ const year = parseInt(yearStr, 10);
+ const month = parseInt(monthStr, 10);
+
+ return { year, month };
+}
+
+function makeGroup(
+ year: number,
+ month: number,
+ notes: NoteData[]
+): NotesGroupData {
+ return {
+ year,
+ month,
+ data: notes
+ };
+}
+
+// groupNotes groups the notes to note groups based on the updated_at timestamp
+export function groupNotes(notes: NoteData[]): NotesGroupData[] {
+ const ret: NotesGroupData[] = [];
+
+ const map: { [key: string]: NoteData[] } = {};
+
+ for (let i = 0; i < notes.length; i++) {
+ const note = notes[i];
+
+ const updatedAt = new Date(note.updatedAt).getTime();
+ const date = new Date(updatedAt);
+ const year = date.getUTCFullYear();
+ const month = date.getUTCMonth() + 1;
+
+ const key = encodeGroupKey(year, month);
+
+ if (map[key]) {
+ map[key].push(note);
+ } else {
+ map[key] = [note];
+ }
+ }
+
+ const keys = Object.keys(map);
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ const items = map[key];
+
+ const { year, month } = decodeGroupKey(key);
+
+ const group = makeGroup(year, month, items);
+ ret.push(group);
+ }
+
+ return ret;
+}
+
+// checkOwner checks if the given note belongs to the given user
+export function checkOwner(note: NoteData, user: UserData): boolean {
+ return note.user.uuid === user.uuid;
+}
diff --git a/web/src/libs/operations.ts b/web/src/libs/operations.ts
new file mode 100644
index 00000000..5f71c97e
--- /dev/null
+++ b/web/src/libs/operations.ts
@@ -0,0 +1,26 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import initOperations from 'jslib/operations';
+
+const operations = initOperations({
+ baseUrl: '',
+ pathPrefix: '/api'
+});
+
+export default operations;
diff --git a/web/src/libs/paths.spec.ts b/web/src/libs/paths.spec.ts
new file mode 100644
index 00000000..463ef363
--- /dev/null
+++ b/web/src/libs/paths.spec.ts
@@ -0,0 +1,61 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+/* eslint-disable no-loop-func */
+
+import { populateParams } from './paths';
+
+describe('paths.ts', () => {
+ describe('populateParams', () => {
+ const testCases = [
+ {
+ pathDef: '/foo/:bar',
+ params: {
+ bar: '123'
+ },
+ expected: '/foo/123'
+ },
+ {
+ pathDef: '/foo/:bar/baz',
+ params: {
+ bar: '123'
+ },
+ expected: '/foo/123/baz'
+ },
+ {
+ pathDef: '/foo/:bar/:baz/:quz/qux',
+ params: {
+ bar: '123',
+ baz: '456',
+ quz: 'abcd'
+ },
+ expected: '/foo/123/456/abcd/qux'
+ }
+ ];
+
+ for (let i = 0; i < testCases.length; i++) {
+ const tc = testCases[i];
+
+ const stringifiedParams = JSON.stringify(tc.params);
+ test(`populates ${tc.pathDef} with params ${stringifiedParams}`, () => {
+ const result = populateParams(tc.pathDef, tc.params);
+ expect(result).toBe(tc.expected);
+ });
+ }
+ });
+});
diff --git a/web/src/libs/paths.ts b/web/src/libs/paths.ts
new file mode 100644
index 00000000..e8ad335d
--- /dev/null
+++ b/web/src/libs/paths.ts
@@ -0,0 +1,212 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import qs from 'qs';
+import { matchPath } from 'react-router-dom';
+import { Location } from 'history';
+
+// path definitions
+export const homePathDef = '/';
+export const notePathDef = '/notes/:noteUUID';
+export const noteEditPathDef = '/notes/:noteUUID/edit';
+export const noteNewPathDef = '/new';
+export const booksPathDef = '/books';
+export const loginPathDef = '/login';
+export const joinPathDef = '/join';
+export const settingsPathDef = '/settings/:section';
+export const verifyEmailPathDef = '/verify-email/:token';
+export const passwordResetRequestPathDef = '/password-reset';
+export const passwordResetConfirmPathDef = '/password-reset/:token';
+export const emailPreferencePathDef = '/email-preferences';
+
+// layout definitions
+export const noHeaderPaths = [
+ loginPathDef,
+ joinPathDef,
+ verifyEmailPathDef,
+ passwordResetRequestPathDef,
+ passwordResetConfirmPathDef,
+ emailPreferencePathDef
+];
+export const noFooterPaths = [
+ loginPathDef,
+ joinPathDef,
+ verifyEmailPathDef,
+ passwordResetRequestPathDef,
+ passwordResetConfirmPathDef,
+ emailPreferencePathDef
+];
+
+// filterSearchObj filters the given search object and returns a new object
+function filterSearchObj(obj) {
+ const ret: any = {};
+
+ const keys = Object.keys(obj);
+ for (let i = 0; i < keys.length; ++i) {
+ const key = keys[i];
+ const val = obj[key];
+
+ // reject empty string
+ if (val !== '') {
+ ret[key] = val;
+ }
+ }
+
+ // page is implicitly 1
+ if (ret.page === 1) {
+ delete ret.page;
+ }
+
+ return ret;
+}
+
+interface GetLocationParams {
+ pathname: string;
+ searchObj?: any;
+ state?: any;
+}
+
+function getLocation({
+ pathname,
+ searchObj,
+ state
+}: GetLocationParams): Location {
+ const ret: Location = { pathname, search: '', state, hash: '' };
+
+ if (searchObj) {
+ const o = filterSearchObj(searchObj);
+
+ ret.search = qs.stringify(o, { arrayFormat: 'repeat' });
+ }
+ if (state) {
+ ret.state = state;
+ }
+
+ return ret;
+}
+
+export function getNewPath(searchObj = {}): Location {
+ return getLocation({ pathname: noteNewPathDef, searchObj });
+}
+
+export function getRandomPath(searchObj = {}): Location {
+ return getLocation({ pathname: '/random', searchObj });
+}
+
+export function getHomePath(searchObj = {}): Location {
+ return getLocation({ pathname: homePathDef, searchObj });
+}
+
+export function getBooksPath(searchObj = {}): Location {
+ return getLocation({ pathname: booksPathDef, searchObj });
+}
+
+export function populateParams(pathDef: string, params: any) {
+ const parts = pathDef.split('/');
+
+ const builder = [];
+ for (let i = 0; i < parts.length; ++i) {
+ const p = parts[i];
+ if (p[0] === ':') {
+ // drop the first ':'
+ const key = p.substring(1);
+ const val = params[key];
+
+ builder.push(val);
+ } else {
+ builder.push(p);
+ }
+ }
+
+ return builder.join('/');
+}
+
+export function getNotePath(noteUUID: string, searchObj = {}): Location {
+ const path = `/notes/${noteUUID}`;
+
+ return getLocation({
+ pathname: path,
+ searchObj
+ });
+}
+
+export function getNoteEditPath(noteUUID: string): Location {
+ const path = `/notes/${noteUUID}/edit`;
+
+ return getLocation({
+ pathname: path
+ });
+}
+
+export function getJoinPath(searchObj = {}): Location {
+ return getLocation({ pathname: joinPathDef, searchObj });
+}
+
+export function getLoginPath(searchObj = {}): Location {
+ return getLocation({ pathname: loginPathDef, searchObj });
+}
+
+export function getPasswordResetRequestPath(searchObj = {}): Location {
+ return getLocation({ pathname: passwordResetRequestPathDef, searchObj });
+}
+
+export function getPasswordResetConfirmPath(searchObj = {}): Location {
+ return getLocation({ pathname: passwordResetConfirmPathDef, searchObj });
+}
+
+export enum SettingSections {
+ account = 'account',
+ billing = 'billing',
+ notifications = 'notifications',
+ about = 'about'
+}
+
+export function getSettingsPath(section: SettingSections) {
+ return `/settings/${section}`;
+}
+
+// checkCurrentPath checks if the current path is the given path
+export function checkCurrentPath(location: Location, path: string): boolean {
+ const match = matchPath(location.pathname, {
+ path,
+ exact: true
+ });
+
+ return Boolean(match);
+}
+
+// checkCurrentPathIn checks if the current path is one of the given paths
+export function checkCurrentPathIn(
+ location: Location,
+ paths: string[]
+): boolean {
+ for (let i = 0; i < paths.length; ++i) {
+ const p = paths[i];
+ const match = checkCurrentPath(location, p);
+
+ if (match) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+export function getRootUrl() {
+ return __ROOT_URL__;
+}
diff --git a/web/src/libs/restoreScroll.js b/web/src/libs/restoreScroll.js
new file mode 100644
index 00000000..9cc7f252
--- /dev/null
+++ b/web/src/libs/restoreScroll.js
@@ -0,0 +1,173 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+/*
+Copyright (c) 2013-2015 Brigade
+https://www.brigade.com/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/* eslint-disable */
+
+// script restoreScroll provides a feature to restore the browser scroll
+// upon navigating backwards.
+
+if (window.history.pushState) {
+ const SCROLL_RESTORATION_TIMEOUT_MS = 3000;
+ const TRY_TO_SCROLL_INTERVAL_MS = 50;
+
+ const originalPushState = window.history.pushState;
+ const originalReplaceState = window.history.replaceState;
+
+ // Store current scroll position in current state when navigating away.
+ window.history.pushState = function() {
+ const newStateOfCurrentPage = Object.assign({}, window.history.state, {
+ __scrollX: window.scrollX,
+ __scrollY: window.scrollY
+ });
+ originalReplaceState.call(window.history, newStateOfCurrentPage, '');
+
+ originalPushState.apply(window.history, arguments);
+ };
+
+ // Make sure we don't throw away scroll position when calling "replaceState".
+ window.history.replaceState = function(state, ...otherArgs) {
+ const newState = Object.assign(
+ {},
+ {
+ __scrollX: window.history.state && window.history.state.__scrollX,
+ __scrollY: window.history.state && window.history.state.__scrollY
+ },
+ state
+ );
+
+ originalReplaceState.apply(window.history, [newState].concat(otherArgs));
+ };
+
+ let timeoutHandle = null;
+ let scrollBarWidth = null;
+
+ // Try to scroll to the scrollTarget, but only if we can actually scroll
+ // there. Otherwise keep trying until we time out, then scroll as far as
+ // we can.
+ const tryToScrollTo = scrollTarget => {
+ // Stop any previous calls to "tryToScrollTo".
+ clearTimeout(timeoutHandle);
+
+ const body = document.body;
+ const html = document.documentElement;
+ if (!scrollBarWidth) {
+ scrollBarWidth = getScrollbarWidth();
+ }
+
+ // From http://stackoverflow.com/a/1147768
+ const documentWidth = Math.max(
+ body.scrollWidth,
+ body.offsetWidth,
+ html.clientWidth,
+ html.scrollWidth,
+ html.offsetWidth
+ );
+ const documentHeight = Math.max(
+ body.scrollHeight,
+ body.offsetHeight,
+ html.clientHeight,
+ html.scrollHeight,
+ html.offsetHeight
+ );
+
+ if (
+ (documentWidth + scrollBarWidth - window.innerWidth >= scrollTarget.x &&
+ documentHeight + scrollBarWidth - window.innerHeight >=
+ scrollTarget.y) ||
+ Date.now() > scrollTarget.latestTimeToTry
+ ) {
+ window.scrollTo(scrollTarget.x, scrollTarget.y);
+ } else {
+ timeoutHandle = setTimeout(
+ () => tryToScrollTo(scrollTarget),
+ TRY_TO_SCROLL_INTERVAL_MS
+ );
+ }
+ };
+
+ // Try scrolling to the previous scroll position on popstate
+ const onPopState = () => {
+ const state = window.history.state;
+
+ if (
+ state &&
+ Number.isFinite(state.__scrollX) &&
+ Number.isFinite(state.__scrollY)
+ ) {
+ setTimeout(() =>
+ tryToScrollTo({
+ x: state.__scrollX,
+ y: state.__scrollY,
+ latestTimeToTry: Date.now() + SCROLL_RESTORATION_TIMEOUT_MS
+ })
+ );
+ }
+ };
+
+ // Calculating width of browser's scrollbar
+ function getScrollbarWidth() {
+ let outer = document.createElement('div');
+ outer.style.visibility = 'hidden';
+ outer.style.width = '100px';
+ outer.style.msOverflowStyle = 'scrollbar';
+
+ document.body.appendChild(outer);
+
+ let widthNoScroll = outer.offsetWidth;
+ // force scrollbars
+ outer.style.overflow = 'scroll';
+
+ // add innerdiv
+ let inner = document.createElement('div');
+ inner.style.width = '100%';
+ outer.appendChild(inner);
+
+ let widthWithScroll = inner.offsetWidth;
+
+ // remove divs
+ outer.parentNode.removeChild(outer);
+
+ return widthNoScroll - widthWithScroll;
+ }
+
+ window.addEventListener('popstate', onPopState, true);
+}
diff --git a/web/src/libs/scopeTab.js b/web/src/libs/scopeTab.js
new file mode 100644
index 00000000..d385c7c6
--- /dev/null
+++ b/web/src/libs/scopeTab.js
@@ -0,0 +1,144 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const tabbableNode = /input|select|textarea|button|object/;
+
+function hidesContents(element) {
+ const zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;
+
+ // If the node is empty, this is good enough
+ if (zeroSize && !element.innerHTML) return true;
+
+ // Otherwise we need to check some styles
+ const style = window.getComputedStyle(element);
+ return zeroSize
+ ? style.getPropertyValue('overflow') !== 'visible'
+ : style.getPropertyValue('display') === 'none';
+}
+
+function visible(element) {
+ let parentElement = element;
+ while (parentElement) {
+ if (parentElement === document.body) break;
+ if (hidesContents(parentElement)) return false;
+ parentElement = parentElement.parentNode;
+ }
+ return true;
+}
+
+function focusable(element, isTabIndexNotNaN) {
+ const nodeName = element.nodeName.toLowerCase();
+
+ if (!visible(element)) {
+ return false;
+ }
+
+ if (nodeName === 'a') {
+ return Boolean(element.href) || isTabIndexNotNaN;
+ }
+
+ return (tabbableNode.test(nodeName) && !element.disabled) || isTabIndexNotNaN;
+}
+
+function findTabbable(element) {
+ return [].slice.call(element.querySelectorAll('*'), 0).filter(elm => {
+ let tabIndex = elm.getAttribute('tabindex');
+ if (tabIndex === null) {
+ tabIndex = undefined;
+ }
+
+ const isTabIndexNaN = Number.isNaN(Number(tabIndex));
+
+ if (!focusable(elm, !isTabIndexNaN)) {
+ return false;
+ }
+
+ return isTabIndexNaN || tabIndex >= 0;
+ });
+}
+
+export default function scopeTab(node, event) {
+ const tabbable = findTabbable(node);
+
+ if (!tabbable.length) {
+ // Do nothing, since there are no elements that can receive focus.
+ event.preventDefault();
+ return;
+ }
+
+ const { shiftKey } = event;
+ const head = tabbable[0];
+ const tail = tabbable[tabbable.length - 1];
+ let target;
+
+ // proceed with default browser behavior on tab.
+ // Focus on last element on shift + tab.
+ if (node === document.activeElement) {
+ if (!shiftKey) {
+ return;
+ }
+ target = tail;
+ }
+
+ if (tail === document.activeElement && !shiftKey) {
+ target = head;
+ }
+
+ if (head === document.activeElement && shiftKey) {
+ target = tail;
+ }
+
+ if (target) {
+ event.preventDefault();
+ target.focus();
+ return;
+ }
+
+ // Safari radio issue.
+ //
+ // Safari does not move the focus to the radio button,
+ // so we need to force it to really walk through all elements.
+ //
+ // This is very error prune, since we are trying to guess
+ // if it is a safari browser from the first occurence between
+ // chrome or safari.
+ //
+ // The chrome user agent contains the first ocurrence
+ // as the 'chrome/version' and later the 'safari/version'.
+ const checkSafari = /(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);
+ const isSafariDesktop =
+ checkSafari != null &&
+ checkSafari[1] !== 'Chrome' &&
+ /\biPod\b|\biPad\b/g.exec(navigator.userAgent) == null;
+
+ // If we are not in safari desktop, let the browser control
+ // the focus
+ if (!isSafariDesktop) {
+ return;
+ }
+
+ let x = tabbable.indexOf(document.activeElement);
+
+ if (x > -1) {
+ x += shiftKey ? -1 : 1;
+ }
+
+ event.preventDefault();
+
+ tabbable[x].focus();
+}
diff --git a/web/src/libs/search.ts b/web/src/libs/search.ts
new file mode 100644
index 00000000..1b54218c
--- /dev/null
+++ b/web/src/libs/search.ts
@@ -0,0 +1,44 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { Location } from 'history';
+
+import { parseSearchString } from 'jslib/helpers/url';
+import { removeKey } from 'jslib/helpers/obj';
+import { Queries, keywordBook } from 'jslib/helpers/queries';
+import { getHomePath } from './paths';
+
+export function getSearchDest(location: Location, queries: Queries) {
+ let searchObj: any = parseSearchString(location.search);
+
+ if (queries.q !== '') {
+ searchObj.q = queries.q;
+ } else {
+ searchObj = removeKey(searchObj, 'q');
+ }
+
+ if (queries.book.length > 0) {
+ searchObj.book = queries.book;
+ } else {
+ searchObj = removeKey(searchObj, keywordBook);
+ }
+
+ searchObj = removeKey(searchObj, 'page');
+
+ return getHomePath(searchObj);
+}
diff --git a/web/src/libs/services.ts b/web/src/libs/services.ts
new file mode 100644
index 00000000..0eb0ef92
--- /dev/null
+++ b/web/src/libs/services.ts
@@ -0,0 +1,26 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import initServices from 'jslib/services';
+
+const services = initServices({
+ baseUrl: '',
+ pathPrefix: '/api'
+});
+
+export default services;
diff --git a/web/src/libs/string.ts b/web/src/libs/string.ts
new file mode 100644
index 00000000..821c4261
--- /dev/null
+++ b/web/src/libs/string.ts
@@ -0,0 +1,79 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// excerpt trims the given string up to the last word that makes the string
+// exceed the maxLength, and attaches ellipses at the end. If the string is
+// shorter than the given maxLength, it returns the original string.
+export function excerpt(s: string, maxLength: number) {
+ if (s.length < maxLength) {
+ return s;
+ }
+
+ let ret;
+
+ ret = s.substr(0, maxLength);
+ ret = ret.substr(0, Math.min(ret.length, ret.lastIndexOf(' ')));
+ ret += '...';
+
+ return ret;
+}
+
+// escapesRegExp escapes the regular expression special characters.
+export function escapesRegExp(s: string) {
+ return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
+}
+
+// pluralize pluralizes the given singular noun depending on the given count
+// by naively concatenating a suffix 's'.
+export function pluralize(
+ singular: string,
+ quantity: number,
+ showQuantity?: boolean
+): string {
+ let noun;
+ if (quantity === 1) {
+ noun = singular;
+ } else {
+ noun = `${singular}s`;
+ }
+
+ if (showQuantity) {
+ return `${quantity} ${noun}`;
+ }
+
+ return noun;
+}
+
+// addOrdinalSuffix append appropriate suffix to the given number to
+// represent it as an ordinal number
+export function addOrdinalSuffix(i: number): string {
+ const j = i % 10;
+ const k = i % 100;
+
+ if (j === 1 && k !== 11) {
+ return `${i}st`;
+ }
+ if (j === 2 && k !== 12) {
+ return `${i}nd`;
+ }
+ if (j === 3 && k !== 13) {
+ return `${i}rd`;
+ }
+
+ return `${i}th`;
+}
diff --git a/web/src/libs/subscription.js b/web/src/libs/subscription.js
new file mode 100644
index 00000000..4cf46ff7
--- /dev/null
+++ b/web/src/libs/subscription.js
@@ -0,0 +1,35 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// proPlanIds are ids of plans that are for 'Dnote Pro'.
+const proPlanIds = ['prod_BUCQYMoPGOcXLa'];
+
+// getPlanLabel returns a label for the plan in the given subscription
+export function getPlanLabel(subscription) {
+ if (!subscription || subscription.items.length === 0) {
+ return 'Free';
+ }
+
+ const item = subscription.items[0];
+
+ if (proPlanIds.indexOf(item.product_id) > -1) {
+ return 'Dnote Pro';
+ }
+
+ return 'Free';
+}
diff --git a/web/src/libs/ui.js b/web/src/libs/ui.js
new file mode 100644
index 00000000..cc76e0dd
--- /dev/null
+++ b/web/src/libs/ui.js
@@ -0,0 +1,36 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { noteSidebarThreshold } from '../components/App/_variables.scss';
+
+export const sidebarOverlayThreshold = 1024;
+export { noteSidebarThreshold };
+
+export function getWindowWidth() {
+ return window.innerWidth || document.body.clientWidth;
+}
+
+export function getLayout() {
+ const width = getWindowWidth();
+
+ if (width < noteSidebarThreshold) {
+ return { sidebar: false, noteSidebar: false };
+ }
+
+ return { sidebar: true, noteSidebar: true };
+}
diff --git a/web/src/routes.tsx b/web/src/routes.tsx
new file mode 100644
index 00000000..fa3342a8
--- /dev/null
+++ b/web/src/routes.tsx
@@ -0,0 +1,134 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import React from 'react';
+import { renderRoutes } from 'react-router-config';
+
+import userOnly from './hocs/userOnly';
+import guestOnly from './hocs/guestOnly';
+
+// Components
+import Home from './components/Home';
+import Login from './components/Login';
+import Join from './components/Join';
+import Settings from './components/Settings';
+import NotFound from './components/Common/NotFound';
+import VerifyEmail from './components/VerifyEmail';
+import New from './components/New';
+import Edit from './components/Edit';
+import Note from './components/Note';
+import Books from './components/Books';
+import PasswordResetRequest from './components/PasswordReset/Request';
+import PasswordResetConfirm from './components/PasswordReset/Confirm';
+import EmailPreference from './components/EmailPreference';
+
+// paths
+import {
+ notePathDef,
+ homePathDef,
+ booksPathDef,
+ loginPathDef,
+ joinPathDef,
+ noteEditPathDef,
+ noteNewPathDef,
+ settingsPathDef,
+ passwordResetRequestPathDef,
+ passwordResetConfirmPathDef,
+ verifyEmailPathDef,
+ emailPreferencePathDef
+} from './libs/paths';
+
+const AuthenticatedHome = userOnly(Home);
+const AuthenticatedNew = userOnly(New);
+const AuthenticatedEdit = userOnly(Edit);
+const AuthenticatedBooks = userOnly(Books);
+const GuestJoin = guestOnly(Join);
+const GuestLogin = guestOnly(Login);
+const GuestPasswordResetRequest = guestOnly(PasswordResetRequest);
+const GuestPasswordResetConfirm = guestOnly(PasswordResetConfirm);
+const AuthenticatedSettings = userOnly(Settings);
+
+const routes = [
+ {
+ path: homePathDef,
+ exact: true,
+ component: AuthenticatedHome
+ },
+ {
+ path: loginPathDef,
+ exact: true,
+ component: GuestLogin
+ },
+ {
+ path: joinPathDef,
+ exact: true,
+ component: GuestJoin
+ },
+ {
+ path: notePathDef,
+ exact: true,
+ component: Note
+ },
+ {
+ path: booksPathDef,
+ exact: true,
+ component: AuthenticatedBooks
+ },
+ {
+ path: noteEditPathDef,
+ exact: true,
+ component: AuthenticatedEdit
+ },
+ {
+ path: settingsPathDef,
+ exact: true,
+ component: AuthenticatedSettings
+ },
+ {
+ path: verifyEmailPathDef,
+ exact: true,
+ component: VerifyEmail
+ },
+ {
+ path: noteNewPathDef,
+ exact: true,
+ component: AuthenticatedNew
+ },
+ {
+ path: passwordResetRequestPathDef,
+ exact: true,
+ component: GuestPasswordResetRequest
+ },
+ {
+ path: passwordResetConfirmPathDef,
+ exact: true,
+ component: GuestPasswordResetConfirm
+ },
+ {
+ path: emailPreferencePathDef,
+ exact: true,
+ component: EmailPreference
+ },
+ {
+ component: NotFound
+ }
+];
+
+export default function render(): React.ReactNode {
+ return renderRoutes(routes);
+}
diff --git a/web/src/store/auth/actions.ts b/web/src/store/auth/actions.ts
new file mode 100644
index 00000000..2ecad8cf
--- /dev/null
+++ b/web/src/store/auth/actions.ts
@@ -0,0 +1,125 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import services from 'web/libs/services';
+import { EmailPrefData } from 'jslib/operations/types';
+import { UserData } from './type';
+import { ThunkAction } from '../types';
+
+import {
+ RECEIVE_EMAIL_PREFERENCE,
+ RECEIVE_EMAIL_PREFERENCE_ERROR,
+ START_FETCHING_USER,
+ RECEIVE_USER,
+ RECEIVE_USER_ERROR,
+ StartFetchingUserAction,
+ ReceiveUserAction,
+ ReceiveUserErrorAction,
+ ReceiveEmailPreferenceAction,
+ ReceiveEmailPreferenceErrorAction
+} from './type';
+
+function startFetchingUser(): StartFetchingUserAction {
+ return {
+ type: START_FETCHING_USER
+ };
+}
+
+export function receiveUser(user: UserData): ReceiveUserAction {
+ return {
+ type: RECEIVE_USER,
+ data: { user }
+ };
+}
+
+function receiveUserError(errorMessage): ReceiveUserErrorAction {
+ return {
+ type: RECEIVE_USER_ERROR,
+ data: { errorMessage }
+ };
+}
+
+export function receiveEmailPreference(
+ emailPreference: EmailPrefData
+): ReceiveEmailPreferenceAction {
+ return {
+ type: RECEIVE_EMAIL_PREFERENCE,
+ data: { emailPreference }
+ };
+}
+
+export function getEmailPreferenceError(
+ errorMessage: string
+): ReceiveEmailPreferenceErrorAction {
+ return {
+ type: RECEIVE_EMAIL_PREFERENCE_ERROR,
+ data: { errorMessage }
+ };
+}
+
+export function getEmailPreference(token?: string) {
+ return dispatch => {
+ return services.users
+ .getEmailPreference({ token })
+ .then(emailPreference => {
+ dispatch(receiveEmailPreference(emailPreference));
+ })
+ .catch(err => {
+ console.log('error fetching email preference', err.message);
+ dispatch(getEmailPreferenceError(err.message));
+ });
+ };
+}
+
+interface GetCurrentUserOptions {
+ refresh?: boolean;
+}
+
+export function getCurrentUser(
+ options: GetCurrentUserOptions = {}
+): ThunkAction {
+ return dispatch => {
+ if (!options.refresh) {
+ dispatch(startFetchingUser());
+ }
+
+ return services.users
+ .getMe()
+ .then(user => {
+ dispatch(receiveUser(user));
+
+ return user;
+ })
+ .catch(err => {
+ // 401 if not logged in
+ if (err.response.status === 401) {
+ dispatch(
+ receiveUser({
+ uuid: '',
+ email: '',
+ emailVerified: false,
+ pro: false
+ })
+ );
+ return;
+ }
+
+ dispatch(receiveUserError(err.message));
+ });
+ };
+}
diff --git a/web/src/store/auth/index.ts b/web/src/store/auth/index.ts
new file mode 100644
index 00000000..82479ec2
--- /dev/null
+++ b/web/src/store/auth/index.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export * from './actions';
+export * from './reducers';
+export * from './type';
diff --git a/web/src/store/auth/reducers.ts b/web/src/store/auth/reducers.ts
new file mode 100644
index 00000000..22f8223d
--- /dev/null
+++ b/web/src/store/auth/reducers.ts
@@ -0,0 +1,144 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { EmailPrefData } from 'jslib/operations/types';
+import { RemoteData } from '../types';
+import {
+ AuthState,
+ AuthActionType,
+ UserData,
+ RECEIVE_EMAIL_PREFERENCE,
+ RECEIVE_EMAIL_PREFERENCE_ERROR,
+ START_FETCHING_USER,
+ RECEIVE_USER,
+ RECEIVE_USER_ERROR
+} from './type';
+
+export const initialState: AuthState = {
+ user: {
+ isFetching: false,
+ isFetched: false,
+ data: {
+ uuid: '',
+ email: '',
+ emailVerified: false,
+ pro: false
+ },
+ errorMessage: ''
+ },
+ emailPreference: {
+ isFetching: false,
+ isFetched: false,
+ data: {
+ inactiveReminder: false,
+ productUpdate: false
+ },
+ errorMessage: ''
+ }
+};
+
+function reduceUsers(
+ state = initialState.user,
+ action: AuthActionType
+): RemoteData {
+ switch (action.type) {
+ case START_FETCHING_USER: {
+ return {
+ ...state,
+ isFetching: true,
+ isFetched: false
+ };
+ }
+ case RECEIVE_USER: {
+ const { user } = action.data;
+ return {
+ ...state,
+ data: {
+ uuid: user.uuid,
+ email: user.email,
+ emailVerified: user.emailVerified,
+ pro: user.pro
+ },
+ errorMessage: '',
+ isFetching: false,
+ isFetched: true
+ };
+ }
+ case RECEIVE_USER_ERROR: {
+ return {
+ ...state,
+ isFetching: false,
+ isFetched: false,
+ errorMessage: action.data.errorMessage
+ };
+ }
+ default:
+ return state;
+ }
+}
+
+function reducerEmailPreference(
+ state = initialState.emailPreference,
+ action: AuthActionType
+): RemoteData {
+ switch (action.type) {
+ case RECEIVE_EMAIL_PREFERENCE:
+ return {
+ ...state,
+ errorMessage: '',
+ isFetching: false,
+ isFetched: true,
+ data: action.data.emailPreference
+ };
+ case RECEIVE_EMAIL_PREFERENCE_ERROR: {
+ return {
+ ...state,
+ isFetching: false,
+ isFetched: false,
+ errorMessage: action.data.errorMessage
+ };
+ }
+ default:
+ return state;
+ }
+}
+
+export default function (
+ state = initialState,
+ action: AuthActionType
+): AuthState {
+ switch (action.type) {
+ case START_FETCHING_USER:
+ case RECEIVE_USER_ERROR:
+ case RECEIVE_USER: {
+ return {
+ ...state,
+ user: reduceUsers(state.user, action)
+ };
+ }
+ case RECEIVE_EMAIL_PREFERENCE:
+ case RECEIVE_EMAIL_PREFERENCE_ERROR: {
+ return {
+ ...state,
+ emailPreference: reducerEmailPreference(state.emailPreference, action)
+ };
+ }
+ default:
+ return state;
+ }
+}
diff --git a/web/src/store/auth/type.ts b/web/src/store/auth/type.ts
new file mode 100644
index 00000000..d1c1982c
--- /dev/null
+++ b/web/src/store/auth/type.ts
@@ -0,0 +1,75 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { EmailPrefData } from 'jslib/operations/types';
+import { RemoteData } from '../types';
+
+export interface UserData {
+ uuid: string;
+ email: string;
+ emailVerified: boolean;
+ pro: boolean;
+}
+
+export type UserState = RemoteData;
+export type EmailPrefState = RemoteData;
+
+export interface AuthState {
+ user: UserState;
+ emailPreference: EmailPrefState;
+}
+
+export const START_FETCHING_USER = 'auth/START_FETCHING_USER';
+export const RECEIVE_USER = 'auth/RECEIVE_USER';
+export const RECEIVE_USER_ERROR = 'auth/RECEIVE_USER_ERROR';
+export const RECEIVE_EMAIL_PREFERENCE = 'auth/RECEIVE_EMAIL_PREFERENCE';
+export const RECEIVE_EMAIL_PREFERENCE_ERROR =
+ 'auth/RECEIVE_EMAIL_PREFERENCE_ERROR';
+
+export interface StartFetchingUserAction {
+ type: typeof START_FETCHING_USER;
+}
+export interface ReceiveUserAction {
+ type: typeof RECEIVE_USER;
+ data: { user: UserData };
+}
+export interface ReceiveUserErrorAction {
+ type: typeof RECEIVE_USER_ERROR;
+ data: {
+ errorMessage: string;
+ };
+}
+export interface ReceiveEmailPreferenceAction {
+ type: typeof RECEIVE_EMAIL_PREFERENCE;
+ data: {
+ emailPreference: EmailPrefData;
+ };
+}
+export interface ReceiveEmailPreferenceErrorAction {
+ type: typeof RECEIVE_EMAIL_PREFERENCE_ERROR;
+ data: {
+ errorMessage: string;
+ };
+}
+
+export type AuthActionType =
+ | StartFetchingUserAction
+ | ReceiveUserAction
+ | ReceiveUserErrorAction
+ | ReceiveEmailPreferenceAction
+ | ReceiveEmailPreferenceErrorAction;
diff --git a/web/src/store/books/actions.ts b/web/src/store/books/actions.ts
new file mode 100644
index 00000000..cd6952b8
--- /dev/null
+++ b/web/src/store/books/actions.ts
@@ -0,0 +1,82 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import operations from 'web/libs/operations';
+import { BookData } from 'jslib/operations/types';
+import { RECEIVE, ADD, REMOVE, START_FETCHING, FINISH_FETCHING } from './type';
+import { ThunkAction } from '../types';
+
+function receiveBooks(books: BookData[]) {
+ return {
+ type: RECEIVE,
+ data: { books }
+ };
+}
+
+function startFetchingBooks() {
+ return {
+ type: START_FETCHING
+ };
+}
+
+function finishFetchingBooks() {
+ return {
+ type: FINISH_FETCHING
+ };
+}
+
+export const getBooks = (): ThunkAction => {
+ return dispatch => {
+ dispatch(startFetchingBooks());
+
+ return operations.books
+ .fetch()
+ .then(books => {
+ dispatch(receiveBooks(books));
+ dispatch(finishFetchingBooks());
+ })
+ .catch(err => {
+ console.log('getBooks error', err);
+ // todo: handle error
+ });
+ };
+};
+
+export function addBook(book: BookData) {
+ return {
+ type: ADD,
+ data: { book }
+ };
+}
+
+export const createBook = (name: string): ThunkAction => {
+ return dispatch => {
+ return operations.books.create({ name }).then(book => {
+ dispatch(addBook(book));
+
+ return book;
+ });
+ };
+};
+
+export function removeBook(bookUUID: string) {
+ return {
+ type: REMOVE,
+ data: { bookUUID }
+ };
+}
diff --git a/web/src/store/books/index.ts b/web/src/store/books/index.ts
new file mode 100644
index 00000000..82479ec2
--- /dev/null
+++ b/web/src/store/books/index.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export * from './actions';
+export * from './reducers';
+export * from './type';
diff --git a/web/src/store/books/reducers.ts b/web/src/store/books/reducers.ts
new file mode 100644
index 00000000..9749258d
--- /dev/null
+++ b/web/src/store/books/reducers.ts
@@ -0,0 +1,86 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ BooksState,
+ BooksActionType,
+ RECEIVE,
+ ADD,
+ REMOVE,
+ START_FETCHING,
+ FINISH_FETCHING
+} from './type';
+
+const initialState: BooksState = {
+ data: [],
+ isFetching: false,
+ isFetched: false,
+ errorMessage: ''
+};
+
+export default function (
+ state = initialState,
+ action: BooksActionType
+): BooksState {
+ switch (action.type) {
+ case START_FETCHING: {
+ return {
+ ...state,
+ isFetching: true,
+ isFetched: false
+ };
+ }
+ case FINISH_FETCHING: {
+ return {
+ ...state,
+ isFetching: false,
+ isFetched: true
+ };
+ }
+ case RECEIVE: {
+ return {
+ ...state,
+ data: action.data.books
+ };
+ }
+ case REMOVE: {
+ return {
+ ...state,
+ data: state.data.filter(item => {
+ return item.uuid !== action.data.bookUUID;
+ })
+ };
+ }
+ case ADD: {
+ const data = [...state.data, action.data.book];
+ const sorted = data.sort((a, b) => {
+ const aLabel = a.label.toLowerCase();
+ const bLabel = b.label.toLowerCase();
+
+ return aLabel.localeCompare(bLabel);
+ });
+
+ return {
+ ...state,
+ data: sorted
+ };
+ }
+ default:
+ return state;
+ }
+}
diff --git a/web/src/store/books/type.ts b/web/src/store/books/type.ts
new file mode 100644
index 00000000..4e3fb5b8
--- /dev/null
+++ b/web/src/store/books/type.ts
@@ -0,0 +1,64 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { BookData } from 'jslib/operations/types';
+import { RemoteData } from '../types';
+
+export type BooksState = RemoteData;
+
+export const RECEIVE = 'books/RECEIVE';
+export const ADD = 'books/ADD';
+export const REMOVE = 'books/REMOVE';
+export const START_FETCHING = 'books/START_FETCHING';
+export const FINISH_FETCHING = 'books/FINISH_FETCHING';
+
+export interface ReceiveBooks {
+ type: typeof RECEIVE;
+ data: {
+ books: BookData[];
+ };
+}
+
+export interface StartFetchingBooks {
+ type: typeof START_FETCHING;
+}
+
+export interface FinishFetchingBooks {
+ type: typeof FINISH_FETCHING;
+}
+
+export interface AddBook {
+ type: typeof ADD;
+ data: {
+ book: BookData;
+ };
+}
+
+export interface RemoveBook {
+ type: typeof REMOVE;
+ data: {
+ bookUUID: string;
+ };
+}
+
+export type BooksActionType =
+ | ReceiveBooks
+ | StartFetchingBooks
+ | FinishFetchingBooks
+ | AddBook
+ | RemoveBook;
diff --git a/web/src/store/editor/actions.ts b/web/src/store/editor/actions.ts
new file mode 100644
index 00000000..616f8fe1
--- /dev/null
+++ b/web/src/store/editor/actions.ts
@@ -0,0 +1,91 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+// import { receiveNote } from '../note';
+// import { refreshNoteInList } from '../notes';
+
+import {
+ FLUSH_CONTENT,
+ UPDATE_BOOK,
+ RESET,
+ CREATE_SESSION,
+ MARK_PERSISTED,
+ MarkPersistedAction,
+ CreateSessionAction,
+ FlushContentAction,
+ UpdateBookAction,
+ ResetAction
+} from './type';
+
+export function createSession({
+ noteUUID,
+ bookUUID,
+ bookLabel,
+ content
+}): CreateSessionAction {
+ return {
+ type: CREATE_SESSION,
+ data: { noteUUID, bookUUID, bookLabel, content }
+ };
+}
+
+export function flushContent(
+ sessionKey: string,
+ content: string
+): FlushContentAction {
+ return {
+ type: FLUSH_CONTENT,
+ data: { sessionKey, content }
+ };
+}
+
+export interface UpdateBookActionParam {
+ sessionKey: string;
+ uuid: string;
+ label: string;
+}
+
+export function updateBook({
+ sessionKey,
+ uuid,
+ label
+}: UpdateBookActionParam): UpdateBookAction {
+ return {
+ type: UPDATE_BOOK,
+ data: {
+ sessionKey,
+ uuid,
+ label
+ }
+ };
+}
+
+export function resetEditor(sessionKey: string): ResetAction {
+ return {
+ type: RESET,
+ data: {
+ sessionKey
+ }
+ };
+}
+
+export function markPersisted(): MarkPersistedAction {
+ return {
+ type: MARK_PERSISTED
+ };
+}
diff --git a/web/src/store/editor/index.ts b/web/src/store/editor/index.ts
new file mode 100644
index 00000000..82479ec2
--- /dev/null
+++ b/web/src/store/editor/index.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export * from './actions';
+export * from './reducers';
+export * from './type';
diff --git a/web/src/store/editor/reducers.ts b/web/src/store/editor/reducers.ts
new file mode 100644
index 00000000..4975c2fe
--- /dev/null
+++ b/web/src/store/editor/reducers.ts
@@ -0,0 +1,110 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { removeKey } from 'jslib/helpers/obj';
+import { getEditorSessionkey } from 'web/libs/editor';
+import {
+ EditorState,
+ EditorActionType,
+ FLUSH_CONTENT,
+ UPDATE_BOOK,
+ RESET,
+ CREATE_SESSION,
+ MARK_PERSISTED
+} from './type';
+
+const initialState: EditorState = {
+ persisted: false,
+ sessions: {}
+};
+
+export default function (
+ state = initialState,
+ action: EditorActionType
+): EditorState {
+ switch (action.type) {
+ case CREATE_SESSION: {
+ const { data } = action;
+
+ const sessionKey = getEditorSessionkey(data.noteUUID);
+
+ return {
+ ...state,
+ persisted: false,
+ sessions: {
+ ...state.sessions,
+ [sessionKey]: {
+ sessionKey,
+ noteUUID: data.noteUUID,
+ bookUUID: data.bookUUID,
+ bookLabel: data.bookLabel,
+ content: data.content
+ }
+ }
+ };
+ }
+ case FLUSH_CONTENT: {
+ const { data } = action;
+
+ return {
+ ...state,
+ persisted: false,
+ sessions: {
+ ...state.sessions,
+ [data.sessionKey]: {
+ ...state.sessions[data.sessionKey],
+ content: data.content
+ }
+ }
+ };
+ }
+ case UPDATE_BOOK: {
+ const { data } = action;
+
+ return {
+ ...state,
+ persisted: false,
+ sessions: {
+ ...state.sessions,
+ [data.sessionKey]: {
+ ...state.sessions[data.sessionKey],
+ bookUUID: action.data.uuid,
+ bookLabel: action.data.label
+ }
+ }
+ };
+ }
+ case MARK_PERSISTED: {
+ return {
+ ...state,
+ persisted: true
+ };
+ }
+ case RESET: {
+ const { data } = action;
+
+ return {
+ ...state,
+ persisted: false,
+ sessions: removeKey(state.sessions, data.sessionKey)
+ };
+ }
+ default:
+ return state;
+ }
+}
diff --git a/web/src/store/editor/type.ts b/web/src/store/editor/type.ts
new file mode 100644
index 00000000..614e4f37
--- /dev/null
+++ b/web/src/store/editor/type.ts
@@ -0,0 +1,83 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export interface EditorSession {
+ sessionKey: string;
+ noteUUID: string | null;
+ bookUUID: string | null;
+ bookLabel: string | null;
+ content: string;
+}
+
+export interface EditorState {
+ persisted: boolean;
+ sessions: {
+ [key: string]: EditorSession;
+ };
+}
+
+export const MARK_PERSISTED = 'editor/MARK_PERSISTED';
+export const CREATE_SESSION = 'editor/CREATE_SESSION';
+export const FLUSH_CONTENT = 'editor/FLUSH_CONTENT';
+export const UPDATE_BOOK = 'editor/UPDATE_BOOK';
+export const RESET = 'editor/RESET';
+
+export interface MarkPersistedAction {
+ type: typeof MARK_PERSISTED;
+}
+
+export interface CreateSessionAction {
+ type: typeof CREATE_SESSION;
+ data: {
+ noteUUID: string;
+ bookUUID: string;
+ bookLabel: string;
+ content: string;
+ };
+}
+
+export interface FlushContentAction {
+ type: typeof FLUSH_CONTENT;
+ data: {
+ sessionKey: string;
+ content: string;
+ };
+}
+
+export interface UpdateBookAction {
+ type: typeof UPDATE_BOOK;
+ data: {
+ sessionKey: string;
+ uuid: string;
+ label: string;
+ };
+}
+
+export interface ResetAction {
+ type: typeof RESET;
+ data: {
+ sessionKey: string;
+ };
+}
+
+export type EditorActionType =
+ | MarkPersistedAction
+ | CreateSessionAction
+ | FlushContentAction
+ | UpdateBookAction
+ | ResetAction;
diff --git a/web/src/store/filters/actions.ts b/web/src/store/filters/actions.ts
new file mode 100644
index 00000000..a697722f
--- /dev/null
+++ b/web/src/store/filters/actions.ts
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ UPDATE_QUERY,
+ UPDATE_PAGE,
+ RESET,
+ UpdateQueryAction,
+ UpdatePageAction,
+ ResetAction
+} from './type';
+
+export function updateQuery(key, value): UpdateQueryAction {
+ return {
+ type: UPDATE_QUERY,
+ data: { key, value }
+ };
+}
+
+export function updatePage(value): UpdatePageAction {
+ return {
+ type: UPDATE_PAGE,
+ data: { value }
+ };
+}
+
+export function resetFilters(): ResetAction {
+ return {
+ type: RESET
+ };
+}
diff --git a/web/src/store/filters/index.ts b/web/src/store/filters/index.ts
new file mode 100644
index 00000000..82479ec2
--- /dev/null
+++ b/web/src/store/filters/index.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export * from './actions';
+export * from './reducers';
+export * from './type';
diff --git a/web/src/store/filters/reducers.ts b/web/src/store/filters/reducers.ts
new file mode 100644
index 00000000..247c7b61
--- /dev/null
+++ b/web/src/store/filters/reducers.ts
@@ -0,0 +1,61 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ UPDATE_QUERY,
+ UPDATE_PAGE,
+ RESET,
+ FiltersState,
+ FilterActionType
+} from './type';
+
+const initialState: FiltersState = {
+ queries: {
+ q: '',
+ book: ['']
+ },
+ page: 1
+};
+
+export default function (
+ state = initialState,
+ action: FilterActionType
+): FiltersState {
+ switch (action.type) {
+ case UPDATE_QUERY: {
+ return {
+ ...state,
+ queries: {
+ ...state.queries,
+ [action.data.key]: action.data.value
+ }
+ };
+ }
+ case UPDATE_PAGE: {
+ return {
+ ...state,
+ page: action.data.value
+ };
+ }
+ case RESET: {
+ return initialState;
+ }
+ default:
+ return state;
+ }
+}
diff --git a/web/src/store/filters/type.ts b/web/src/store/filters/type.ts
new file mode 100644
index 00000000..5ccf4aa1
--- /dev/null
+++ b/web/src/store/filters/type.ts
@@ -0,0 +1,57 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export interface QueryState {
+ q: string;
+ book: string[];
+}
+
+export interface FiltersState {
+ queries: QueryState;
+ page: number;
+}
+
+export const UPDATE_PAGE = 'filters/UDPATE_PAGE';
+export const UPDATE_QUERY = 'filters/UPDATE_QUERY';
+export const RESET = 'filters/RESET';
+
+type ValidQueries = 'q' | 'book';
+
+export interface UpdateQueryAction {
+ type: typeof UPDATE_QUERY;
+ data: {
+ key: ValidQueries;
+ value: string;
+ };
+}
+
+export interface UpdatePageAction {
+ type: typeof UPDATE_PAGE;
+ data: {
+ value: number;
+ };
+}
+
+export interface ResetAction {
+ type: typeof RESET;
+}
+
+export type FilterActionType =
+ | UpdateQueryAction
+ | UpdatePageAction
+ | ResetAction;
diff --git a/web/src/store/form/actions.ts b/web/src/store/form/actions.ts
new file mode 100644
index 00000000..ae4a8033
--- /dev/null
+++ b/web/src/store/form/actions.ts
@@ -0,0 +1,28 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { UPDATE_AUTH_EMAIL, UpdateAuthEmail } from './type';
+
+export function updateAuthEmail(email: string): UpdateAuthEmail {
+ return {
+ type: UPDATE_AUTH_EMAIL,
+ data: {
+ email
+ }
+ };
+}
diff --git a/web/src/store/form/index.ts b/web/src/store/form/index.ts
new file mode 100644
index 00000000..82479ec2
--- /dev/null
+++ b/web/src/store/form/index.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export * from './actions';
+export * from './reducers';
+export * from './type';
diff --git a/web/src/store/form/reducers.ts b/web/src/store/form/reducers.ts
new file mode 100644
index 00000000..a69bca14
--- /dev/null
+++ b/web/src/store/form/reducers.ts
@@ -0,0 +1,46 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { FormState, FormActionType, UPDATE_AUTH_EMAIL } from './type';
+
+export const initialState: FormState = {
+ auth: {
+ email: ''
+ }
+};
+
+export default function (
+ state = initialState,
+ action: FormActionType
+): FormState {
+ switch (action.type) {
+ case UPDATE_AUTH_EMAIL: {
+ const { data } = action;
+
+ return {
+ ...state,
+ auth: {
+ ...state.auth,
+ email: data.email
+ }
+ };
+ }
+ default:
+ return state;
+ }
+}
diff --git a/web/src/store/form/type.ts b/web/src/store/form/type.ts
new file mode 100644
index 00000000..8beb7bf1
--- /dev/null
+++ b/web/src/store/form/type.ts
@@ -0,0 +1,34 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export interface FormState {
+ auth: {
+ email: string;
+ };
+}
+
+export const UPDATE_AUTH_EMAIL = 'form/UPDATE_AUTH_EMAIL';
+
+export interface UpdateAuthEmail {
+ type: typeof UPDATE_AUTH_EMAIL;
+ data: {
+ email: string;
+ };
+}
+
+export type FormActionType = UpdateAuthEmail;
diff --git a/web/src/store/hooks.ts b/web/src/store/hooks.ts
new file mode 100644
index 00000000..6b92619d
--- /dev/null
+++ b/web/src/store/hooks.ts
@@ -0,0 +1,52 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { Store } from 'redux';
+import {
+ useDispatch as useReduxDispatch,
+ useStore as useReduxStore,
+ useSelector as useReduxSelector
+} from 'react-redux';
+
+import { ReduxDispatch, AppState } from './types';
+import { FiltersState } from './filters/type';
+
+export function useDispatch(): ReduxDispatch {
+ return useReduxDispatch();
+}
+
+export function useStore(): Store {
+ return useReduxStore();
+}
+
+export function useSelector(
+ selector: (state: AppState) => TSelected
+) {
+ return useReduxSelector(selector);
+}
+
+// custom hooks
+export function useFilters(): FiltersState {
+ const { filters } = useSelector(state => {
+ return {
+ filters: state.filters
+ };
+ });
+
+ return filters;
+}
diff --git a/web/src/store/index.ts b/web/src/store/index.ts
new file mode 100644
index 00000000..873d0859
--- /dev/null
+++ b/web/src/store/index.ts
@@ -0,0 +1,59 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { combineReducers, createStore, applyMiddleware, compose } from 'redux';
+import thunkMiddleware from 'redux-thunk';
+
+import auth from './auth/reducers';
+import form from './form/reducers';
+import books from './books/reducers';
+import editor from './editor/reducers';
+import note from './note/reducers';
+import ui from './ui/reducers';
+import route from './route/reducers';
+import notes from './notes/reducers';
+import filters from './filters/reducers';
+
+const rootReducer = combineReducers({
+ auth,
+ form,
+ books,
+ editor,
+ notes,
+ note,
+ ui,
+ route,
+ filters
+});
+
+// configuruStore returns a new store that contains the appliation state
+export default function configureStore(initialState) {
+ const typedWindow = window as any;
+
+ const composeEnhancers =
+ typedWindow.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
+
+ return createStore(
+ rootReducer,
+ initialState,
+ composeEnhancers(applyMiddleware(thunkMiddleware))
+ );
+}
+
+export * from './types';
+export * from './hooks';
diff --git a/web/src/store/note/actions.ts b/web/src/store/note/actions.ts
new file mode 100644
index 00000000..a3fcaa61
--- /dev/null
+++ b/web/src/store/note/actions.ts
@@ -0,0 +1,73 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import operations from 'web/libs/operations';
+import { NoteData } from 'jslib/operations/types';
+import { RECEIVE, START_FETCHING, ERROR, RESET } from './type';
+import { ThunkAction } from '../types';
+
+export function receiveNote(note: NoteData) {
+ return {
+ type: RECEIVE,
+ data: { note }
+ };
+}
+
+export function resetNote() {
+ return {
+ type: RESET
+ };
+}
+
+function startFetchingNote() {
+ return {
+ type: START_FETCHING
+ };
+}
+
+function receiveNoteError(errorMessage: string) {
+ return {
+ type: ERROR,
+ data: { errorMessage }
+ };
+}
+
+interface GetNoteFacets {
+ q?: string;
+}
+
+export const getNote = (
+ noteUUID: string,
+ params: GetNoteFacets
+): ThunkAction => {
+ return dispatch => {
+ dispatch(startFetchingNote());
+
+ return operations.notes
+ .fetchOne(noteUUID, params)
+ .then(note => {
+ dispatch(receiveNote(note));
+
+ return note;
+ })
+ .catch(err => {
+ console.log('getNote error', err.message);
+ dispatch(receiveNoteError(err.message));
+ });
+ };
+};
diff --git a/web/src/store/note/index.ts b/web/src/store/note/index.ts
new file mode 100644
index 00000000..82479ec2
--- /dev/null
+++ b/web/src/store/note/index.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export * from './actions';
+export * from './reducers';
+export * from './type';
diff --git a/web/src/store/note/reducers.ts b/web/src/store/note/reducers.ts
new file mode 100644
index 00000000..a27b74d0
--- /dev/null
+++ b/web/src/store/note/reducers.ts
@@ -0,0 +1,85 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ RECEIVE,
+ START_FETCHING,
+ ERROR,
+ RESET,
+ NoteState,
+ NoteActionType
+} from './type';
+
+const initialState: NoteState = {
+ data: {
+ uuid: '',
+ createdAt: '',
+ updatedAt: '',
+ content: '',
+ addedOn: 0,
+ public: false,
+ usn: 0,
+ book: {
+ uuid: '',
+ label: ''
+ },
+ user: {
+ name: '',
+ uuid: ''
+ }
+ },
+ isFetching: false,
+ isFetched: false,
+ errorMessage: null
+};
+
+export default function (
+ state = initialState,
+ action: NoteActionType
+): NoteState {
+ switch (action.type) {
+ case START_FETCHING: {
+ return {
+ ...state,
+ isFetching: true,
+ isFetched: false,
+ errorMessage: null
+ };
+ }
+ case ERROR: {
+ return {
+ ...state,
+ isFetching: false,
+ errorMessage: action.data.errorMessage
+ };
+ }
+ case RECEIVE: {
+ return {
+ ...state,
+ data: action.data.note,
+ isFetching: false,
+ isFetched: true
+ };
+ }
+ case RESET: {
+ return initialState;
+ }
+ default:
+ return state;
+ }
+}
diff --git a/web/src/store/note/type.ts b/web/src/store/note/type.ts
new file mode 100644
index 00000000..7493ecfd
--- /dev/null
+++ b/web/src/store/note/type.ts
@@ -0,0 +1,55 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { NoteData } from 'jslib/operations/types';
+import { RemoteData } from '../types';
+
+export type NoteState = RemoteData;
+
+export const RECEIVE = 'note/RECEIVE';
+export const START_FETCHING = 'note/START_FETCHING';
+export const ERROR = 'note/ERROR';
+export const RESET = 'note/RESET';
+
+export interface ReceiveNote {
+ type: typeof RECEIVE;
+ data: {
+ note: NoteData;
+ };
+}
+
+export interface StartFetchingNote {
+ type: typeof START_FETCHING;
+}
+
+export interface ResetNote {
+ type: typeof RESET;
+}
+
+export interface ReceiveNoteError {
+ type: typeof ERROR;
+ data: {
+ errorMessage: string;
+ };
+}
+
+export type NoteActionType =
+ | ReceiveNote
+ | StartFetchingNote
+ | ReceiveNoteError
+ | ResetNote;
diff --git a/web/src/store/notes/actions.ts b/web/src/store/notes/actions.ts
new file mode 100644
index 00000000..5628a231
--- /dev/null
+++ b/web/src/store/notes/actions.ts
@@ -0,0 +1,115 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import operations from 'web/libs/operations';
+import { Filters } from 'jslib/helpers/filters';
+import {
+ ADD,
+ REFRESH,
+ RECEIVE,
+ START_FETCHING,
+ RECEIVE_ERROR,
+ RESET,
+ REMOVE,
+ AddAction,
+ RemoveAction,
+ RefreshAction,
+ ReceiveAction,
+ StartFetchingAction,
+ ReceiveErrorAction,
+ ResetAction
+} from './type';
+import { ThunkAction } from '../types';
+
+export function addNote(note): AddAction {
+ return {
+ type: ADD,
+ data: {
+ note
+ }
+ };
+}
+
+export function removeNote({ noteUUID }): RemoveAction {
+ return {
+ type: REMOVE,
+ data: {
+ noteUUID
+ }
+ };
+}
+
+export function refreshNoteInList({ noteUUID, refreshedNote }): RefreshAction {
+ return {
+ type: REFRESH,
+ data: {
+ noteUUID,
+ book: refreshedNote.book,
+ content: refreshedNote.content,
+ isPublic: refreshedNote.public
+ }
+ };
+}
+
+function receiveNotes(notes, total): ReceiveAction {
+ return {
+ type: RECEIVE,
+ data: {
+ notes,
+ total
+ }
+ };
+}
+
+function startFetchingNotes(): StartFetchingAction {
+ return {
+ type: START_FETCHING
+ };
+}
+
+function receiveError(error: string): ReceiveErrorAction {
+ return {
+ type: RECEIVE_ERROR,
+ data: {
+ error
+ }
+ };
+}
+
+export function resetNotes(): ResetAction {
+ return {
+ type: RESET
+ };
+}
+
+export function getNotes(filters: Filters): ThunkAction {
+ return async dispatch => {
+ dispatch(startFetchingNotes());
+
+ return operations.notes
+ .fetch(filters)
+ .then(res => {
+ const { notes, total } = res;
+ dispatch(receiveNotes(notes, total));
+ })
+ .catch(err => {
+ console.log('Error fetching notes', err.stack);
+ dispatch(receiveError(err.message));
+ });
+ };
+}
diff --git a/web/src/store/notes/index.ts b/web/src/store/notes/index.ts
new file mode 100644
index 00000000..82479ec2
--- /dev/null
+++ b/web/src/store/notes/index.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export * from './actions';
+export * from './reducers';
+export * from './type';
diff --git a/web/src/store/notes/reducers.ts b/web/src/store/notes/reducers.ts
new file mode 100644
index 00000000..65f4998d
--- /dev/null
+++ b/web/src/store/notes/reducers.ts
@@ -0,0 +1,86 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ ADD,
+ REFRESH,
+ RECEIVE,
+ START_FETCHING,
+ RECEIVE_ERROR,
+ RESET,
+ REMOVE,
+ NotesActionType,
+ NotesState
+} from './type';
+
+const initialState: NotesState = {
+ data: [],
+ total: 0,
+ isFetching: false,
+ isFetched: false,
+ errorMessage: null
+};
+
+export default function (
+ state = initialState,
+ action: NotesActionType
+): NotesState {
+ switch (action.type) {
+ case START_FETCHING: {
+ return {
+ ...state,
+ isFetched: false,
+ isFetching: true,
+ errorMessage: ''
+ };
+ }
+ case ADD: {
+ return state;
+ }
+ case REFRESH: {
+ return state;
+ }
+ case REMOVE: {
+ return state;
+ }
+ case RECEIVE: {
+ const { notes, total } = action.data;
+
+ return {
+ ...state,
+ data: notes,
+ total,
+ isFetched: true,
+ isFetching: false
+ };
+ }
+ case RECEIVE_ERROR: {
+ return {
+ ...state,
+ errorMessage: action.data.error,
+ isFetching: false,
+ isFetched: false
+ };
+ }
+ case RESET: {
+ return initialState;
+ }
+ default:
+ return state;
+ }
+}
diff --git a/web/src/store/notes/type.ts b/web/src/store/notes/type.ts
new file mode 100644
index 00000000..80f47760
--- /dev/null
+++ b/web/src/store/notes/type.ts
@@ -0,0 +1,88 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { NoteData, BookData } from 'jslib/operations/types';
+import { RemoteData } from '../types';
+
+export interface NotesState extends RemoteData {
+ total: number;
+}
+
+export const ADD = 'notes/ADD';
+export const REFRESH = 'notes/REFRESH';
+export const RECEIVE = 'notes/RECEIVE';
+export const START_FETCHING = 'notes/START_FETCHING';
+export const RECEIVE_ERROR = 'notes/RECEIVE_ERROR';
+export const RESET = 'notes/RESET';
+export const REMOVE = 'notes/REMOVE';
+
+export interface AddAction {
+ type: typeof ADD;
+ data: {
+ note: NoteData;
+ };
+}
+
+export interface RefreshAction {
+ type: typeof REFRESH;
+ data: {
+ noteUUID: string;
+ book: BookData;
+ content: string;
+ isPublic: boolean;
+ };
+}
+
+export interface ReceiveAction {
+ type: typeof RECEIVE;
+ data: {
+ notes: NoteData[];
+ total: number;
+ };
+}
+
+export interface StartFetchingAction {
+ type: typeof START_FETCHING;
+}
+
+export interface ReceiveErrorAction {
+ type: typeof RECEIVE_ERROR;
+ data: {
+ error: string;
+ };
+}
+
+export interface ResetAction {
+ type: typeof RESET;
+}
+
+export interface RemoveAction {
+ type: typeof REMOVE;
+ data: {
+ noteUUID: string;
+ };
+}
+
+export type NotesActionType =
+ | AddAction
+ | RefreshAction
+ | ReceiveAction
+ | StartFetchingAction
+ | ReceiveErrorAction
+ | ResetAction
+ | RemoveAction;
diff --git a/web/src/store/route/actions.ts b/web/src/store/route/actions.ts
new file mode 100644
index 00000000..6f63167e
--- /dev/null
+++ b/web/src/store/route/actions.ts
@@ -0,0 +1,38 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { SET_PREV_LOCATION, SetPrevLocationAction } from './type';
+
+interface SetPrevLocationActionParams {
+ pathname: string;
+ search: string;
+ hash: string;
+ state?: object;
+}
+
+export function setPrevLocation({
+ pathname,
+ search,
+ hash,
+ state
+}: SetPrevLocationActionParams): SetPrevLocationAction {
+ return {
+ type: SET_PREV_LOCATION,
+ data: { pathname, state, hash, search }
+ };
+}
diff --git a/web/src/store/route/index.ts b/web/src/store/route/index.ts
new file mode 100644
index 00000000..82479ec2
--- /dev/null
+++ b/web/src/store/route/index.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export * from './actions';
+export * from './reducers';
+export * from './type';
diff --git a/web/src/store/route/reducers.ts b/web/src/store/route/reducers.ts
new file mode 100644
index 00000000..596048a2
--- /dev/null
+++ b/web/src/store/route/reducers.ts
@@ -0,0 +1,50 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { SET_PREV_LOCATION, RouteActionType, RouteState } from './type';
+
+export const initialState: RouteState = {
+ prevLocation: {
+ pathname: '',
+ hash: '',
+ search: '',
+ state: {}
+ }
+};
+
+export default function (
+ state = initialState,
+ action: RouteActionType
+): RouteState {
+ switch (action.type) {
+ case SET_PREV_LOCATION: {
+ return {
+ ...state,
+ prevLocation: {
+ ...state.prevLocation,
+ pathname: action.data.pathname,
+ search: action.data.search,
+ hash: action.data.hash,
+ state: action.data.state
+ }
+ };
+ }
+ default:
+ return state;
+ }
+}
diff --git a/web/src/store/route/type.ts b/web/src/store/route/type.ts
new file mode 100644
index 00000000..d2d65e97
--- /dev/null
+++ b/web/src/store/route/type.ts
@@ -0,0 +1,40 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export interface RouteState {
+ prevLocation: {
+ pathname: string;
+ search: string;
+ hash: string;
+ state: object;
+ };
+}
+
+export const SET_PREV_LOCATION = 'route/SET_PREV_LOCATION';
+
+export interface SetPrevLocationAction {
+ type: typeof SET_PREV_LOCATION;
+ data: {
+ pathname: string;
+ search: string;
+ hash: string;
+ state?: object;
+ };
+}
+
+export type RouteActionType = SetPrevLocationAction;
diff --git a/web/src/store/types.ts b/web/src/store/types.ts
new file mode 100644
index 00000000..4142d4a4
--- /dev/null
+++ b/web/src/store/types.ts
@@ -0,0 +1,65 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { Action, Store } from 'redux';
+import { ThunkDispatch, ThunkAction as ReduxThunkAction } from 'redux-thunk';
+
+import { AuthState } from './auth/type';
+import { FormState } from './form/type';
+import { BooksState } from './books/type';
+import { EditorState } from './editor/type';
+import { NoteState } from './note/type';
+import { NotesState } from './notes/type';
+import { UIState } from './ui/type';
+import { RouteState } from './route/type';
+import { FiltersState } from './filters/type';
+
+// RemoteData represents a data in Redux store that is fetched from a remote source.
+// It contains the state related to the fetching of the data as well as the data itself.
+export interface RemoteData {
+ isFetching: boolean;
+ isFetched: boolean;
+ data: T;
+ errorMessage: string;
+}
+
+// AppState represents the application state
+export interface AppState {
+ auth: AuthState;
+ form: FormState;
+ books: BooksState;
+ editor: EditorState;
+ note: NoteState;
+ notes: NotesState;
+ ui: UIState;
+ route: RouteState;
+ filters: FiltersState;
+}
+
+// ThunkAction is a thunk action type
+export type ThunkAction = ReduxThunkAction<
+ Promise,
+ AppState,
+ void,
+ Action
+>;
+
+// AppStore represents the store for the app
+export type AppStore = Store;
+
+export type ReduxDispatch = ThunkDispatch;
diff --git a/web/src/store/ui/actions.ts b/web/src/store/ui/actions.ts
new file mode 100644
index 00000000..553b3650
--- /dev/null
+++ b/web/src/store/ui/actions.ts
@@ -0,0 +1,47 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import {
+ SET_MESSAGE,
+ UNSET_MESSAGE,
+ SetMessageAction,
+ UnsetMessageAction
+} from './type';
+
+interface SetMessageActionParams {
+ message: string;
+ kind: string;
+ path?: string;
+}
+
+export function setMessage({
+ message,
+ kind,
+ path
+}: SetMessageActionParams): SetMessageAction {
+ return {
+ type: SET_MESSAGE,
+ data: { message, kind, path }
+ };
+}
+
+export function unsetMessage(): UnsetMessageAction {
+ return {
+ type: UNSET_MESSAGE
+ };
+}
diff --git a/web/src/store/ui/index.ts b/web/src/store/ui/index.ts
new file mode 100644
index 00000000..82479ec2
--- /dev/null
+++ b/web/src/store/ui/index.ts
@@ -0,0 +1,21 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export * from './actions';
+export * from './reducers';
+export * from './type';
diff --git a/web/src/store/ui/reducers.ts b/web/src/store/ui/reducers.ts
new file mode 100644
index 00000000..a83f49b9
--- /dev/null
+++ b/web/src/store/ui/reducers.ts
@@ -0,0 +1,48 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+import { SET_MESSAGE, UNSET_MESSAGE, UIState, UIActionType } from './type';
+
+export const initialState: UIState = {
+ message: {}
+};
+
+export default function (state = initialState, action: UIActionType): UIState {
+ switch (action.type) {
+ case SET_MESSAGE: {
+ return {
+ ...state,
+ message: {
+ ...state.message,
+ [action.data.path]: {
+ content: action.data.message,
+ kind: action.data.kind
+ }
+ }
+ };
+ }
+ case UNSET_MESSAGE: {
+ return {
+ ...state,
+ message: initialState.message
+ };
+ }
+ default:
+ return state;
+ }
+}
diff --git a/web/src/store/ui/type.ts b/web/src/store/ui/type.ts
new file mode 100644
index 00000000..fd1dd370
--- /dev/null
+++ b/web/src/store/ui/type.ts
@@ -0,0 +1,48 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+export interface MessageData {
+ content: string;
+ kind: string;
+}
+
+export interface MessageState {
+ [path: string]: MessageData;
+}
+
+export interface UIState {
+ message: MessageState;
+}
+
+export const SET_MESSAGE = 'ui/SET_MESSAGE';
+export const UNSET_MESSAGE = 'ui/UNSET_MESSAGE';
+
+export interface SetMessageAction {
+ type: typeof SET_MESSAGE;
+ data: {
+ message: string;
+ kind: string;
+ path: string;
+ };
+}
+
+export interface UnsetMessageAction {
+ type: typeof UNSET_MESSAGE;
+}
+
+export type UIActionType = SetMessageAction | UnsetMessageAction;
diff --git a/web/tsconfig.json b/web/tsconfig.json
new file mode 100644
index 00000000..23fce0b8
--- /dev/null
+++ b/web/tsconfig.json
@@ -0,0 +1,29 @@
+{
+ "compilerOptions": {
+ "outDir": "./public/",
+ "sourceMap": true,
+ "noImplicitAny": false,
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "target": "es6",
+ "jsx": "react",
+ "esModuleInterop": true,
+ "allowJs": true,
+ "baseUrl": ".",
+ "paths": {
+ "jslib/*": [
+ "../jslib/src/*"
+ ],
+ "web/*": [
+ "./src/*"
+ ]
+ }
+ },
+ "exclude": [
+ "node_modules",
+ "compiled",
+ "jslib/node_modules",
+ "jslib/dist",
+ "browser"
+ ]
+}
diff --git a/web/webpack/dev.config.js b/web/webpack/dev.config.js
new file mode 100644
index 00000000..513e66be
--- /dev/null
+++ b/web/webpack/dev.config.js
@@ -0,0 +1,52 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const PATHS = require('./paths');
+const rules = require('./rules');
+const plugins = require('./plugins');
+const resolve = require('./resolve');
+const externals = require('./externals');
+
+module.exports = env => {
+ const standalone = env.standalone === 'true';
+
+ return {
+ mode: 'development',
+ devtool: 'eval',
+ entry: { app: ['./src/client'] },
+ output: {
+ path: PATHS.output,
+ filename: '[name].js',
+ publicPath: PATHS.public
+ },
+ devServer: {
+ publicPath: PATHS.public,
+ port: 8080
+ },
+ module: { rules: rules({ production: false }) },
+ resolve,
+ plugins: plugins({
+ production: false,
+ standalone
+ }),
+ externals,
+ watchOptions: {
+ poll: 2500
+ }
+ };
+};
diff --git a/web/webpack/externals.js b/web/webpack/externals.js
new file mode 100644
index 00000000..7e1f0ec5
--- /dev/null
+++ b/web/webpack/externals.js
@@ -0,0 +1,19 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+module.exports = {};
diff --git a/web/webpack/paths.js b/web/webpack/paths.js
new file mode 100644
index 00000000..0fb33285
--- /dev/null
+++ b/web/webpack/paths.js
@@ -0,0 +1,32 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const path = require('path');
+
+/*
+ * __dirname is changed after webpack-ed to another directory
+ * so process.cwd() is used instead to determine the correct base directory
+ * Read more: https://nodejs.org/api/process.html#process_process_cwd
+ */
+const CURRENT_WORKING_DIR = process.cwd();
+
+module.exports = {
+ output: process.env.OUTPUT_PATH,
+ public: '/', // use absolute path for css-loader?
+ modules: path.resolve(CURRENT_WORKING_DIR, 'node_modules')
+};
diff --git a/web/webpack/plugins.js b/web/webpack/plugins.js
new file mode 100644
index 00000000..e828361d
--- /dev/null
+++ b/web/webpack/plugins.js
@@ -0,0 +1,53 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const webpack = require('webpack');
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+const ManifestPlugin = require('webpack-manifest-plugin');
+
+module.exports = ({ production = false, standalone = true } = {}) => {
+ const rootUrl = process.env.ROOT_URL;
+ const cdnUrl = 'https://cdn.getdnote.com';
+ const version = process.env.VERSION;
+
+ const compileTimeConstantForMinification = {
+ __ROOT_URL__: JSON.stringify(rootUrl),
+ __CDN_URL__: JSON.stringify(cdnUrl),
+ __VERSION__: JSON.stringify(version),
+ __STANDALONE__: JSON.stringify(standalone)
+ };
+
+ if (!production) {
+ return [
+ new webpack.DefinePlugin(compileTimeConstantForMinification),
+ new webpack.HotModuleReplacementPlugin(),
+ new webpack.NoEmitOnErrorsPlugin()
+ ];
+ }
+
+ return [
+ new webpack.DefinePlugin(compileTimeConstantForMinification),
+ new MiniCssExtractPlugin({
+ filename: '[contenthash].css',
+ allChunks: true
+ }),
+ new ManifestPlugin({
+ fileName: 'webpack-manifest.json'
+ })
+ ];
+};
diff --git a/web/webpack/prod.config.js b/web/webpack/prod.config.js
new file mode 100644
index 00000000..2312e65c
--- /dev/null
+++ b/web/webpack/prod.config.js
@@ -0,0 +1,47 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const PATHS = require('./paths');
+const rules = require('./rules');
+const plugins = require('./plugins');
+const resolve = require('./resolve');
+
+module.exports = env => {
+ const standalone = env.standalone === 'true';
+
+ return {
+ mode: 'production',
+ devtool: 'cheap-module-source-map',
+ entry: { app: ['./src/client'] },
+ output: {
+ path: PATHS.output,
+ filename: '[chunkhash].js',
+ chunkFilename: '[name].[chunkhash:6].js', // for code splitting. will work without but useful to set
+ publicPath: PATHS.public
+ },
+ module: { rules: rules({ production: true }) },
+ resolve,
+ plugins: plugins({
+ production: true,
+ standalone
+ }),
+ optimization: {
+ minimize: true
+ }
+ };
+};
diff --git a/web/webpack/resolve.js b/web/webpack/resolve.js
new file mode 100644
index 00000000..23ea6afd
--- /dev/null
+++ b/web/webpack/resolve.js
@@ -0,0 +1,30 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const path = require('path');
+const PATHS = require('./paths');
+
+module.exports = {
+ modules: [PATHS.modules],
+ extensions: ['.js', '.jsx', '.css', '.ts', '.tsx'],
+ alias: {
+ 'react-dom': '@hot-loader/react-dom',
+ jslib: path.join(__dirname, '../../jslib/src'),
+ web: path.join(__dirname, '../../web/src')
+ }
+};
diff --git a/web/webpack/rules/css.js b/web/webpack/rules/css.js
new file mode 100644
index 00000000..4aac745a
--- /dev/null
+++ b/web/webpack/rules/css.js
@@ -0,0 +1,90 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+
+module.exports = ({ production = false } = {}) => {
+ const createScssLoaders = (sourceMap = true, useModules = false) => {
+ let localIdentName;
+ if (production) {
+ localIdentName = '[local]_[hash:base64:5]';
+ } else {
+ localIdentName = '[name]__[local]___[hash:base64:5]';
+ }
+
+ let modules;
+ if (useModules) {
+ modules = {
+ localIdentName
+ };
+ } else {
+ modules = false;
+ }
+
+ return [
+ {
+ loader: 'css-loader',
+ options: {
+ sourceMap,
+ modules,
+ importLoaders: 2
+ }
+ },
+ {
+ loader: 'postcss-loader',
+ options: {
+ sourceMap,
+ ident: 'postcss',
+ plugins: () => [require('autoprefixer')(), require('cssnano')()]
+ }
+ },
+ {
+ loader: 'sass-loader',
+ options: {
+ sourceMap
+ }
+ }
+ ];
+ };
+
+ const createBrowserLoaders = extractCssToFile => loaders => {
+ if (extractCssToFile) {
+ return [MiniCssExtractPlugin.loader, ...loaders];
+ }
+ return [{ loader: 'style-loader' }, ...loaders];
+ };
+
+ const scssLoaders = createBrowserLoaders(production)(
+ createScssLoaders(true, false)
+ );
+ const scssModuleLoaders = createBrowserLoaders(production)(
+ createScssLoaders(true, true)
+ );
+
+ return [
+ {
+ test: /\.global\.scss$/,
+ use: scssLoaders
+ },
+ {
+ test: /\.scss$/,
+ exclude: /\.global\.scss$/,
+ use: scssModuleLoaders
+ }
+ ];
+};
diff --git a/web/webpack/rules/image.js b/web/webpack/rules/image.js
new file mode 100644
index 00000000..116b3e1b
--- /dev/null
+++ b/web/webpack/rules/image.js
@@ -0,0 +1,29 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const PATHS = require('../paths');
+
+module.exports = ({ limit = 10000 } = {}) => ({
+ test: /\.(bmp|gif|jpg|jpeg|png|svg)$/,
+ use: [
+ {
+ loader: 'url-loader',
+ options: { name: '[hash].[ext]', limit }
+ }
+ ]
+});
diff --git a/web/webpack/rules/index.js b/web/webpack/rules/index.js
new file mode 100644
index 00000000..b5888992
--- /dev/null
+++ b/web/webpack/rules/index.js
@@ -0,0 +1,27 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const image = require('./image');
+const javascript = require('./javascript');
+const css = require('./css');
+
+module.exports = ({ production = false } = {}) => [
+ ...javascript({ production }),
+ ...css({ production }),
+ image()
+];
diff --git a/web/webpack/rules/javascript.js b/web/webpack/rules/javascript.js
new file mode 100644
index 00000000..77b93c32
--- /dev/null
+++ b/web/webpack/rules/javascript.js
@@ -0,0 +1,71 @@
+/* Copyright (C) 2019, 2020 Monomax Software Pty Ltd
+ *
+ * This file is part of Dnote.
+ *
+ * Dnote is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dnote is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Dnote. If not, see .
+ */
+
+const PATHS = require('../paths');
+
+const createPlugins = () => {
+ const ret = [
+ '@babel/plugin-proposal-class-properties',
+ '@babel/plugin-transform-react-constant-elements',
+ 'react-hot-loader/babel',
+ ];
+
+ return ret;
+};
+
+module.exports = () => {
+ const presets = [
+ [
+ '@babel/preset-env',
+ {
+ useBuiltIns: 'entry',
+ corejs: '3',
+ targets: '> 0.25%, not dead',
+ },
+ ],
+ '@babel/preset-react',
+ ];
+ const plugins = createPlugins();
+
+ return [
+ {
+ test: /\.js$|\.jsx$/,
+ loader: 'babel-loader',
+ options: {
+ presets,
+ plugins,
+ },
+ exclude: PATHS.modules,
+ },
+ {
+ test: /\.ts(x?)$/,
+ exclude: /node_modules|_test\.ts(x)$/,
+ use: [
+ {
+ loader: 'ts-loader',
+ },
+ ],
+ },
+ // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
+ {
+ enforce: 'pre',
+ test: /\.js$/,
+ loader: 'source-map-loader',
+ },
+ ];
+};