Skip to content

Commit

Permalink
Merge branch 'dsp-add-contributors-readme' of github.com:redwoodjs/re…
Browse files Browse the repository at this point in the history
…dwood into dsp-add-contributors-readme
  • Loading branch information
thedavidprice committed Aug 23, 2020
2 parents 81597f1 + 9cb5935 commit 51dab26
Show file tree
Hide file tree
Showing 172 changed files with 4,951 additions and 2,420 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/build-eslint-jest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,43 @@ on:
push:
branches: [main]
pull_request:
types: [opened, edited, synchronize, reopened]
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: ${{ matrix.os }}
all:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: ['12', '14']
fail-fast: false
os: ['ubuntu-latest', 'windows-latest']
node-version: ['14', '12']
fail-fast: true
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} | Node ${{ matrix.node-version }} latest
steps:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Print node and yarn versions
run: |
node --version
yarn --version

- name: Cache "node_modules"
uses: actions/cache@v2
with:
path: '**/node_modules'
key: node_modules_${{ runner.os }}_${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
run: yarn install --frozen-lockfile --check-files

- name: Run ESLint
run: yarn lint
env:
CI: true

- name: Build
run: yarn build

- name: Run tests
run: yarn test
env:
CI: true
CI: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.idea
.DS_Store
.nvmrc
node_modules
dist
packages/api/importAll.macro.js
lerna-debug.log
yarn-error.log
**/*.tsbuildinfo
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
**/dist
packages/api/importAll.macro.js

# Do not format Markdown files to allow easier documentation contribution
*.md
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ cycles choosing and re-choosing various technologies and configurations. Plus,
because Redwood is a proper framework, you benefit from continued performance
and feature upgrades over time and with minimum effort.

> **WARNING:** Redwood is still in the **alpha** phase of development. We do not
> recommend that you use Redwood applications in production at this time. That said,
> your input can have a huge impact during this period, and we welcome your feedback
> and ideas! Check out the [Redwood Community
> **WARNING:** RedwoodJS software has not reached a stable version 1.0 and should
> not be considered suitable for production use. In the "make it work; make it
> right; make it fast" paradigm, Redwood is in the later stages of the "make it
> work" phase. That said, your input can have a huge impact during this period,
> and we welcome your feedback and ideas! Check out the [Redwood Community
> Forum](https://community.redwoodjs.com/) to join in.
> **TUTORIAL:** The best way to get to know Redwood is by going through the extensive
Expand Down
17 changes: 8 additions & 9 deletions __fixtures__/new-project/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4700,9 +4700,9 @@ elegant-spinner@^1.0.1:
integrity sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=

elliptic@^6.0.0, elliptic@^6.5.2:
version "6.5.2"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762"
integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==
version "6.5.3"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==
dependencies:
bn.js "^4.4.0"
brorand "^1.0.1"
Expand Down Expand Up @@ -6240,7 +6240,7 @@ http-errors@~1.6.2:
setprototypeof "1.1.0"
statuses ">= 1.4.0 < 2"

http-parser-js@>=0.5.1, http-parser-js@^0.5.2:
http-parser-js@>=0.5.1:
version "0.5.2"
resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.2.tgz#da2e31d237b393aae72ace43882dd7e270a8ff77"
integrity sha512-opCO9ASqg5Wy2FNo7A0sxy71yGbbkJJXLdgMK04Tcypw9jr2MgWbyubb0+WdmDmGnFflO7fRbqbaihh/ENDlRQ==
Expand Down Expand Up @@ -10895,11 +10895,10 @@ typescript@^3.8.3:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.3.tgz#d3ac8883a97c26139e42df5e93eeece33d610b8a"
integrity sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==

"undici@github:mcollina/undici":
version "1.0.3"
resolved "https://codeload.github.com/mcollina/undici/tar.gz/f322ede34fa38d2c5b5782711b306dc3ad4ef1e2"
dependencies:
http-parser-js "^0.5.2"
undici@mcollina/undici:
version "1.2.6"
uid adf72147d9e9950b0300dfccbdcd49c6d734518c
resolved "https://codeload.github.com/mcollina/undici/tar.gz/adf72147d9e9950b0300dfccbdcd49c6d734518c"

unicode-canonical-property-names-ecmascript@^1.0.4:
version "1.0.4"
Expand Down
15 changes: 10 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ module.exports = {
overrides: [
// ** WEB PACKAGES **
{
test: ['./packages/router', './packages/web/', './packages/auth/'],
test: [
'./packages/router',
'./packages/web/',
'./packages/auth/',
'./packages/forms/',
],
presets: [
[
'@babel/preset-env',
Expand Down Expand Up @@ -91,9 +96,9 @@ module.exports = {
],
},
],
// Do not build tests or mocks in production.
// Ignore test directories when we're not testing
ignore:
process.env.NODE_ENV === 'production'
? [/\.test\.(js|ts)/, '**/__tests__', '**/__mocks__']
: [],
process.env.NODE_ENV === 'test'
? []
: [/\.test\.(js|ts)/, '**/__tests__', '**/__mocks__'],
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.14.0",
"version": "0.16.0",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@
"babel-jest": "^26.1.0",
"babel-plugin-auto-import": "^1.0.5",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-remove-code": "^0.0.6",
"bundlesize": "^0.18.0",
"cp-cli": "^2.0.0",
"cross-env": "^7.0.2",
"jest": "^26.1.0",
"lerna": "^3.20.2",
"msw": "0.19.3",
"msw": "0.20.0",
"nodemon": "^2.0.2",
"typescript": "^3.9.6",
"rimraf": "^3.0.2",
"typescript": "^3.9.7",
"whatwg-fetch": "3.0.0"
},
"resolutions": {
Expand All @@ -39,13 +42,11 @@
"extends": "@redwoodjs/eslint-config"
},
"scripts": {
"build": "yarn build:clean && yarn build:js",
"build:clean": "lerna run build:clean",
"build:js": "cross-env NODE_ENV=production lerna run build",
"build:types": "tsc --build --clean && tsc --build",
"build:watch": "lerna run build:watch --parallel",
"test": "lerna run test --stream -- --colors",
"lint": "yarn eslint packages",
"lint:fix": "yarn eslint --fix packages"
"build": "tsc --build --verbose && lerna run build:js",
"build:clean": "rimraf ./packages/**/dist",
"build:watch": "tsc --build && lerna run build:watch --parallel",
"test": "lerna run test --stream -- --colors --maxWorkers=4",
"lint": "eslint packages",
"lint:fix": "eslint --fix packages"
}
}
41 changes: 15 additions & 26 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,45 @@
{
"name": "@redwoodjs/api",
"version": "0.14.0",
"version": "0.16.0",
"files": [
"dist",
"importAll.macro.js"
"dist"
],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
"dependencies": {
"@prisma/client": "^2.1.1",
"@redwoodjs/internal": "^0.14.0",
"@prisma/client": "2.4.0",
"@redwoodjs/internal": "^0.16.0",
"apollo-server-lambda": "2.16.0",
"babel-plugin-macros": "^2.8.0",
"core-js": "3.6.4",
"glob": "^7.1.6",
"graphql": "^14.6.0",
"graphql-iso-date": "^3.6.1",
"graphql-scalars": "^1.2.6",
"graphql-tools": "4.0.7",
"graphql-type-json": "^0.3.1",
"jsonwebtoken": "^8.5.1",
"jwks-rsa": "^1.8.0",
"jwks-rsa": "^1.8.1",
"lodash.merge": "^4.6.2",
"lodash.omitby": "^4.6.0",
"merge-graphql-schemas": "^1.7.6"
},
"devDependencies": {
"@redwoodjs/auth": "^0.14.0",
"@types/graphql-iso-date": "^3.4.0",
"@types/graphql-type-json": "^0.3.2",
"@redwoodjs/auth": "^0.16.0",
"@redwoodjs/dev-server": "^0.16.0",
"@types/jsonwebtoken": "^8.3.9",
"@types/lodash.merge": "^4.6.6",
"@types/lodash.omitby": "^4.6.6",
"babel-plugin-tester": "^9.0.0",
"del-cli": "^3.0.0",
"gotrue-js": "^0.9.25",
"move-cli": "^1.2.1"
"@types/lodash.omitby": "^4.6.6"
},
"jest": {
"testPathIgnorePatterns": [
"/fixtures/",
"/dist/"
]
},
"scripts": {
"build": "yarn build:clean && yarn build:js",
"build:js": "yarn cross-env NODE_ENV=production babel src -d dist --extensions \".js,.ts\" --source-maps inline && yarn move-cli ./dist/importAll.macro.js ./importAll.macro.js",
"build:types": "tsc --build --clean && tsc --build",
"build:clean": "yarn del-cli dist importAll.macro.js",
"prepublishOnly": "yarn build",
"build:watch": "nodemon --watch src --ext \"js,ts,tsx\" --ignore dist --ignore importAll.macro.js --exec \"yarn build\"",
"test": "yarn jest",
"build": "yarn build:js && yarn build:types",
"prepublishOnly": "yarn cross-env NODE_ENV=production yarn build",
"build:js": "babel src -d dist --extensions \".js,.ts,.tsx\"",
"build:types": "tsc --build --verbose",
"build:watch": "nodemon --watch src --ext \"js,ts,tsx\" --ignore dist --exec \"yarn build\"",
"test": "jest",
"test:watch": "yarn test --watch"
},
"gitHead": "1cb7c8d1085147787209af423c33a9c91c3e6517"
Expand Down

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
24 changes: 0 additions & 24 deletions packages/api/src/__tests__/importAll.macro.test.js

This file was deleted.

20 changes: 14 additions & 6 deletions packages/api/src/auth/decoders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ export const decodeToken = async (
}
): Promise<null | string | object> => {
if (!typesToDecoders[type]) {
throw new Error(
`The auth type "${type}" is not supported, we currently support: ${Object.keys(
typesToDecoders
).join(', ')}`
)
// Make this a warning, instead of a hard error
// Allow users to have multiple custom types if they choose to
if (process.env.NODE_ENV === 'development') {
console.warn(
`The auth type "${type}" is not officially supported, we currently support: ${Object.keys(
typesToDecoders
).join(', ')}`
)

console.warn(
'Please ensure you have handlers for your custom auth in getCurrentUser in src/lib/auth.{js,ts}'
)
}
}
const decoder = typesToDecoders[type]
const decoder = typesToDecoders[type] || noop
return decoder(token, req)
}
9 changes: 5 additions & 4 deletions packages/api/src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ export const parseAuthorizationHeader = (

export type AuthContextPayload = [
string | object | null,
{ type: SupportedAuthTypes; token: string }
{ type: SupportedAuthTypes } & AuthorizationHeader,
{ event: APIGatewayProxyEvent; context: GlobalContext & LambdaContext }
]

/**
* Get the authorization information from the request headers and request context.
* @returns [decoded, { type, token }]
* @returns [decoded, { type, schema, token }, { event, context }]
**/
export const getAuthenticationContext = async ({
event,
Expand All @@ -55,7 +56,7 @@ export const getAuthenticationContext = async ({
}

let decoded = null
const { token } = parseAuthorizationHeader(event)
const { schema, token } = parseAuthorizationHeader(event)
decoded = await decodeToken(type, token, { event, context })
return [decoded, { type, token }]
return [decoded, { type, schema, token }, { event, context }]
}
Loading

0 comments on commit 51dab26

Please sign in to comment.