├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── docs ├── RelayAppsync-AuthIam.md ├── RelayAppsync-Introduction.md └── RelayAppsync-UploadS3.md ├── packages ├── react-relay-auth-iam │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── middleware-auth-iam.ts │ │ └── signer.ts │ ├── tsconfig.json │ └── yarn.lock └── react-relay-upload-s3 │ ├── .gitignore │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── index.ts │ └── middleware-upload-s3.ts │ └── tsconfig.json └── website ├── .gitignore ├── core └── Footer.js ├── i18n └── en.json ├── package.json ├── sidebars.json ├── siteConfig.js ├── static ├── css │ └── custom.css ├── img │ ├── favicon.ico │ ├── oss_logo.png │ ├── undraw_code_review.svg │ ├── undraw_monitor.svg │ ├── undraw_note_list.svg │ ├── undraw_online.svg │ ├── undraw_open_source.svg │ ├── undraw_operating_system.svg │ ├── undraw_react.svg │ ├── undraw_tweetstorm.svg │ └── undraw_youtube_tutorial.svg └── index.html └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | *.tgz 4 | .DS_STORE -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | src/ 2 | *.tgz 3 | tsconfig.json 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Lorenzo Di Giacomo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [React Relay AppSync](https://github.com/morrys/react-relay-upload-s3) 2 | AppSync for Relay 3 | 4 | ## Offline capabilities 5 | 6 | [React Relay Offline](https://github.com/morrys/react-relay-offline#readme) 7 | 8 | ## Usage React Relay Upload S3 9 | 10 | [See README.md](./packages/react-relay-upload-s3/README.md) 11 | 12 | ## Usage React Relay Authentication AWS IAM 13 | 14 | [See README.md](./packages/react-relay-auth-iam/README.md) 15 | 16 | ## TODO 17 | 18 | Document how to use urlMiddleware and authMiddleware in the context of AWS 19 | 20 | Implementation of Delta Sync 21 | 22 | 23 | ## License 24 | 25 | React Relay AppSync is [MIT licensed](./LICENSE). 26 | 27 | -------------------------------------------------------------------------------- /docs/RelayAppsync-AuthIam.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: react-relay-auth-iam 3 | title: React Relay Auth IAM 4 | --- 5 | 6 | # [React Relay Authentication AWS IAM](https://github.com/morrys/react-relay-appsync) 7 | Middleware for Relay Modern Network Layer for authentication to AWS IAM 8 | 9 | ## Installation 10 | 11 | Install react-relay-auth-iam using yarn or npm: 12 | 13 | ``` 14 | yarn add react-relay-auth-iam 15 | ``` 16 | 17 | ## Usage 18 | 19 | How to create the RelayNetworkLayer 20 | 21 | ```typescript 22 | import {authIAMMiddleware} from 'react-relay-auth-iam'; 23 | ``` 24 | 25 | ```typescript 26 | const network = new RelayNetworkLayer( 27 | [ 28 | urlMiddleware(...), 29 | authIAMMiddleware({credentials: iamCredentials, region: region}), 30 | ], 31 | {} 32 | ); 33 | ``` -------------------------------------------------------------------------------- /docs/RelayAppsync-Introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: react-relay-appsync 3 | title: Getting Started 4 | --- 5 | 6 | AppSync for Relay 7 | 8 | ## Offline capabilities 9 | 10 | [React Relay Offline](https://morrys.github.io/react-relay-offline/docs/react-relay-offline) 11 | 12 | 13 | ## TODO 14 | 15 | Document how to use urlMiddleware and authMiddleware in the context of AWS 16 | 17 | Implementation of Delta Sync -------------------------------------------------------------------------------- /docs/RelayAppsync-UploadS3.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: react-relay-upload-s3 3 | title: React Relay Upload S3 4 | --- 5 | 6 | # [React Relay Upload S3](https://github.com/morrys/react-relay-appsync) 7 | Middleware for Relay Modern Network Layer for upload file to AWS S3 8 | 9 | ## Installation 10 | 11 | Install react-relay-upload-s3 using yarn or npm: 12 | 13 | ``` 14 | yarn add react-relay-upload-s3 15 | ``` 16 | 17 | ## Usage 18 | 19 | How to create the RelayNetworkLayer 20 | 21 | ```typescript 22 | import {uploadS3Middleware} from 'react-relay-upload-s3'; 23 | ``` 24 | 25 | ```typescript 26 | const network = new RelayNetworkLayer( 27 | [ 28 | urlMiddleware(...), 29 | uploadS3Middleware({credentials: complexObjectsCredentials}), 30 | authMiddleware(...), 31 | ], 32 | {} 33 | ); 34 | ``` 35 | 36 | How to use in commitMutation 37 | 38 | ```typescript 39 | 40 | //single file 41 | const file:any = { 42 | bucket: bucket, 43 | key: key, 44 | region: region, 45 | file: selectedFile 46 | }; 47 | 48 | commitMutation( 49 | ... 50 | uploadables: { 51 | file 52 | }, 53 | ); 54 | 55 | //multiple files 56 | const file1:any = { 57 | bucket: bucket, 58 | key: key1, 59 | region: region, 60 | file: selectedFile1 61 | }; 62 | 63 | const file2:any = { 64 | bucket: bucket, 65 | key: key2, 66 | region: region, 67 | file: selectedFile2 68 | }; 69 | 70 | commitMutation( 71 | ... 72 | uploadables: { 73 | file1, 74 | file2 75 | }, 76 | ); 77 | ``` 78 | 79 | -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | *.tgz 4 | -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/.npmignore: -------------------------------------------------------------------------------- 1 | src/ 2 | *.tgz 3 | tsconfig.json 4 | -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Lorenzo Di Giacomo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/README.md: -------------------------------------------------------------------------------- 1 | # [React Relay Authentication AWS IAM](https://github.com/morrys/react-relay-appsync) 2 | Middleware for Relay Modern Network Layer for authentication to AWS IAM 3 | 4 | ## Installation 5 | 6 | Install react-relay-auth-iam using yarn or npm: 7 | 8 | ``` 9 | yarn add react-relay-auth-iam 10 | ``` 11 | 12 | ## Usage 13 | 14 | How to create the RelayNetworkLayer 15 | 16 | ```typescript 17 | import {authIAMMiddleware} from 'react-relay-auth-iam'; 18 | ``` 19 | 20 | ```typescript 21 | const network = new RelayNetworkLayer( 22 | [ 23 | urlMiddleware(...), 24 | authIAMMiddleware({credentials: iamCredentials, region: region}), 25 | ], 26 | {} 27 | ); 28 | ``` 29 | 30 | ## License 31 | 32 | React Relay Authentication AWS IAM is [MIT licensed](./LICENSE). 33 | 34 | -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-relay-auth-iam", 3 | "version": "0.0.2", 4 | "keywords": [ 5 | "graphql", 6 | "relay", 7 | "auth", 8 | "react", 9 | "aws", 10 | "appsync", 11 | "iam" 12 | ], 13 | "main": "lib/index.js", 14 | "license": "MIT", 15 | "description": "React Relay Middleware Authentication AWS IAM", 16 | "author": { 17 | "name": "morrys" 18 | }, 19 | "homepage": "https://github.com/morrys/react-relay-appsync#readme", 20 | "repository": { 21 | "type": "git", 22 | "url": "https://github.com/morrys/react-relay-appsync" 23 | }, 24 | "scripts": { 25 | "prepare": "tsc" 26 | }, 27 | "dependencies": { 28 | "url": "^0.11.0" 29 | }, 30 | "peerDependencies": { 31 | "react-relay": ">=1.4.0" 32 | }, 33 | "devDependencies": { 34 | "typescript": "3.1.1", 35 | "@types/node": "^8.10.48", 36 | "aws-sdk": "^2.449.0", 37 | "react-relay-network-modern": "^2.5.1" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/src/index.ts: -------------------------------------------------------------------------------- 1 | export {default as authIAMMiddleware} from "./middleware-auth-iam"; 2 | -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/src/middleware-auth-iam.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Middleware, 3 | RelayNetworkLayerRequest 4 | } from "react-relay-network-modern/lib/definition"; 5 | import { Credentials, CredentialsOptions } from "aws-sdk/lib/credentials"; 6 | import { Signer } from "./signer"; 7 | import * as Url from "url"; 8 | const SERVICE = "appsync"; 9 | 10 | type CredentialsGetter = () => 11 | | ( 12 | | Credentials 13 | | CredentialsOptions 14 | | Promise 15 | | Promise 16 | | null 17 | ) 18 | | Credentials 19 | | CredentialsOptions 20 | | Promise 21 | | Promise 22 | | null; 23 | 24 | export type AuthIAMMiddlewareOpts = { 25 | credentials: CredentialsGetter; 26 | region: string; 27 | }; 28 | 29 | export default function authIAMMiddleware( 30 | opts: AuthIAMMiddlewareOpts 31 | ): Middleware { 32 | const { credentials, region } = opts; 33 | return next => async (req: RelayNetworkLayerRequest) => { 34 | const service = SERVICE; 35 | const url = req.fetchOpts.url; 36 | 37 | let creds = 38 | typeof credentials === "function" 39 | ? (credentials as any).call() 40 | : credentials || {}; 41 | 42 | if (creds && typeof creds.getPromise === "function") { 43 | await creds.getPromise(); 44 | } 45 | 46 | const { accessKeyId, secretAccessKey, sessionToken } = await creds; 47 | 48 | const { host, path } = Url.parse(url); 49 | 50 | const formatted = { 51 | ...formatAsRequest(req), 52 | service, 53 | region, 54 | url, 55 | host, 56 | path 57 | }; 58 | 59 | const { headers } = Signer.sign(formatted, { 60 | access_key: accessKeyId, 61 | secret_key: secretAccessKey, 62 | session_token: sessionToken 63 | }); 64 | req.fetchOpts.headers = { 65 | ...req.fetchOpts.headers, 66 | ...headers 67 | }; 68 | return next(req); 69 | }; 70 | } 71 | 72 | // Accept Content-Type 73 | const formatAsRequest = ({ fetchOpts }) => { 74 | return { 75 | body: fetchOpts.body, 76 | method: fetchOpts.method, 77 | headers: { 78 | Accept: "*/*", 79 | "Content-Type": "application/json; charset=UTF-8", 80 | ...fetchOpts.headers 81 | } 82 | }; 83 | }; 84 | -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/src/signer.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 - 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at 4 | http://aws.amazon.com/apache2.0/ 5 | or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6 | See the License for the specific language governing permissions and limitations under the License. 7 | */ 8 | global.Buffer = global.Buffer || require('buffer').Buffer; // Required for aws sigv4 signing 9 | 10 | 11 | 12 | var url = require('url'), 13 | crypto = require('aws-sdk/global').util.crypto; 14 | 15 | // var url = require('url'); 16 | // const crypto = require('aws-sdk/lib/browserCryptoLib'); //TODO evaluate 17 | 18 | var encrypt = function (key, src, encoding = '') { 19 | return crypto.lib.createHmac('sha256', key).update(src, 'utf8').digest(encoding); 20 | }; 21 | 22 | var hash = function (src) { 23 | src = src || ''; 24 | return crypto.createHash('sha256').update(src, 'utf8').digest('hex'); 25 | }; 26 | 27 | /** 28 | * @private 29 | * Create canonical headers 30 | * 31 |
 32 | CanonicalHeaders =
 33 |     CanonicalHeadersEntry0 + CanonicalHeadersEntry1 + ... + CanonicalHeadersEntryN
 34 | CanonicalHeadersEntry =
 35 |     Lowercase(HeaderName) + ':' + Trimall(HeaderValue) + '\n'
 36 | 
37 | */ 38 | var canonical_headers = function (headers) { 39 | if (!headers || Object.keys(headers).length === 0) { return ''; } 40 | 41 | return Object.keys(headers) 42 | .map(function (key) { 43 | return { 44 | key: key.toLowerCase(), 45 | value: headers[key] ? headers[key].trim().replace(/\s+/g, ' ') : '' 46 | }; 47 | }) 48 | .sort(function (a, b) { 49 | return a.key < b.key ? -1 : 1; 50 | }) 51 | .map(function (item) { 52 | return item.key + ':' + item.value; 53 | }) 54 | .join('\n') + '\n'; 55 | }; 56 | 57 | /** 58 | * List of header keys included in the canonical headers. 59 | * @access private 60 | */ 61 | var signed_headers = function (headers) { 62 | return Object.keys(headers) 63 | .map(function (key) { return key.toLowerCase(); }) 64 | .sort() 65 | .join(';'); 66 | }; 67 | 68 | /** 69 | * @private 70 | * Create canonical request 71 | * Refer to {@link http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html|Create a Canonical Request} 72 | * 73 |
 74 | CanonicalRequest =
 75 |     HTTPRequestMethod + '\n' +
 76 |     CanonicalURI + '\n' +
 77 |     CanonicalQueryString + '\n' +
 78 |     CanonicalHeaders + '\n' +
 79 |     SignedHeaders + '\n' +
 80 |     HexEncode(Hash(RequestPayload))
 81 | 
82 | */ 83 | var canonical_request = function (request) { 84 | var url_info = url.parse(request.url); 85 | 86 | return [ 87 | request.method || '/', 88 | url_info.path, 89 | url_info.query, 90 | canonical_headers(request.headers), 91 | signed_headers(request.headers), 92 | hash(request.body) 93 | ].join('\n'); 94 | }; 95 | 96 | var parse_service_info = function (request) { 97 | var url_info = url.parse(request.url), 98 | host = url_info.host; 99 | 100 | var matched = host.match(/([^.]+)\.(?:([^.]*)\.)?amazonaws\.com$/), 101 | parsed = (matched || []).slice(1, 3); 102 | 103 | if (parsed[1] === 'es') { // Elastic Search 104 | parsed = parsed.reverse(); 105 | } 106 | 107 | return { 108 | service: request.service || parsed[0], 109 | region: request.region || parsed[1] 110 | }; 111 | }; 112 | 113 | var credential_scope = function (d_str, region, service) { 114 | return [ 115 | d_str, 116 | region, 117 | service, 118 | 'aws4_request', 119 | ].join('/'); 120 | }; 121 | 122 | /** 123 | * @private 124 | * Create a string to sign 125 | * Refer to {@link http://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html|Create String to Sign} 126 | * 127 |
128 | StringToSign =
129 |     Algorithm + \n +
130 |     RequestDateTime + \n +
131 |     CredentialScope + \n +
132 |     HashedCanonicalRequest
133 | 
134 | */ 135 | var string_to_sign = function (algorithm, canonical_request, dt_str, scope) { 136 | return [ 137 | algorithm, 138 | dt_str, 139 | scope, 140 | hash(canonical_request) 141 | ].join('\n'); 142 | }; 143 | 144 | /** 145 | * @private 146 | * Create signing key 147 | * Refer to {@link http://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html|Calculate Signature} 148 | * 149 |
150 | kSecret = your secret access key
151 | kDate = HMAC("AWS4" + kSecret, Date)
152 | kRegion = HMAC(kDate, Region)
153 | kService = HMAC(kRegion, Service)
154 | kSigning = HMAC(kService, "aws4_request")
155 | 
156 | */ 157 | var get_signing_key = function (secret_key = '', d_str, service_info) { 158 | var k = ('AWS4' + secret_key), 159 | k_date = encrypt(k, d_str), 160 | k_region = encrypt(k_date, service_info.region), 161 | k_service = encrypt(k_region, service_info.service), 162 | k_signing = encrypt(k_service, 'aws4_request'); 163 | 164 | return k_signing; 165 | }; 166 | 167 | var get_signature = function (signing_key, str_to_sign) { 168 | return encrypt(signing_key, str_to_sign, 'hex'); 169 | }; 170 | 171 | /** 172 | * @private 173 | * Create authorization header 174 | * Refer to {@link http://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html|Add the Signing Information} 175 | */ 176 | var get_authorization_header = function (algorithm, access_key = '', scope, signed_headers, signature) { 177 | return [ 178 | algorithm + ' ' + 'Credential=' + access_key + '/' + scope, 179 | 'SignedHeaders=' + signed_headers, 180 | 'Signature=' + signature 181 | ].join(', '); 182 | }; 183 | 184 | /** 185 | * Sign a HTTP request, add 'Authorization' header to request param 186 | * @method sign 187 | * @memberof Signer 188 | * @static 189 | * 190 | * @param {object} request - HTTP request object 191 |
192 | request: {
193 |     method: GET | POST | PUT ...
194 |     url: ...,
195 |     headers: {
196 |         header1: ...
197 |     },
198 |     body: data
199 | }
200 | 
201 | * @param {object} access_info - AWS access credential info 202 |
203 | access_info: {
204 |     access_key: ...,
205 |     secret_key: ...,
206 |     session_token: ...
207 | }
208 | 
209 | * @param {object} [service_info] - AWS service type and region, optional, 210 | * if not provided then parse out from url 211 |
212 | service_info: {
213 |     service: ...,
214 |     region: ...
215 | }
216 | 
217 | * 218 | * @returns {object} Signed HTTP request 219 | */ 220 | var sign = function (request, access_info, service_info = null) { 221 | request.headers = request.headers || {}; 222 | 223 | // datetime string and date string 224 | var dt = new Date(), 225 | dt_str = dt.toISOString().replace(/[:-]|\.\d{3}/g, ''), 226 | d_str = dt_str.substr(0, 8), 227 | algorithm = 'AWS4-HMAC-SHA256'; 228 | 229 | var url_info = url.parse(request.url) 230 | request.headers['host'] = url_info.host; 231 | request.headers['x-amz-date'] = dt_str; 232 | if (access_info.session_token) { 233 | request.headers['X-Amz-Security-Token'] = access_info.session_token; 234 | } 235 | 236 | // Task 1: Create a Canonical Request 237 | var request_str = canonical_request(request); 238 | 239 | // Task 2: Create a String to Sign 240 | service_info = service_info || parse_service_info(request); 241 | var scope = credential_scope( 242 | d_str, 243 | service_info.region, 244 | service_info.service 245 | ); 246 | var str_to_sign = string_to_sign( 247 | algorithm, 248 | request_str, 249 | dt_str, 250 | scope 251 | ); 252 | 253 | // Task 3: Calculate the Signature 254 | var signing_key = get_signing_key( 255 | access_info.secret_key, 256 | d_str, 257 | service_info 258 | ), 259 | signature = get_signature(signing_key, str_to_sign); 260 | 261 | // Task 4: Adding the Signing information to the Request 262 | var authorization_header = get_authorization_header( 263 | algorithm, 264 | access_info.access_key, 265 | scope, 266 | signed_headers(request.headers), 267 | signature 268 | ); 269 | request.headers['Authorization'] = authorization_header; 270 | 271 | return request; 272 | }; 273 | 274 | /** 275 | * AWS request signer. 276 | * Refer to {@link http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html|Signature Version 4} 277 | * 278 | * @class Signer 279 | */ 280 | class Signer { 281 | static sign = sign; 282 | } 283 | 284 | export default Signer; 285 | export { Signer }; 286 | -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "lib", 4 | "rootDir": "src", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "moduleResolution": "node", 8 | "noEmitOnError": true, 9 | "declaration": true, 10 | "lib": [ 11 | "dom", 12 | "es6", 13 | "esnext.asynciterable", 14 | "es2017.object" 15 | ], 16 | "jsx": "react", 17 | "skipLibCheck": true 18 | }, 19 | "exclude": [ 20 | "lib", 21 | "__tests__" 22 | ], 23 | "compileOnSave": true 24 | } -------------------------------------------------------------------------------- /packages/react-relay-auth-iam/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@types/node@^8.10.48": 6 | version "8.10.59" 7 | resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.59.tgz#9e34261f30183f9777017a13d185dfac6b899e04" 8 | integrity sha512-8RkBivJrDCyPpBXhVZcjh7cQxVBSmRk9QM7hOketZzp6Tg79c0N8kkpAIito9bnJ3HCVCHVYz+KHTEbfQNfeVQ== 9 | 10 | aws-sdk@^2.449.0: 11 | version "2.639.0" 12 | resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.639.0.tgz#ae887a179939750de240ddeb680668300256900f" 13 | integrity sha512-cbH69oV0ObZ4tapbjDqu0j3I779uscQNhRaewjIJY5O5At4RULtd7us24n72FtT4HIwM9cwORzVxA9rK6DHKOA== 14 | dependencies: 15 | buffer "4.9.1" 16 | events "1.1.1" 17 | ieee754 "1.1.13" 18 | jmespath "0.15.0" 19 | querystring "0.2.0" 20 | sax "1.2.1" 21 | url "0.10.3" 22 | uuid "3.3.2" 23 | xml2js "0.4.19" 24 | 25 | base64-js@^1.0.2: 26 | version "1.3.1" 27 | resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" 28 | integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== 29 | 30 | buffer@4.9.1: 31 | version "4.9.1" 32 | resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" 33 | integrity sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg= 34 | dependencies: 35 | base64-js "^1.0.2" 36 | ieee754 "^1.1.4" 37 | isarray "^1.0.0" 38 | 39 | events@1.1.1: 40 | version "1.1.1" 41 | resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" 42 | integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ= 43 | 44 | ieee754@1.1.13, ieee754@^1.1.4: 45 | version "1.1.13" 46 | resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" 47 | integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== 48 | 49 | isarray@^1.0.0: 50 | version "1.0.0" 51 | resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" 52 | integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= 53 | 54 | jmespath@0.15.0: 55 | version "0.15.0" 56 | resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217" 57 | integrity sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc= 58 | 59 | punycode@1.3.2: 60 | version "1.3.2" 61 | resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" 62 | integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= 63 | 64 | querystring@0.2.0: 65 | version "0.2.0" 66 | resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" 67 | integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= 68 | 69 | react-relay-network-modern@^2.5.1: 70 | version "2.7.0" 71 | resolved "https://registry.yarnpkg.com/react-relay-network-modern/-/react-relay-network-modern-2.7.0.tgz#4436e5122125fadd2a408fa5b55716414e8c3fa4" 72 | integrity sha512-MsqTkvdWUoZcHjpqZzY7vaVFD2gWV0DbC+WGNqZ6RzDAkSG41u5WO4hBTFzElhXxiNPZ/cLf4hg9Q4anz/1NRA== 73 | 74 | sax@1.2.1: 75 | version "1.2.1" 76 | resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a" 77 | integrity sha1-e45lYZCyKOgaZq6nSEgNgozS03o= 78 | 79 | sax@>=0.6.0: 80 | version "1.2.4" 81 | resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" 82 | integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== 83 | 84 | typescript@3.1.1: 85 | version "3.1.1" 86 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.1.tgz#3362ba9dd1e482ebb2355b02dfe8bcd19a2c7c96" 87 | integrity sha512-Veu0w4dTc/9wlWNf2jeRInNodKlcdLgemvPsrNpfu5Pq39sgfFjvIIgTsvUHCoLBnMhPoUA+tFxsXjU6VexVRQ== 88 | 89 | url@0.10.3: 90 | version "0.10.3" 91 | resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64" 92 | integrity sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ= 93 | dependencies: 94 | punycode "1.3.2" 95 | querystring "0.2.0" 96 | 97 | url@^0.11.0: 98 | version "0.11.0" 99 | resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" 100 | integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= 101 | dependencies: 102 | punycode "1.3.2" 103 | querystring "0.2.0" 104 | 105 | uuid@3.3.2: 106 | version "3.3.2" 107 | resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" 108 | integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== 109 | 110 | xml2js@0.4.19: 111 | version "0.4.19" 112 | resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7" 113 | integrity sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q== 114 | dependencies: 115 | sax ">=0.6.0" 116 | xmlbuilder "~9.0.1" 117 | 118 | xmlbuilder@~9.0.1: 119 | version "9.0.7" 120 | resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" 121 | integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0= 122 | -------------------------------------------------------------------------------- /packages/react-relay-upload-s3/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | *.tgz 4 | -------------------------------------------------------------------------------- /packages/react-relay-upload-s3/.npmignore: -------------------------------------------------------------------------------- 1 | src/ 2 | *.tgz 3 | tsconfig.json 4 | -------------------------------------------------------------------------------- /packages/react-relay-upload-s3/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Lorenzo Di Giacomo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/react-relay-upload-s3/README.md: -------------------------------------------------------------------------------- 1 | # [React Relay Upload S3](https://github.com/morrys/react-relay-appsync) 2 | Middleware for Relay Modern Network Layer for upload file to AWS S3 3 | 4 | ## Installation 5 | 6 | Install react-relay-upload-s3 using yarn or npm: 7 | 8 | ``` 9 | yarn add react-relay-upload-s3 10 | ``` 11 | 12 | ## Usage 13 | 14 | How to create the RelayNetworkLayer 15 | 16 | ```typescript 17 | import {uploadS3Middleware} from 'react-relay-upload-s3'; 18 | ``` 19 | 20 | ```typescript 21 | const network = new RelayNetworkLayer( 22 | [ 23 | urlMiddleware(...), 24 | uploadS3Middleware({credentials: complexObjectsCredentials}), 25 | authMiddleware(...), 26 | ], 27 | {} 28 | ); 29 | ``` 30 | 31 | How to use in commitMutation 32 | 33 | ```typescript 34 | 35 | //single file 36 | const file:any = { 37 | bucket: bucket, 38 | key: key, 39 | region: region, 40 | file: selectedFile 41 | }; 42 | 43 | commitMutation( 44 | ... 45 | uploadables: { 46 | file 47 | }, 48 | ); 49 | 50 | //multiple files 51 | const file1:any = { 52 | bucket: bucket, 53 | key: key1, 54 | region: region, 55 | file: selectedFile1 56 | }; 57 | 58 | const file2:any = { 59 | bucket: bucket, 60 | key: key2, 61 | region: region, 62 | file: selectedFile2 63 | }; 64 | 65 | commitMutation( 66 | ... 67 | uploadables: { 68 | file1, 69 | file2 70 | }, 71 | ); 72 | ``` 73 | 74 | ## TODO 75 | 76 | Document how to use urlMiddleware and authMiddleware in the context of AWS 77 | 78 | ## License 79 | 80 | React Relay Upload S3 is [MIT licensed](./LICENSE). 81 | 82 | -------------------------------------------------------------------------------- /packages/react-relay-upload-s3/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-relay-upload-s3", 3 | "version": "0.0.1", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "aws-sdk": { 8 | "version": "2.449.0", 9 | "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.449.0.tgz", 10 | "integrity": "sha512-ywvqLoBUlibAkud+A3eXZbGv6pBZwqb/DolYvJJR834E8Dvp8+bYZY1+gCDe9a5hp15ICb2jD+vOM2W6ljUlHw==", 11 | "dev": true, 12 | "requires": { 13 | "buffer": "4.9.1", 14 | "events": "1.1.1", 15 | "ieee754": "1.1.8", 16 | "jmespath": "0.15.0", 17 | "querystring": "0.2.0", 18 | "sax": "1.2.1", 19 | "url": "0.10.3", 20 | "uuid": "3.3.2", 21 | "xml2js": "0.4.19" 22 | } 23 | }, 24 | "base64-js": { 25 | "version": "1.3.0", 26 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", 27 | "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", 28 | "dev": true 29 | }, 30 | "buffer": { 31 | "version": "4.9.1", 32 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", 33 | "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", 34 | "dev": true, 35 | "requires": { 36 | "base64-js": "^1.0.2", 37 | "ieee754": "^1.1.4", 38 | "isarray": "^1.0.0" 39 | } 40 | }, 41 | "events": { 42 | "version": "1.1.1", 43 | "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", 44 | "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", 45 | "dev": true 46 | }, 47 | "ieee754": { 48 | "version": "1.1.8", 49 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", 50 | "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=", 51 | "dev": true 52 | }, 53 | "isarray": { 54 | "version": "1.0.0", 55 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 56 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 57 | "dev": true 58 | }, 59 | "jmespath": { 60 | "version": "0.15.0", 61 | "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", 62 | "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=", 63 | "dev": true 64 | }, 65 | "punycode": { 66 | "version": "1.3.2", 67 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", 68 | "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", 69 | "dev": true 70 | }, 71 | "querystring": { 72 | "version": "0.2.0", 73 | "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", 74 | "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", 75 | "dev": true 76 | }, 77 | "react-relay-network-modern": { 78 | "version": "2.7.0", 79 | "resolved": "https://registry.npmjs.org/react-relay-network-modern/-/react-relay-network-modern-2.7.0.tgz", 80 | "integrity": "sha512-MsqTkvdWUoZcHjpqZzY7vaVFD2gWV0DbC+WGNqZ6RzDAkSG41u5WO4hBTFzElhXxiNPZ/cLf4hg9Q4anz/1NRA==", 81 | "dev": true 82 | }, 83 | "sax": { 84 | "version": "1.2.1", 85 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", 86 | "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=", 87 | "dev": true 88 | }, 89 | "typescript": { 90 | "version": "3.1.1", 91 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.1.tgz", 92 | "integrity": "sha512-Veu0w4dTc/9wlWNf2jeRInNodKlcdLgemvPsrNpfu5Pq39sgfFjvIIgTsvUHCoLBnMhPoUA+tFxsXjU6VexVRQ==", 93 | "dev": true 94 | }, 95 | "url": { 96 | "version": "0.10.3", 97 | "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", 98 | "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", 99 | "dev": true, 100 | "requires": { 101 | "punycode": "1.3.2", 102 | "querystring": "0.2.0" 103 | } 104 | }, 105 | "uuid": { 106 | "version": "3.3.2", 107 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", 108 | "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", 109 | "dev": true 110 | }, 111 | "xml2js": { 112 | "version": "0.4.19", 113 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", 114 | "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", 115 | "dev": true, 116 | "requires": { 117 | "sax": ">=0.6.0", 118 | "xmlbuilder": "~9.0.1" 119 | } 120 | }, 121 | "xmlbuilder": { 122 | "version": "9.0.7", 123 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", 124 | "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", 125 | "dev": true 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /packages/react-relay-upload-s3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-relay-upload-s3", 3 | "version": "0.0.2", 4 | "keywords": [ 5 | "graphql", 6 | "relay", 7 | "upload", 8 | "react", 9 | "aws", 10 | "appsync", 11 | "s3" 12 | ], 13 | "main": "lib/index.js", 14 | "license": "MIT", 15 | "description": "React Relay Middleware Upload S3", 16 | "author": { 17 | "name": "morrys" 18 | }, 19 | "homepage": "https://github.com/morrys/react-relay-appsync#readme", 20 | "repository": { 21 | "type": "git", 22 | "url": "https://github.com/morrys/react-relay-appsync" 23 | }, 24 | "scripts": { 25 | "prepare": "tsc" 26 | }, 27 | "dependencies": {}, 28 | "peerDependencies": { 29 | "react-relay": ">=1.4.0" 30 | }, 31 | "devDependencies": { 32 | "typescript": "3.1.1", 33 | "aws-sdk": "^2.449.0", 34 | "react-relay-network-modern": "^2.5.1" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/react-relay-upload-s3/src/index.ts: -------------------------------------------------------------------------------- 1 | export {default as uploadS3Middleware} from "./middleware-upload-s3"; 2 | -------------------------------------------------------------------------------- /packages/react-relay-upload-s3/src/middleware-upload-s3.ts: -------------------------------------------------------------------------------- 1 | import { Middleware, RelayNetworkLayerRequest } from 'react-relay-network-modern/lib/definition'; 2 | import { Credentials, CredentialsOptions } from 'aws-sdk/lib/credentials'; 3 | import * as S3 from 'aws-sdk/clients/s3'; 4 | 5 | type CredentialsGetter = () => (Credentials | CredentialsOptions | Promise | Promise | null) | Credentials | CredentialsOptions | Promise | Promise | null; 6 | 7 | export type UploadS3MiddlewareOpts = { 8 | credentials: CredentialsGetter 9 | }; 10 | 11 | export interface FileS3Type { 12 | bucket: string 13 | key: string 14 | region: string 15 | file: File | Blob 16 | } 17 | 18 | export interface UploadableS3 { 19 | [key: string]: FileS3Type; 20 | } 21 | 22 | function upload(fileField: FileS3Type, { credentials }) { 23 | const Body = fileField.file; 24 | const { type: ContentType } = Body; 25 | 26 | const { 27 | bucket: Bucket, 28 | key: Key, 29 | region, 30 | } = fileField; 31 | const s3 = new S3({ 32 | credentials, 33 | region, 34 | }); 35 | 36 | return s3.upload({ 37 | Bucket, 38 | Key, 39 | Body, 40 | ContentType, 41 | }).promise(); 42 | }; 43 | 44 | export default function uploadS3Middleware(opts: UploadS3MiddlewareOpts): Middleware { 45 | const { 46 | credentials, 47 | } = opts; 48 | return (next) => async (req: RelayNetworkLayerRequest) => { 49 | const uploadables: UploadableS3 = req.uploadables; 50 | if (uploadables) { 51 | const uploadCredentials = typeof credentials === 'function' ? (credentials as any).call() : credentials; 52 | const uploadPromise = Promise.resolve(uploadCredentials) 53 | .then(credentials => { 54 | const uploadPromises = Object.entries(uploadables).map(([_, fileUpload]) => upload(fileUpload, { credentials })); 55 | return Promise.all([...uploadPromises] as Promise[]); 56 | }).then(() => { 57 | delete req.uploadables; 58 | req.fetchOpts.body = req.prepareBody(); 59 | return next(req) 60 | }) 61 | return uploadPromise; 62 | } else { 63 | return next(req) 64 | } 65 | }; 66 | } -------------------------------------------------------------------------------- /packages/react-relay-upload-s3/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "lib", 4 | "rootDir": "src", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "moduleResolution": "node", 8 | "noEmitOnError": true, 9 | "declaration": true, 10 | "lib": [ 11 | "dom", 12 | "es6", 13 | "esnext.asynciterable", 14 | "es2017.object" 15 | ], 16 | "jsx": "react", 17 | "skipLibCheck": true 18 | }, 19 | "exclude": [ 20 | "lib", 21 | "__tests__" 22 | ], 23 | "compileOnSave": true 24 | } -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | *.tgz 4 | lerna-debug.log 5 | .npmrc 6 | build -------------------------------------------------------------------------------- /website/core/Footer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | const React = require('react'); 9 | 10 | class Footer extends React.Component { 11 | docUrl(doc, language) { 12 | const baseUrl = this.props.config.baseUrl; 13 | const docsUrl = this.props.config.docsUrl; 14 | const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`; 15 | const langPart = `${language ? `${language}/` : ''}`; 16 | return `${baseUrl}${docsPart}${langPart}${doc}`; 17 | } 18 | 19 | pageUrl(doc, language) { 20 | const baseUrl = this.props.config.baseUrl; 21 | return baseUrl + (language ? `${language}/` : '') + doc; 22 | } 23 | 24 | render() { 25 | return ( 26 | 104 | ); 105 | } 106 | } 107 | 108 | module.exports = Footer; 109 | -------------------------------------------------------------------------------- /website/i18n/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "This file is auto-generated by write-translations.js", 3 | "localized-strings": { 4 | "next": "Next", 5 | "previous": "Previous", 6 | "tagline": "Collection of libraries usable for the web, react and react-native.", 7 | "docs": { 8 | "react-relay-auth-iam": { 9 | "title": "React Relay Auth IAM" 10 | }, 11 | "react-relay-appsync": { 12 | "title": "Getting Started" 13 | }, 14 | "react-relay-upload-s3": { 15 | "title": "React Relay Upload S3" 16 | } 17 | }, 18 | "links": { 19 | "Docs": "Docs", 20 | "GitHub": "GitHub" 21 | }, 22 | "categories": { 23 | "React Relay AppSync": "React Relay AppSync", 24 | "React Relay Auth IAM": "React Relay Auth IAM", 25 | "React Relay Upload S3": "React Relay Upload S3" 26 | } 27 | }, 28 | "pages-strings": { 29 | "Help Translate|recruit community translators for your project": "Help Translate", 30 | "Edit this Doc|recruitment message asking to edit the doc source": "Edit", 31 | "Translate this Doc|recruitment message asking to translate the docs": "Translate" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "repository": "morrys/react-relay-appsync", 3 | "license": "MIT", 4 | "private": true, 5 | "scripts": { 6 | "start": "docusaurus-start", 7 | "build": "docusaurus-build", 8 | "docpub": "docusaurus-publish" 9 | }, 10 | "dependencies": { 11 | "docusaurus": "1.12.0" 12 | } 13 | } -------------------------------------------------------------------------------- /website/sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "React Relay AppSync": [ 4 | "react-relay-appsync" 5 | ], 6 | "React Relay Auth IAM": [ 7 | "react-relay-auth-iam" 8 | ], 9 | "React Relay Upload S3": [ 10 | "react-relay-upload-s3" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /website/siteConfig.js: -------------------------------------------------------------------------------- 1 | const siteConfig = { 2 | title: 'Morrys Repositories', 3 | tagline: 'Collection of libraries usable for the web, react and react-native.', 4 | url: 'https://morrys.github.io', 5 | baseUrl: '/react-relay-appsync/', 6 | projectName: 'react-relay-appsync', 7 | organizationName: 'morrys', 8 | headerLinks: [ 9 | { doc: 'react-relay-appsync', label: 'Docs' }, 10 | { 11 | href: 'https://github.com/morrys/react-relay-appsync', 12 | label: 'GitHub', 13 | }, 14 | { languages: false }, 15 | ], 16 | 17 | /* path to images for header/footer */ 18 | headerIcon: 'img/favicon.ico', 19 | footerIcon: 'img/favicon.ico', 20 | favicon: 'img/favicon.ico', 21 | colors: { 22 | primaryColor: '#008ed8', 23 | secondaryColor: '#17afff', 24 | }, 25 | 26 | /* Custom fonts for website */ 27 | /* 28 | fonts: { 29 | myFont: [ 30 | "Times New Roman", 31 | "Serif" 32 | ], 33 | myOtherFont: [ 34 | "-apple-system", 35 | "system-ui" 36 | ] 37 | }, 38 | */ 39 | 40 | // This copyright info is used in /core/Footer.js and blog RSS/Atom feeds. 41 | copyright: `Copyright © ${new Date().getFullYear()} Lorenzo Di Giacomo`, 42 | 43 | highlight: { 44 | // Highlight.js theme to use for syntax highlighting in code blocks. 45 | theme: 'default', 46 | }, 47 | 48 | // Add custom scripts here that would be placed in 9 | Your Site Title Here 10 | 11 | 12 | If you are not redirected automatically, follow this link. 13 | 14 | --------------------------------------------------------------------------------