├── .gitignore ├── LICENSE.txt ├── README.md ├── domain ├── article.ts └── author.ts ├── driver └── articleDriver.ts ├── index.html ├── index.tsx ├── interface ├── driver │ └── articleDriver.ts ├── repository │ └── articleRepository.ts └── useCase │ └── articleUseCase.ts ├── mock_server ├── app.ts ├── package.json ├── yarn-error.log └── yarn.lock ├── package.json ├── presenter ├── App.tsx └── components │ ├── ArticleItem.tsx │ └── Articles.tsx ├── repository ├── __tests__ │ └── articleRepository.test.ts └── articleRepository.ts ├── tsconfig.json ├── useCase ├── __tests__ │ └── articleUseCase.test.ts └── articleUseCase.ts └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .cache 3 | node_modules 4 | dist 5 | yarn-error.log 6 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Clean Architecture Example 2 | 3 | Introducing Clean Architecture will make application sustainable and improve testability. We can receive the benefits of Clean Architecture not only for backend app but also for the frontend app. 4 | 5 | This project introduces Clean Architecture in frontend and executes unit test using mock in each layer. 6 | 7 | # How to run 8 | 9 | Here's how to actually run this project. 10 | 11 | ## Mock Server 12 | 13 | There is a flow to fetch some data in frontend, for that preparing a mock server to send temporary data. 14 | 15 | ```bash 16 | $ cd mock_server 17 | $ yarn 18 | $ yarn start 19 | ``` 20 | 21 | ## Frontend 22 | 23 | ```bash 24 | $ yarn install 25 | $ yarn start 26 | ``` 27 | 28 | Then open `http://localhost:1234` in your browser. 29 | 30 | -------------------------------------------------------------------------------- /domain/article.ts: -------------------------------------------------------------------------------- 1 | import { Author } from "./author"; 2 | 3 | export class Article { 4 | readonly id: number; 5 | readonly name: string; 6 | readonly author: Author; 7 | readonly createdAt: Date; 8 | 9 | constructor(id: number, name: string, author: Author, createdAt: Date) { 10 | this.id = id; 11 | this.name = name; 12 | this.author = author; 13 | this.createdAt = createdAt; 14 | } 15 | 16 | get authorName(): string { 17 | return this.author.name; 18 | } 19 | 20 | get formattedDate(): string { 21 | return `${this.createdAt.getFullYear()}-${String( 22 | this.createdAt.getMonth() + 1 23 | ).padStart(2, "0")}-${String(this.createdAt.getDate()).padStart(2, "0")}`; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /domain/author.ts: -------------------------------------------------------------------------------- 1 | export class Author { 2 | readonly id: number; 3 | readonly name: string; 4 | 5 | constructor(id: number, name: string) { 6 | this.id = id; 7 | this.name = name; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /driver/articleDriver.ts: -------------------------------------------------------------------------------- 1 | import ArticleDriver, { ArticlesJson } from "../interface/driver/articleDriver"; 2 | 3 | export default class ArticleDriverImpl implements ArticleDriver { 4 | async findAll(): Promise { 5 | const res = await fetch("http://localhost:3000/articles"); 6 | return await res.json(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Clean Architecture Sample 6 | 7 | 8 |
9 | 10 | 11 | -------------------------------------------------------------------------------- /index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./presenter/App"; 4 | import ArticleDriverImpl from "./driver/articleDriver"; 5 | import ArticleRepositoryImpl from "./repository/articleRepository"; 6 | import ArticleUseCaseImpl from "./useCase/articleUseCase"; 7 | 8 | const repository = new ArticleRepositoryImpl(new ArticleDriverImpl()); 9 | const useCase = new ArticleUseCaseImpl(repository); 10 | ReactDOM.render(, document.getElementById("app")); 11 | -------------------------------------------------------------------------------- /interface/driver/articleDriver.ts: -------------------------------------------------------------------------------- 1 | export default interface ArticleDriver { 2 | findAll(): Promise; 3 | } 4 | 5 | export type ArticlesJson = { 6 | articles: ArticleJson[]; 7 | }; 8 | 9 | export type ArticleJson = { 10 | id: number; 11 | name: string; 12 | author: { 13 | id: number; 14 | name: string; 15 | }; 16 | createdAt: string; 17 | }; 18 | -------------------------------------------------------------------------------- /interface/repository/articleRepository.ts: -------------------------------------------------------------------------------- 1 | import { Article } from "../../domain/article"; 2 | 3 | export default interface ArticleRepository { 4 | findAll(): Promise; 5 | } 6 | -------------------------------------------------------------------------------- /interface/useCase/articleUseCase.ts: -------------------------------------------------------------------------------- 1 | import { Article } from "../../domain/article"; 2 | 3 | export interface ArticleUseCase { 4 | fetchArticles(): Promise; 5 | } 6 | -------------------------------------------------------------------------------- /mock_server/app.ts: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | const app = express(); 3 | 4 | app.use((req, res, next) => { 5 | res.header("Access-Control-Allow-Origin", "*"); 6 | next(); 7 | }); 8 | 9 | app.get("/articles", (req, res) => { 10 | res.setHeader("content-type", "application/json"); 11 | res.send({ 12 | articles: Array.from({ length: 100 }).map((_, i) => ({ 13 | id: i + 1, 14 | name: `post-${i + 1}`, 15 | author: { 16 | id: i + 1, 17 | name: `author-${i + 1}` 18 | }, 19 | createdAt: new Date("2019-01-01") 20 | })) 21 | }); 22 | }); 23 | 24 | app.listen(3000); 25 | -------------------------------------------------------------------------------- /mock_server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mock_server", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.ts", 6 | "scripts": { 7 | "start": "ts-node app.ts" 8 | }, 9 | "dependencies": { 10 | "@types/express": "^4.17.1", 11 | "@types/node": "^12.7.2", 12 | "express": "^4.17.1", 13 | "http": "^0.0.0", 14 | "ts-node": "^8.3.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /mock_server/yarn-error.log: -------------------------------------------------------------------------------- 1 | Arguments: 2 | /Users/kazuya/.nodebrew/node/v11.13.0/bin/node /Users/kazuya/.nodebrew/current/bin/yarn add @types/http 3 | 4 | PATH: 5 | /Users/kazuya/.cargo/bin:/usr/local/opt/gettext/bin:/Users/kazuya/flutter/bin:/usr/local/opt/php@7.2/sbin:/usr/local/opt/php@7.2/bin:/Users/kazuya/.cargo/bin:/Users/kazuya/.nodebrew/current/bin:/Users/kazuya/.pyenv/shims:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/bin:/Users/kazuya/.exenv/shims:/Users/kazuya/.exenv/bin:/Users/kazuya/.exenv/shims:/Users/kazuya/.exenv/bin:/Users/kazuya/.rbenv/shims:/Users/kazuya/.rbenv/shims:/Users/kazuya/.nodebrew/current/bin:/Users/kazuya/.exenv/shims:/Users/kazuya/.exenv/bin:/Users/kazuya/.rbenv/shims:/Users/kazuya/.rbenv/shims:/Users/kazuya/.nodebrew/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/kazuya/android-sdk/tools{}:/Users/kazuya/android-sdk/tools:/Users/kazuya/android-sdk/platform-tools:/Users/kazuya/android-sdk/tools{}:/Users/kazuya/android-sdk/tools:/Users/kazuya/android-sdk/platform-tools:/Users/kazuya/go/bin 6 | 7 | Yarn version: 8 | 1.15.2 9 | 10 | Node version: 11 | 11.13.0 12 | 13 | Platform: 14 | darwin x64 15 | 16 | Trace: 17 | Error: https://registry.yarnpkg.com/@types%2fhttp: Not found 18 | at Request.params.callback [as _callback] (/Users/kazuya/.nodebrew/node/v11.13.0/lib/node_modules/yarn/lib/cli.js:66058:18) 19 | at Request.self.callback (/Users/kazuya/.nodebrew/node/v11.13.0/lib/node_modules/yarn/lib/cli.js:129541:22) 20 | at Request.emit (events.js:193:13) 21 | at Request. (/Users/kazuya/.nodebrew/node/v11.13.0/lib/node_modules/yarn/lib/cli.js:130513:10) 22 | at Request.emit (events.js:193:13) 23 | at IncomingMessage. (/Users/kazuya/.nodebrew/node/v11.13.0/lib/node_modules/yarn/lib/cli.js:130435:12) 24 | at Object.onceWrapper (events.js:281:20) 25 | at IncomingMessage.emit (events.js:198:15) 26 | at endReadableNT (_stream_readable.js:1142:12) 27 | at processTicksAndRejections (internal/process/task_queues.js:81:17) 28 | 29 | npm manifest: 30 | { 31 | "name": "mock_server", 32 | "version": "1.0.0", 33 | "description": "", 34 | "main": "app.ts", 35 | "scripts": { 36 | "start": "ts-node app.ts" 37 | }, 38 | "dependencies": { 39 | "http": "^0.0.0", 40 | "ts-node": "^8.3.0" 41 | } 42 | } 43 | 44 | yarn manifest: 45 | No manifest 46 | 47 | Lockfile: 48 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 49 | # yarn lockfile v1 50 | 51 | 52 | arg@^4.1.0: 53 | version "4.1.1" 54 | resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.1.tgz#485f8e7c390ce4c5f78257dbea80d4be11feda4c" 55 | integrity sha512-SlmP3fEA88MBv0PypnXZ8ZfJhwmDeIE3SP71j37AiXQBXYosPV0x6uISAaHYSlSVhmHOVkomen0tbGk6Anlebw== 56 | 57 | buffer-from@^1.0.0: 58 | version "1.1.1" 59 | resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" 60 | integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== 61 | 62 | diff@^4.0.1: 63 | version "4.0.1" 64 | resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" 65 | integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== 66 | 67 | http@^0.0.0: 68 | version "0.0.0" 69 | resolved "https://registry.yarnpkg.com/http/-/http-0.0.0.tgz#86e6326d29c5d039de9fac584a45689f929f4f72" 70 | integrity sha1-huYybSnF0Dnen6xYSkVon5KfT3I= 71 | 72 | make-error@^1.1.1: 73 | version "1.3.5" 74 | resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" 75 | integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== 76 | 77 | source-map-support@^0.5.6: 78 | version "0.5.13" 79 | resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" 80 | integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== 81 | dependencies: 82 | buffer-from "^1.0.0" 83 | source-map "^0.6.0" 84 | 85 | source-map@^0.6.0: 86 | version "0.6.1" 87 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" 88 | integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== 89 | 90 | ts-node@^8.3.0: 91 | version "8.3.0" 92 | resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.3.0.tgz#e4059618411371924a1fb5f3b125915f324efb57" 93 | integrity sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ== 94 | dependencies: 95 | arg "^4.1.0" 96 | diff "^4.0.1" 97 | make-error "^1.1.1" 98 | source-map-support "^0.5.6" 99 | yn "^3.0.0" 100 | 101 | yn@^3.0.0: 102 | version "3.1.1" 103 | resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" 104 | integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== 105 | -------------------------------------------------------------------------------- /mock_server/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@types/body-parser@*": 6 | version "1.17.1" 7 | resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.17.1.tgz#18fcf61768fb5c30ccc508c21d6fd2e8b3bf7897" 8 | integrity sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w== 9 | dependencies: 10 | "@types/connect" "*" 11 | "@types/node" "*" 12 | 13 | "@types/connect@*": 14 | version "3.4.32" 15 | resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.32.tgz#aa0e9616b9435ccad02bc52b5b454ffc2c70ba28" 16 | integrity sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg== 17 | dependencies: 18 | "@types/node" "*" 19 | 20 | "@types/express-serve-static-core@*": 21 | version "4.16.9" 22 | resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.16.9.tgz#69e00643b0819b024bdede95ced3ff239bb54558" 23 | integrity sha512-GqpaVWR0DM8FnRUJYKlWgyARoBUAVfRIeVDZQKOttLFp5SmhhF9YFIYeTPwMd/AXfxlP7xVO2dj1fGu0Q+krKQ== 24 | dependencies: 25 | "@types/node" "*" 26 | "@types/range-parser" "*" 27 | 28 | "@types/express@^4.17.1": 29 | version "4.17.1" 30 | resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.1.tgz#4cf7849ae3b47125a567dfee18bfca4254b88c5c" 31 | integrity sha512-VfH/XCP0QbQk5B5puLqTLEeFgR8lfCJHZJKkInZ9mkYd+u8byX0kztXEQxEk4wZXJs8HI+7km2ALXjn4YKcX9w== 32 | dependencies: 33 | "@types/body-parser" "*" 34 | "@types/express-serve-static-core" "*" 35 | "@types/serve-static" "*" 36 | 37 | "@types/mime@*": 38 | version "2.0.1" 39 | resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.1.tgz#dc488842312a7f075149312905b5e3c0b054c79d" 40 | integrity sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw== 41 | 42 | "@types/node@*", "@types/node@^12.7.2": 43 | version "12.7.2" 44 | resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44" 45 | integrity sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg== 46 | 47 | "@types/range-parser@*": 48 | version "1.2.3" 49 | resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c" 50 | integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA== 51 | 52 | "@types/serve-static@*": 53 | version "1.13.3" 54 | resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.3.tgz#eb7e1c41c4468272557e897e9171ded5e2ded9d1" 55 | integrity sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g== 56 | dependencies: 57 | "@types/express-serve-static-core" "*" 58 | "@types/mime" "*" 59 | 60 | accepts@~1.3.7: 61 | version "1.3.7" 62 | resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" 63 | integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== 64 | dependencies: 65 | mime-types "~2.1.24" 66 | negotiator "0.6.2" 67 | 68 | arg@^4.1.0: 69 | version "4.1.1" 70 | resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.1.tgz#485f8e7c390ce4c5f78257dbea80d4be11feda4c" 71 | integrity sha512-SlmP3fEA88MBv0PypnXZ8ZfJhwmDeIE3SP71j37AiXQBXYosPV0x6uISAaHYSlSVhmHOVkomen0tbGk6Anlebw== 72 | 73 | array-flatten@1.1.1: 74 | version "1.1.1" 75 | resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" 76 | integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= 77 | 78 | body-parser@1.19.0: 79 | version "1.19.0" 80 | resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" 81 | integrity sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== 82 | dependencies: 83 | bytes "3.1.0" 84 | content-type "~1.0.4" 85 | debug "2.6.9" 86 | depd "~1.1.2" 87 | http-errors "1.7.2" 88 | iconv-lite "0.4.24" 89 | on-finished "~2.3.0" 90 | qs "6.7.0" 91 | raw-body "2.4.0" 92 | type-is "~1.6.17" 93 | 94 | buffer-from@^1.0.0: 95 | version "1.1.1" 96 | resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" 97 | integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== 98 | 99 | bytes@3.1.0: 100 | version "3.1.0" 101 | resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" 102 | integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== 103 | 104 | content-disposition@0.5.3: 105 | version "0.5.3" 106 | resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" 107 | integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g== 108 | dependencies: 109 | safe-buffer "5.1.2" 110 | 111 | content-type@~1.0.4: 112 | version "1.0.4" 113 | resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" 114 | integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== 115 | 116 | cookie-signature@1.0.6: 117 | version "1.0.6" 118 | resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" 119 | integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= 120 | 121 | cookie@0.4.0: 122 | version "0.4.0" 123 | resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" 124 | integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== 125 | 126 | debug@2.6.9: 127 | version "2.6.9" 128 | resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" 129 | integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== 130 | dependencies: 131 | ms "2.0.0" 132 | 133 | depd@~1.1.2: 134 | version "1.1.2" 135 | resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" 136 | integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= 137 | 138 | destroy@~1.0.4: 139 | version "1.0.4" 140 | resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" 141 | integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= 142 | 143 | diff@^4.0.1: 144 | version "4.0.1" 145 | resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" 146 | integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== 147 | 148 | ee-first@1.1.1: 149 | version "1.1.1" 150 | resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" 151 | integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= 152 | 153 | encodeurl@~1.0.2: 154 | version "1.0.2" 155 | resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" 156 | integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= 157 | 158 | escape-html@~1.0.3: 159 | version "1.0.3" 160 | resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" 161 | integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= 162 | 163 | etag@~1.8.1: 164 | version "1.8.1" 165 | resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" 166 | integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= 167 | 168 | express@^4.17.1: 169 | version "4.17.1" 170 | resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" 171 | integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== 172 | dependencies: 173 | accepts "~1.3.7" 174 | array-flatten "1.1.1" 175 | body-parser "1.19.0" 176 | content-disposition "0.5.3" 177 | content-type "~1.0.4" 178 | cookie "0.4.0" 179 | cookie-signature "1.0.6" 180 | debug "2.6.9" 181 | depd "~1.1.2" 182 | encodeurl "~1.0.2" 183 | escape-html "~1.0.3" 184 | etag "~1.8.1" 185 | finalhandler "~1.1.2" 186 | fresh "0.5.2" 187 | merge-descriptors "1.0.1" 188 | methods "~1.1.2" 189 | on-finished "~2.3.0" 190 | parseurl "~1.3.3" 191 | path-to-regexp "0.1.7" 192 | proxy-addr "~2.0.5" 193 | qs "6.7.0" 194 | range-parser "~1.2.1" 195 | safe-buffer "5.1.2" 196 | send "0.17.1" 197 | serve-static "1.14.1" 198 | setprototypeof "1.1.1" 199 | statuses "~1.5.0" 200 | type-is "~1.6.18" 201 | utils-merge "1.0.1" 202 | vary "~1.1.2" 203 | 204 | finalhandler@~1.1.2: 205 | version "1.1.2" 206 | resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" 207 | integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== 208 | dependencies: 209 | debug "2.6.9" 210 | encodeurl "~1.0.2" 211 | escape-html "~1.0.3" 212 | on-finished "~2.3.0" 213 | parseurl "~1.3.3" 214 | statuses "~1.5.0" 215 | unpipe "~1.0.0" 216 | 217 | forwarded@~0.1.2: 218 | version "0.1.2" 219 | resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" 220 | integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ= 221 | 222 | fresh@0.5.2: 223 | version "0.5.2" 224 | resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" 225 | integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= 226 | 227 | http-errors@1.7.2: 228 | version "1.7.2" 229 | resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" 230 | integrity sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg== 231 | dependencies: 232 | depd "~1.1.2" 233 | inherits "2.0.3" 234 | setprototypeof "1.1.1" 235 | statuses ">= 1.5.0 < 2" 236 | toidentifier "1.0.0" 237 | 238 | http-errors@~1.7.2: 239 | version "1.7.3" 240 | resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" 241 | integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== 242 | dependencies: 243 | depd "~1.1.2" 244 | inherits "2.0.4" 245 | setprototypeof "1.1.1" 246 | statuses ">= 1.5.0 < 2" 247 | toidentifier "1.0.0" 248 | 249 | http@^0.0.0: 250 | version "0.0.0" 251 | resolved "https://registry.yarnpkg.com/http/-/http-0.0.0.tgz#86e6326d29c5d039de9fac584a45689f929f4f72" 252 | integrity sha1-huYybSnF0Dnen6xYSkVon5KfT3I= 253 | 254 | iconv-lite@0.4.24: 255 | version "0.4.24" 256 | resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" 257 | integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== 258 | dependencies: 259 | safer-buffer ">= 2.1.2 < 3" 260 | 261 | inherits@2.0.3: 262 | version "2.0.3" 263 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" 264 | integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= 265 | 266 | inherits@2.0.4: 267 | version "2.0.4" 268 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" 269 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== 270 | 271 | ipaddr.js@1.9.0: 272 | version "1.9.0" 273 | resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.0.tgz#37df74e430a0e47550fe54a2defe30d8acd95f65" 274 | integrity sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA== 275 | 276 | make-error@^1.1.1: 277 | version "1.3.5" 278 | resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" 279 | integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== 280 | 281 | media-typer@0.3.0: 282 | version "0.3.0" 283 | resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" 284 | integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= 285 | 286 | merge-descriptors@1.0.1: 287 | version "1.0.1" 288 | resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" 289 | integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= 290 | 291 | methods@~1.1.2: 292 | version "1.1.2" 293 | resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" 294 | integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= 295 | 296 | mime-db@1.40.0: 297 | version "1.40.0" 298 | resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" 299 | integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== 300 | 301 | mime-types@~2.1.24: 302 | version "2.1.24" 303 | resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" 304 | integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== 305 | dependencies: 306 | mime-db "1.40.0" 307 | 308 | mime@1.6.0: 309 | version "1.6.0" 310 | resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" 311 | integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== 312 | 313 | ms@2.0.0: 314 | version "2.0.0" 315 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" 316 | integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= 317 | 318 | ms@2.1.1: 319 | version "2.1.1" 320 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" 321 | integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== 322 | 323 | negotiator@0.6.2: 324 | version "0.6.2" 325 | resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" 326 | integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== 327 | 328 | on-finished@~2.3.0: 329 | version "2.3.0" 330 | resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" 331 | integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= 332 | dependencies: 333 | ee-first "1.1.1" 334 | 335 | parseurl@~1.3.3: 336 | version "1.3.3" 337 | resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" 338 | integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== 339 | 340 | path-to-regexp@0.1.7: 341 | version "0.1.7" 342 | resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" 343 | integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= 344 | 345 | proxy-addr@~2.0.5: 346 | version "2.0.5" 347 | resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34" 348 | integrity sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ== 349 | dependencies: 350 | forwarded "~0.1.2" 351 | ipaddr.js "1.9.0" 352 | 353 | qs@6.7.0: 354 | version "6.7.0" 355 | resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" 356 | integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== 357 | 358 | range-parser@~1.2.1: 359 | version "1.2.1" 360 | resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" 361 | integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== 362 | 363 | raw-body@2.4.0: 364 | version "2.4.0" 365 | resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" 366 | integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== 367 | dependencies: 368 | bytes "3.1.0" 369 | http-errors "1.7.2" 370 | iconv-lite "0.4.24" 371 | unpipe "1.0.0" 372 | 373 | safe-buffer@5.1.2: 374 | version "5.1.2" 375 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" 376 | integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== 377 | 378 | "safer-buffer@>= 2.1.2 < 3": 379 | version "2.1.2" 380 | resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" 381 | integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== 382 | 383 | send@0.17.1: 384 | version "0.17.1" 385 | resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" 386 | integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== 387 | dependencies: 388 | debug "2.6.9" 389 | depd "~1.1.2" 390 | destroy "~1.0.4" 391 | encodeurl "~1.0.2" 392 | escape-html "~1.0.3" 393 | etag "~1.8.1" 394 | fresh "0.5.2" 395 | http-errors "~1.7.2" 396 | mime "1.6.0" 397 | ms "2.1.1" 398 | on-finished "~2.3.0" 399 | range-parser "~1.2.1" 400 | statuses "~1.5.0" 401 | 402 | serve-static@1.14.1: 403 | version "1.14.1" 404 | resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" 405 | integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== 406 | dependencies: 407 | encodeurl "~1.0.2" 408 | escape-html "~1.0.3" 409 | parseurl "~1.3.3" 410 | send "0.17.1" 411 | 412 | setprototypeof@1.1.1: 413 | version "1.1.1" 414 | resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" 415 | integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== 416 | 417 | source-map-support@^0.5.6: 418 | version "0.5.13" 419 | resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" 420 | integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== 421 | dependencies: 422 | buffer-from "^1.0.0" 423 | source-map "^0.6.0" 424 | 425 | source-map@^0.6.0: 426 | version "0.6.1" 427 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" 428 | integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== 429 | 430 | "statuses@>= 1.5.0 < 2", statuses@~1.5.0: 431 | version "1.5.0" 432 | resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" 433 | integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= 434 | 435 | toidentifier@1.0.0: 436 | version "1.0.0" 437 | resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" 438 | integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== 439 | 440 | ts-node@^8.3.0: 441 | version "8.3.0" 442 | resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.3.0.tgz#e4059618411371924a1fb5f3b125915f324efb57" 443 | integrity sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ== 444 | dependencies: 445 | arg "^4.1.0" 446 | diff "^4.0.1" 447 | make-error "^1.1.1" 448 | source-map-support "^0.5.6" 449 | yn "^3.0.0" 450 | 451 | type-is@~1.6.17, type-is@~1.6.18: 452 | version "1.6.18" 453 | resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" 454 | integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== 455 | dependencies: 456 | media-typer "0.3.0" 457 | mime-types "~2.1.24" 458 | 459 | unpipe@1.0.0, unpipe@~1.0.0: 460 | version "1.0.0" 461 | resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" 462 | integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= 463 | 464 | utils-merge@1.0.1: 465 | version "1.0.1" 466 | resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" 467 | integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= 468 | 469 | vary@~1.1.2: 470 | version "1.1.2" 471 | resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" 472 | integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= 473 | 474 | yn@^3.0.0: 475 | version "3.1.1" 476 | resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" 477 | integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== 478 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "clean_architecture_sample", 3 | "version": "1.0.0", 4 | "description": "Sample project of frontend Clean Architecture using React.js and jest.", 5 | "main": "index.tsx", 6 | "scripts": { 7 | "start": "parcel index.html" 8 | }, 9 | "keywords": [], 10 | "author": "tiger (https://github.com/t-tiger)", 11 | "license": "ISC", 12 | "jest": { 13 | "moduleFileExtensions": [ 14 | "ts", 15 | "tsx", 16 | "js" 17 | ], 18 | "transform": { 19 | "^.+\\.(ts|tsx)$": "ts-jest" 20 | }, 21 | "globals": { 22 | "ts-jest": { 23 | "tsConfig": "tsconfig.json" 24 | } 25 | }, 26 | "testMatch": [ 27 | "**/__tests__/*.+(ts|tsx|js)" 28 | ] 29 | }, 30 | "dependencies": { 31 | "prettier": "^1.18.2", 32 | "react": "^16.9.0", 33 | "react-dom": "^16.9.0" 34 | }, 35 | "devDependencies": { 36 | "@types/jest": "^24.0.18", 37 | "@types/react": "^16.9.2", 38 | "jest": "^24.9.0", 39 | "parcel": "^1.12.3", 40 | "ts-jest": "^24.0.2", 41 | "typescript": "^3.5.3" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /presenter/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import Articles from "./components/Articles"; 3 | import { Article } from "../domain/article"; 4 | import { ArticleUseCase } from "../interface/useCase/articleUseCase"; 5 | 6 | type Props = { 7 | useCase: ArticleUseCase; 8 | }; 9 | 10 | const App = ({ useCase }: Props) => { 11 | const [articles, setArticles] = useState([]); 12 | 13 | useEffect(() => { 14 | fetchArticles(); 15 | }, []); 16 | 17 | const fetchArticles = async () => { 18 | setArticles(await useCase.fetchArticles()); 19 | }; 20 | 21 | return ; 22 | }; 23 | 24 | export default App; 25 | -------------------------------------------------------------------------------- /presenter/components/ArticleItem.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Article } from "../../domain/article"; 3 | 4 | type Props = { 5 | article: Article; 6 | }; 7 | 8 | const ArticleItem = ({ article }: Props) => { 9 | return
{article.name} - {article.authorName} - {article.formattedDate}
; 10 | }; 11 | 12 | export default ArticleItem; 13 | -------------------------------------------------------------------------------- /presenter/components/Articles.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Article } from "../../domain/article"; 3 | import ArticleItem from "./ArticleItem"; 4 | 5 | type Props = { 6 | articles: Article[]; 7 | }; 8 | 9 | const Articles = ({ articles }: Props) => { 10 | return ( 11 | <> 12 | {articles.map(article => ( 13 | 14 | ))} 15 | 16 | ); 17 | }; 18 | 19 | export default Articles; 20 | -------------------------------------------------------------------------------- /repository/__tests__/articleRepository.test.ts: -------------------------------------------------------------------------------- 1 | import { Article } from "../../domain/article"; 2 | import { Author } from "../../domain/author"; 3 | import ArticleDriver, { 4 | ArticlesJson 5 | } from "../../interface/driver/articleDriver"; 6 | import ArticleRepositoryImpl from "../articleRepository"; 7 | 8 | class ArticleDriverMock implements ArticleDriver { 9 | findAll(): Promise { 10 | throw "not implemented"; 11 | } 12 | } 13 | 14 | describe("#findAll", () => { 15 | test("domain articles are returned", async () => { 16 | const articles: ArticlesJson = { 17 | articles: [ 18 | { 19 | id: 1, 20 | name: "articleName", 21 | author: { 22 | id: 2, 23 | name: "authorName" 24 | }, 25 | createdAt: "2019-01-01T00:00:00.000Z" 26 | } 27 | ] 28 | }; 29 | const mock = new ArticleDriverMock(); 30 | mock.findAll = async () => articles; 31 | const articleRepository = new ArticleRepositoryImpl(mock); 32 | 33 | expect(await articleRepository.findAll()).toEqual([ 34 | new Article( 35 | 1, 36 | "articleName", 37 | new Author(2, "authorName"), 38 | new Date("2019-01-01") 39 | ) 40 | ]); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /repository/articleRepository.ts: -------------------------------------------------------------------------------- 1 | import ArticleRepository from "../interface/repository/articleRepository"; 2 | import ArticleDriver from "../interface/driver/articleDriver"; 3 | import { Article } from "../domain/article"; 4 | import { Author } from "../domain/author"; 5 | 6 | export default class ArticleRepositoryImpl implements ArticleRepository { 7 | private readonly articleDriver: ArticleDriver; 8 | 9 | constructor(articleDriver: ArticleDriver) { 10 | this.articleDriver = articleDriver; 11 | } 12 | 13 | async findAll(): Promise { 14 | const res = await this.articleDriver.findAll(); 15 | return res.articles.map( 16 | articleEntity => 17 | new Article( 18 | articleEntity.id, 19 | articleEntity.name, 20 | new Author(articleEntity.author.id, articleEntity.author.name), 21 | new Date(articleEntity.createdAt) 22 | ) 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "es2015"], 5 | "jsx": "react", 6 | "esModuleInterop": true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /useCase/__tests__/articleUseCase.test.ts: -------------------------------------------------------------------------------- 1 | import { Article } from "../../domain/article"; 2 | import ArticleRepository from "../../interface/repository/articleRepository"; 3 | import ArticleUseCaseImpl from "../articleUseCase"; 4 | 5 | class ArticleRepositoryMock implements ArticleRepository { 6 | findAll(): Promise { 7 | throw "not implemented"; 8 | } 9 | } 10 | 11 | describe("#fetchArticles", () => { 12 | test("domain articles are returned", async () => { 13 | const article1 = { id: 1 } as Article; 14 | const article2 = { id: 2 } as Article; 15 | 16 | const mock = new ArticleRepositoryMock(); 17 | mock.findAll = async () => [article1, article2]; 18 | 19 | const articleUseCase = new ArticleUseCaseImpl(mock); 20 | expect(await articleUseCase.fetchArticles()).toEqual([article1, article2]); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /useCase/articleUseCase.ts: -------------------------------------------------------------------------------- 1 | import { Article } from "../domain/article"; 2 | import { ArticleUseCase } from "../interface/useCase/articleUseCase"; 3 | import ArticleRepository from "../interface/repository/articleRepository"; 4 | 5 | export default class ArticleUseCaseImpl implements ArticleUseCase { 6 | readonly articleRepository: ArticleRepository; 7 | 8 | constructor(repository: ArticleRepository) { 9 | this.articleRepository = repository; 10 | } 11 | 12 | async fetchArticles(): Promise { 13 | return await this.articleRepository.findAll(); 14 | } 15 | } 16 | --------------------------------------------------------------------------------